diff options
-rw-r--r-- | qt-ui/divelistview.cpp | 6 | ||||
-rw-r--r-- | qt-ui/simplewidgets.cpp | 16 | ||||
-rw-r--r-- | qt-ui/simplewidgets.h | 6 |
3 files changed, 14 insertions, 14 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 1b19d06fd..50d3a8bf3 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -813,8 +813,8 @@ void DiveListView::loadImages() updateLastUsedImageDir(QFileInfo(fileNames[0]).dir().path()); - ShiftImageTimesDialog* shiftDialog = ShiftImageTimesDialog::instance(); - shiftDialog->exec(); + ShiftImageTimesDialog shiftDialog(this); + shiftDialog.exec(); for (int i = 0; i < fileNames.size(); ++i) { struct tm tm; @@ -829,7 +829,7 @@ void DiveListView::loadImages() tm.tm_hour = hour; tm.tm_min = min; tm.tm_sec = sec; - imagetime = utc_mktime(&tm) + shiftDialog->amount; + imagetime = utc_mktime(&tm) + shiftDialog.amount(); int j = 0; struct dive *dive; for_each_dive(j, dive){ diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index c76921c32..d69425ef9 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -156,27 +156,27 @@ ShiftTimesDialog::ShiftTimesDialog(QWidget *parent): QDialog(parent) ui.setupUi(this); connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*))); } -ShiftImageTimesDialog* ShiftImageTimesDialog::instance() -{ - static ShiftImageTimesDialog* self = new ShiftImageTimesDialog(mainWindow()); - return self; -} void ShiftImageTimesDialog::buttonClicked(QAbstractButton* button) { if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) { - amount = ui.timeEdit->time().hour() * 3600 + ui.timeEdit->time().minute() * 60; + m_amount = ui.timeEdit->time().hour() * 3600 + ui.timeEdit->time().minute() * 60; if (ui.backwards->isChecked()) - amount *= -1; + m_amount *= -1; } } -ShiftImageTimesDialog::ShiftImageTimesDialog(QWidget *parent): QDialog(parent) +ShiftImageTimesDialog::ShiftImageTimesDialog(QWidget *parent): QDialog(parent), m_amount(0) { ui.setupUi(this); connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*))); } +int ShiftImageTimesDialog::amount() const +{ + return m_amount; +} + bool isGnome3Session() { #if defined(QT_OS_WIW) || defined(QT_OS_MAC) diff --git a/qt-ui/simplewidgets.h b/qt-ui/simplewidgets.h index b8097b55a..d17bac016 100644 --- a/qt-ui/simplewidgets.h +++ b/qt-ui/simplewidgets.h @@ -58,13 +58,13 @@ private: class ShiftImageTimesDialog : public QDialog { Q_OBJECT public: - static ShiftImageTimesDialog *instance(); - int amount; + explicit ShiftImageTimesDialog(QWidget *parent); + int amount() const; private slots: void buttonClicked(QAbstractButton *button); private: - explicit ShiftImageTimesDialog(QWidget *parent); Ui::ShiftImageTimesDialog ui; + int m_amount; }; bool isGnome3Session(); |