aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2017-11-28 20:55:50 +0100
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-11-29 01:22:01 +0100
commit006a0ebb39cb4f78fb62b9f4b83efe1e5a76ad4c (patch)
tree0227724d6f3de9f329f5cc85525fbb59d0e09257 /desktop-widgets/tab-widgets/maintab.cpp
parenta95cc2b1c5bb9bb4f2ad73f00f06a8d35af50e93 (diff)
downloadsubsurface-006a0ebb39cb4f78fb62b9f4b83efe1e5a76ad4c.tar.gz
Don't change visibility of depth and duration UI field when no dive
After one selected a dive and then selects NO dive don't touch the visibility of UI fields for depth and duration. So if previously selected dive was a manually added dive, keep them visible. If it was no manually added dive keep them invisible. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'desktop-widgets/tab-widgets/maintab.cpp')
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index 0a57fd4e8..b41f112e8 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -549,11 +549,13 @@ void MainTab::updateDiveInfo(bool clear)
weightModel->updateDive();
taglist_get_tagstring(displayed_dive.tag_list, buf, 1024);
ui.tagWidget->setText(QString(buf));
- bool isManual = !current_dive || same_string(current_dive->dc.model, "manually added dive");
- ui.depth->setVisible(isManual);
- ui.depthLabel->setVisible(isManual);
- ui.duration->setVisible(isManual);
- ui.durationLabel->setVisible(isManual);
+ if (current_dive) {
+ bool isManual = same_string(current_dive->dc.model, "manually added dive");
+ ui.depth->setVisible(isManual);
+ ui.depthLabel->setVisible(isManual);
+ ui.duration->setVisible(isManual);
+ ui.durationLabel->setVisible(isManual);
+ }
}
ui.duration->setText(QDateTime::fromTime_t(displayed_dive.duration.seconds).toUTC().toString("h:mm"));
ui.depth->setText(get_depth_string(displayed_dive.maxdepth, true));