diff options
author | Stefan Fuchs <sfuchs@gmx.de> | 2017-04-30 22:24:08 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-05-01 21:23:42 -0700 |
commit | d5af6cab9ffdd7e27c2d78c25646c9d61f9f8a28 (patch) | |
tree | 8bf6bc952f3ee2ed3307533f563e41b9ec117408 /desktop-widgets/simplewidgets.cpp | |
parent | fff253e8cfe500482a3fc2b6b59a2b20677f19ff (diff) | |
download | subsurface-d5af6cab9ffdd7e27c2d78c25646c9d61f9f8a28.tar.gz |
Picture feature: Improve UI and translation of shift image times...
... dialog (part 2)
Show date/time of first/last selected dive instead of displayed_dive.
Thats more useful to identify the right time offset for the images.
Trigger first update of image info already in constructor of the dialog.
Update the results and UI also when the "backwards" radio button is changed.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'desktop-widgets/simplewidgets.cpp')
-rw-r--r-- | desktop-widgets/simplewidgets.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index 8caa1b9dd..8d3b94e8f 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -355,8 +355,11 @@ ShiftImageTimesDialog::ShiftImageTimesDialog(QWidget *parent, QStringList fileNa connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *))); connect(ui.syncCamera, SIGNAL(clicked()), this, SLOT(syncCameraClicked())); connect(ui.timeEdit, SIGNAL(timeChanged(const QTime &)), this, SLOT(timeEditChanged(const QTime &))); + connect(ui.backwards, SIGNAL(toggled(bool)), this, SLOT(timeEditChanged())); connect(ui.matchAllImages, SIGNAL(toggled(bool)), this, SLOT(matchAllImagesToggled(bool))); dcImageEpoch = (time_t)0; + + updateInvalid(); } time_t ShiftImageTimesDialog::amount() const @@ -381,9 +384,15 @@ void ShiftImageTimesDialog::updateInvalid() bool allValid = true; ui.warningLabel->hide(); ui.invalidFilesText->hide(); - QDateTime time = QDateTime::fromTime_t(displayed_dive.when, Qt::UTC); - ui.invalidFilesText->setPlainText(tr("Dive date/time") + ": " + time.toString() + "\n"); - ui.invalidFilesText->append(tr("Files with inappropriate date/time") + ":"); + QDateTime time_first = QDateTime::fromTime_t(first_selected_dive()->when, Qt::UTC); + QDateTime time_last = QDateTime::fromTime_t(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 { + ui.invalidFilesText->setPlainText(tr("First selected dive date/time") + ": " + time_first.toString()); + ui.invalidFilesText->append(tr("Last selected dive date/time") + ": " + time_last.toString()); + } + ui.invalidFilesText->append(tr("\nFiles with inappropriate date/time") + ":"); Q_FOREACH (const QString &fileName, fileNames) { if (picture_check_valid(fileName.toUtf8().data(), m_amount)) @@ -391,8 +400,8 @@ void ShiftImageTimesDialog::updateInvalid() // We've found invalid image timestamp = picture_get_timestamp(fileName.toUtf8().data()); - time.setTime_t(timestamp + m_amount); - ui.invalidFilesText->append(fileName + " " + time.toString()); + time_first.setTime_t(timestamp + m_amount); + ui.invalidFilesText->append(fileName + " " + time_first.toString()); allValid = false; } @@ -410,6 +419,13 @@ void ShiftImageTimesDialog::timeEditChanged(const QTime &time) updateInvalid(); } +void ShiftImageTimesDialog::timeEditChanged() +{ + if (m_amount > 0 == ui.backwards->isChecked()) + m_amount *= -1; + if (m_amount) updateInvalid(); +} + URLDialog::URLDialog(QWidget *parent) : QDialog(parent) { ui.setupUi(this); |