diff options
Diffstat (limited to 'qt-ui/simplewidgets.cpp')
-rw-r--r-- | qt-ui/simplewidgets.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index f1cf8906d..bbe7b1b37 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -13,6 +13,7 @@ #include <QDebug> #include "../dive.h" +#include "mainwindow.h" class MinMaxAvgWidgetPrivate{ public: @@ -119,6 +120,32 @@ RenumberDialog::RenumberDialog(): QDialog() connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*))); } +ShiftTimesDialog* ShiftTimesDialog::instance() +{ + static ShiftTimesDialog* self = new ShiftTimesDialog(); + return self; +} + +void ShiftTimesDialog::buttonClicked(QAbstractButton* button) +{ + int amount; + + if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole){ + amount = ui.timeEdit->time().hour() * 3600 + ui.timeEdit->time().minute() * 60; + if (ui.backwards->isChecked()) + amount *= -1; + + shift_times(amount); + mainWindow()->refreshDisplay(); + } +} + +ShiftTimesDialog::ShiftTimesDialog(): QDialog() +{ + ui.setupUi(this); + connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*))); +} + bool isGnome3Session() { #if defined(QT_OS_WIW) || defined(QT_OS_MAC) |