diff options
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r-- | qt-ui/maintab.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index ca0aba926..cf9a30c21 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -213,7 +213,7 @@ void MainTab::enableEdition(EditMode newEditMode) notesBackup[mydive].coordinates = ui.coordinates->text(); notesBackup[mydive].airtemp = get_temperature_string(mydive->airtemp, true); notesBackup[mydive].watertemp = get_temperature_string(mydive->watertemp, true); - notesBackup[mydive].datetime = QDateTime::fromTime_t(mydive->when - gettimezoneoffset()).toString(); + notesBackup[mydive].datetime = QDateTime::fromTime_t(mydive->when).toUTC().toString(); char buf[1024]; taglist_get_tagstring(mydive->tag_list, buf, 1024); notesBackup[mydive].tags = QString(buf); @@ -334,7 +334,7 @@ void MainTab::updateDiveInfo(int dive) UPDATE_TEMP(d, watertemp); if (d) { updateGpsCoordinates(d); - ui.dateTimeEdit->setDateTime(QDateTime::fromTime_t(d->when - gettimezoneoffset())); + ui.dateTimeEdit->setDateTime(QDateTime::fromTime_t(d->when).toUTC()); if (mainWindow() && mainWindow()->dive_list()->selectedTrips().count() == 1) { setTabText(0, tr("Trip Notes")); // only use trip relevant fields @@ -352,8 +352,9 @@ void MainTab::updateDiveInfo(int dive) ui.visibilityLabel->setVisible(false); ui.tagWidget->setVisible(false); ui.TagLabel->setVisible(false); - ui.TemperaturesLabel->setVisible(false); + ui.airTempLabel->setVisible(false); ui.airtemp->setVisible(false); + ui.waterTempLabel->setVisible(false); ui.watertemp->setVisible(false); // rename the remaining fields and fill data from selected trip dive_trip_t *currentTrip = *mainWindow()->dive_list()->selectedTrips().begin(); @@ -378,8 +379,9 @@ void MainTab::updateDiveInfo(int dive) ui.DivemasterLabel->setVisible(true); ui.TagLabel->setVisible(true); ui.tagWidget->setVisible(true); - ui.TemperaturesLabel->setVisible(true); + ui.airTempLabel->setVisible(true); ui.airtemp->setVisible(true); + ui.waterTempLabel->setVisible(true); ui.watertemp->setVisible(true); /* and fill them from the dive */ ui.rating->setCurrentStars(d->rating); @@ -772,7 +774,9 @@ void MainTab::on_watertemp_textChanged(const QString& text) void MainTab::on_dateTimeEdit_dateTimeChanged(const QDateTime& datetime) { - EDIT_SELECTED_DIVES( mydive->when = datetime.toTime_t() + gettimezoneoffset() ); + QDateTime dateTimeUtc(datetime); + dateTimeUtc.setTimeSpec(Qt::UTC); + EDIT_SELECTED_DIVES( mydive->when = dateTimeUtc.toTime_t() ); markChangedWidget(ui.dateTimeEdit); } |