diff options
-rw-r--r-- | dive.c | 4 | ||||
-rw-r--r-- | dive.h | 2 | ||||
-rw-r--r-- | qt-ui/divelistview.cpp | 2 | ||||
-rw-r--r-- | qt-ui/shiftimagetimes.ui | 7 | ||||
-rw-r--r-- | qt-ui/simplewidgets.cpp | 11 | ||||
-rw-r--r-- | qt-ui/simplewidgets.h | 3 |
6 files changed, 25 insertions, 4 deletions
@@ -2989,12 +2989,12 @@ bool picture_check_valid(char *filename, int shift_time) return false; } -void dive_create_picture(struct dive *dive, char *filename, int shift_time) +void dive_create_picture(struct dive *dive, char *filename, int shift_time, bool match_all) { timestamp_t timestamp = picture_get_timestamp(filename); if (!new_picture_for_dive(dive, filename)) return; - if (!dive_check_picture_time(dive, shift_time, timestamp)) + if (!match_all && !dive_check_picture_time(dive, shift_time, timestamp)) return; struct picture *picture = alloc_picture(); @@ -377,7 +377,7 @@ struct picture { extern struct picture *alloc_picture(); extern bool dive_check_picture_time(struct dive *d, int shift_time, timestamp_t timestamp); -extern void dive_create_picture(struct dive *d, char *filename, int shift_time); +extern void dive_create_picture(struct dive *d, char *filename, int shift_time, bool match_all); extern void dive_add_picture(struct dive *d, struct picture *newpic); extern void dive_remove_picture(char *filename); extern unsigned int dive_get_picture_count(struct dive *d); diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index c25bb17cb..2ee5f5dcd 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -925,7 +925,7 @@ void DiveListView::matchImagesToDives(QStringList fileNames) for_each_dive (j, dive) { if (!dive->selected) continue; - dive_create_picture(dive, copy_string(fileName.toUtf8().data()), shiftDialog.amount()); + dive_create_picture(dive, copy_string(fileName.toUtf8().data()), shiftDialog.amount(), shiftDialog.matchAll()); } } diff --git a/qt-ui/shiftimagetimes.ui b/qt-ui/shiftimagetimes.ui index 56a222856..0478a62b4 100644 --- a/qt-ui/shiftimagetimes.ui +++ b/qt-ui/shiftimagetimes.ui @@ -132,6 +132,13 @@ Not all images have timestamps in the range between </widget> </item> <item> + <widget class="QCheckBox" name="matchAllImages"> + <property name="text"> + <string>Load images even if the time does not match the dive time</string> + </property> + </widget> + </item> + <item> <widget class="QLabel" name="invalidLabel"> <property name="styleSheet"> <string notr="true">color: red; </string> diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index 99b4b2be8..7e8bc40e4 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -312,12 +312,23 @@ void ShiftImageTimesDialog::dcDateTimeChanged(const QDateTime &newDateTime) setOffset(newDateTime.toTime_t() - dcImageEpoch); } +void ShiftImageTimesDialog::matchAllImagesToggled(bool state) +{ + matchAllImages = state; +} + +bool ShiftImageTimesDialog::matchAll() +{ + return matchAllImages; +} + ShiftImageTimesDialog::ShiftImageTimesDialog(QWidget *parent, QStringList fileNames) : QDialog(parent), fileNames(fileNames), m_amount(0) { 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 &))); + connect(ui.matchAllImages, SIGNAL(toggled(bool)), this, SLOT(matchAllImagesToggled(bool))); dcImageEpoch = (time_t)0; } diff --git a/qt-ui/simplewidgets.h b/qt-ui/simplewidgets.h index 17f628392..595c4cd4b 100644 --- a/qt-ui/simplewidgets.h +++ b/qt-ui/simplewidgets.h @@ -101,6 +101,7 @@ public: explicit ShiftImageTimesDialog(QWidget *parent, QStringList fileNames); time_t amount() const; void setOffset(time_t offset); + bool matchAll(); private slots: void buttonClicked(QAbstractButton *button); @@ -108,12 +109,14 @@ slots: void dcDateTimeChanged(const QDateTime &); void timeEditChanged(const QTime &time); void updateInvalid(); + void matchAllImagesToggled(bool); private: QStringList fileNames; Ui::ShiftImageTimesDialog ui; time_t m_amount; time_t dcImageEpoch; + bool matchAllImages; }; class URLDialog : public QDialog { |