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>
This commit is contained in:
Dirk Hohndel 2015-10-08 07:38:26 +01:00
parent ef2765d0c4
commit 37445df0b9

View file

@ -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);