mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
0f906dad6f
commit
45392615cd
1 changed files with 11 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue