diff options
author | Jan Darowski <jan.darowski@gmail.com> | 2015-03-14 17:44:24 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-03-15 15:47:37 -0700 |
commit | 0d77b921eb11a2a013555078569c766e4d36a84f (patch) | |
tree | f9d45cc160b7bf653ad6024937e8b5adae7f5703 /qt-ui/simplewidgets.cpp | |
parent | 7d37a3f5a65d03df917e63614a76fb95e8bc966f (diff) | |
download | subsurface-0d77b921eb11a2a013555078569c766e4d36a84f.tar.gz |
Added warning when not all images can be added.
Added label in the ShiftImageTimesDialog which appears when
not all of the selected images have timestamp in the checked range.
Made cancel button in this widget actually work.
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/simplewidgets.cpp')
-rw-r--r-- | qt-ui/simplewidgets.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index 8a0f2b090..58959c1f0 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -303,11 +303,12 @@ void ShiftImageTimesDialog::dcDateTimeChanged(const QDateTime &newDateTime) setOffset(newDateTime.toTime_t() - dcImageEpoch); } -ShiftImageTimesDialog::ShiftImageTimesDialog(QWidget *parent) : QDialog(parent), m_amount(0) +ShiftImageTimesDialog::ShiftImageTimesDialog(QWidget *parent, QStringList fileNames) : QDialog(parent), m_amount(0), fileNames(fileNames) { ui.setupUi(this); 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 &))); dcImageEpoch = (time_t)0; } @@ -327,6 +328,41 @@ void ShiftImageTimesDialog::setOffset(time_t offset) ui.timeEdit->setTime(QTime(offset / 3600, (offset % 3600) / 60, offset % 60)); } +void ShiftImageTimesDialog::updateInvalid() +{ + timestamp_t timestamp; + QDateTime time; + bool allValid = true; + ui.warningLabel->hide(); + ui.invalidLabel->hide(); + ui.invalidLabel->clear(); + + Q_FOREACH (const QString &fileName, fileNames) { + if (picture_check_valid(fileName.toUtf8().data(), m_amount)) + continue; + + // We've found invalid image + picture_get_timestamp(fileName.toUtf8().data(), ×tamp); + dcImageEpoch = timestamp; + time.setTime_t(timestamp + m_amount); + ui.invalidLabel->setText(ui.invalidLabel->text() + fileName + " " + time.toString() + "\n"); + allValid = false; + } + + if (!allValid){ + ui.warningLabel->show(); + ui.invalidLabel->show(); + } +} + +void ShiftImageTimesDialog::timeEditChanged(const QTime &time) +{ + m_amount = time.hour() * 3600 + time.minute() * 60; + if (ui.backwards->isChecked()) + m_amount *= -1; + updateInvalid(); +} + bool isGnome3Session() { #if defined(QT_OS_WIW) || defined(QT_OS_MAC) |