diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-07-16 10:43:37 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-07-16 10:43:37 -0700 |
commit | 45392615cdd926fe3220c616f2f91d1295ae5c44 (patch) | |
tree | 82d96827dd587ff6d1e8010bbe8bfda7b0853a62 | |
parent | 0f906dad6ff7063cb46f33e1645433b38f75a68d (diff) | |
download | subsurface-45392615cdd926fe3220c616f2f91d1295ae5c44.tar.gz |
Dive edit: handle dive sites more sanely while editing
While we edit things, displayed_dive_site is the authoratative source of
data that should be displayed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/maintab.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index c9a606dd3..9b40d31fd 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -494,7 +494,17 @@ void MainTab::updateDiveInfo(bool clear) ui.DiveType->setCurrentIndex(get_dive_dc(&displayed_dive, dc_number)->divemode); if (!clear) { - struct dive_site *ds = get_dive_site_by_uuid(displayed_dive.dive_site_uuid); + struct dive_site *ds = NULL; + // if we are showing a dive and editing it, let's refer to the displayed_dive_site as that + // already may contain changes, otherwise start with the dive site referred to by the displayed + // dive + if (rememberEM == DIVE) { + ds = &displayed_dive_site; + } else { + ds = get_dive_site_by_uuid(displayed_dive.dive_site_uuid); + if (ds) + copy_dive_site(ds, &displayed_dive_site); + } ui.geocodeButton->setVisible(ds && dive_site_has_gps_location(ds)); if (ds) { // construct the location tags @@ -520,8 +530,6 @@ void MainTab::updateDiveInfo(bool clear) } ui.location->setText(ds->name); ui.locationTags->setText(locationTag); - if (displayed_dive.dive_site_uuid) - copy_dive_site(get_dive_site_by_uuid(displayed_dive.dive_site_uuid), &displayed_dive_site); } else { ui.location->clear(); clear_dive_site(&displayed_dive_site); |