Qt6: update to newer APIs for QDateTime

Fortunately, these were already available in Qt5.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2022-02-09 16:47:37 -08:00
parent 6f46238fc4
commit e29ecf2c9a
2 changed files with 6 additions and 6 deletions

View file

@ -753,9 +753,9 @@ timestamp_t dateTimeToTimestamp(const QDateTime &t)
QString render_seconds_to_string(int seconds)
{
if (seconds % 60 == 0)
return QDateTime::fromTime_t(seconds).toUTC().toString("h:mm");
return QDateTime::fromSecsSinceEpoch(seconds, Qt::UTC).toUTC().toString("h:mm");
else
return QDateTime::fromTime_t(seconds).toUTC().toString("h:mm:ss");
return QDateTime::fromSecsSinceEpoch(seconds, Qt::UTC).toUTC().toString("h:mm:ss");
}
int parseDurationToSeconds(const QString &text)

View file

@ -144,7 +144,7 @@ void ShiftImageTimesDialog::syncCameraClicked()
ui.DCImage->setScene(scene);
dcImageEpoch = picture_get_timestamp(qPrintable(fileNames.at(0)));
QDateTime dcDateTime = QDateTime::fromTime_t(dcImageEpoch, Qt::UTC);
QDateTime dcDateTime = QDateTime::fromSecsSinceEpoch(dcImageEpoch, Qt::UTC);
ui.dcTime->setDateTime(dcDateTime);
connect(ui.dcTime, SIGNAL(dateTimeChanged(const QDateTime &)), this, SLOT(dcDateTimeChanged(const QDateTime &)));
}
@ -213,8 +213,8 @@ void ShiftImageTimesDialog::updateInvalid()
bool allValid = true;
ui.warningLabel->hide();
ui.invalidFilesText->hide();
QDateTime time_first = QDateTime::fromTime_t(first_selected_dive()->when, Qt::UTC);
QDateTime time_last = QDateTime::fromTime_t(last_selected_dive()->when, Qt::UTC);
QDateTime time_first = QDateTime::fromSecsSinceEpoch(first_selected_dive()->when, Qt::UTC);
QDateTime time_last = QDateTime::fromSecsSinceEpoch(last_selected_dive()->when, Qt::UTC);
if (first_selected_dive() == last_selected_dive()) {
ui.invalidFilesText->setPlainText(tr("Selected dive date/time") + ": " + time_first.toString());
} else {
@ -229,7 +229,7 @@ void ShiftImageTimesDialog::updateInvalid()
continue;
// We've found an invalid image
time_first.setTime_t(timestamps[i] + m_amount);
time_first.setSecsSinceEpoch(timestamps[i] + m_amount);
if (timestamps[i] == 0)
ui.invalidFilesText->append(fileNames[i] + " - " + tr("No Exif date/time found"));
else