summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-08 07:38:26 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-08 07:38:26 +0100
commit37445df0b923f4db904d9d98e89433ddd80d2cc2 (patch)
tree5c8b07d2a9ac3ff821fd59c86364be5b83196362
parentef2765d0c4fe94fef1771390ff1d22d2895d295a (diff)
downloadsubsurface-37445df0b923f4db904d9d98e89433ddd80d2cc2.tar.gz
Clear date and time when no dive is shown
So far we showed bogus date and time - whatever time it might be in UTC at midnight 2000-1-1 in your timezone. Instead we now show a discrete little "-" in both fields. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/maintab.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 49af15677..446ad7716 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -709,6 +709,10 @@ void MainTab::updateDiveInfo(bool clear)
ui.locationTags->hide();
else
ui.locationTags->show();
+ /* unset the special value text for date and time, just in case someone dove at midnight */
+ ui.dateEdit->setSpecialValueText(QString(""));
+ ui.timeEdit->setSpecialValueText(QString(""));
+
} else {
/* clear the fields */
clearInfo();
@@ -717,6 +721,13 @@ void MainTab::updateDiveInfo(bool clear)
ui.rating->setCurrentStars(0);
ui.visibility->setCurrentStars(0);
ui.location->clear();
+ /* set date and time to minimums which triggers showing the special value text */
+ ui.dateEdit->setSpecialValueText(QString("-"));
+ ui.dateEdit->setMinimumDate(QDate(1, 1, 1));
+ ui.dateEdit->setDate(QDate(1, 1, 1));
+ ui.timeEdit->setSpecialValueText(QString("-"));
+ ui.timeEdit->setMinimumTime(QTime(0, 0, 0, 0));
+ ui.timeEdit->setTime(QTime(0, 0, 0, 0));
}
editMode = rememberEM;
ui.cylinders->view()->hideColumn(CylindersModel::DEPTH);