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>
This commit is contained in:
Stefan Fuchs 2017-11-28 20:55:50 +01:00 committed by Lubomir I. Ivanov
parent a95cc2b1c5
commit 006a0ebb39

View file

@ -549,12 +549,14 @@ 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");
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));
ui.DiveType->setCurrentIndex(get_dive_dc(&displayed_dive, dc_number)->divemode);