diff options
Diffstat (limited to 'qt-ui/simplewidgets.cpp')
-rw-r--r-- | qt-ui/simplewidgets.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index da8a7d014..6ab4566fd 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -18,6 +18,8 @@ #include "mainwindow.h" #include "helpers.h" #include "ui_filterwidget.h" +#include "libdivecomputer/parser.h" + class MinMaxAvgWidgetPrivate { public: @@ -160,6 +162,35 @@ RenumberDialog::RenumberDialog(QWidget *parent) : QDialog(parent), selectedOnly( connect(quit, SIGNAL(activated()), parent, SLOT(close())); } +SetpointDialog *SetpointDialog::instance() +{ + static SetpointDialog *self = new SetpointDialog(MainWindow::instance()); + return self; +} + +void SetpointDialog::setpointData(struct divecomputer *divecomputer, int second) +{ + dc = divecomputer; + time = second; +} + +void SetpointDialog::buttonClicked(QAbstractButton *button) +{ + if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) { + add_event(dc, time, SAMPLE_EVENT_PO2, 0, ui.spinbox->value(), "SP change"); + } +} + +SetpointDialog::SetpointDialog(QWidget *parent) : QDialog(parent) +{ + ui.setupUi(this); + connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *))); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + connect(close, SIGNAL(activated()), this, SLOT(close())); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + connect(quit, SIGNAL(activated()), parent, SLOT(close())); +} + ShiftTimesDialog *ShiftTimesDialog::instance() { static ShiftTimesDialog *self = new ShiftTimesDialog(MainWindow::instance()); |