desktop: hide/unhide tags if dive site was edited

The tags of the dive site were shown/hidden when changing the
current dive.

Thus the following could happen:
1) User changes to dive with no tags. Tags are hidden.
2) User add image, which creates GPS tag
3) Tag is updated but not shown.

Fix this by showing/hiding tags when they are calculated not
when switching the dive.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-05-08 11:43:22 +02:00 committed by Dirk Hohndel
parent ab6cac9799
commit ce7cc79705

View file

@ -331,6 +331,11 @@ void MainTab::updateDiveSite(struct dive *d)
ui.locationTags->clear();
ui.editDiveSiteButton->setEnabled(false);
}
if (ui.locationTags->text().isEmpty())
ui.locationTags->hide();
else
ui.locationTags->show();
}
void MainTab::updateDiveInfo()
@ -444,10 +449,6 @@ void MainTab::updateDiveInfo()
ui.duration->setText(render_seconds_to_string(current_dive->duration.seconds));
ui.depth->setText(get_depth_string(current_dive->maxdepth, true));
if(ui.locationTags->text().isEmpty())
ui.locationTags->hide();
else
ui.locationTags->show();
ui.editDiveSiteButton->setEnabled(!ui.location->text().isEmpty());
/* unset the special value text for date and time, just in case someone dove at midnight */
ui.dateEdit->setSpecialValueText(QString());