diff options
author | Robert C. Helling <helling@atdotde.de> | 2014-11-25 21:22:02 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-12-01 14:19:03 -0800 |
commit | 96a94f1a19d22fa0432e10495315ce3e98b35c4f (patch) | |
tree | 120471db57a8b0bdad99b2bab32390b6adc8f3e3 /qt-ui/simplewidgets.cpp | |
parent | 584775cbc053d8b471f5a5d3ea232857f056e628 (diff) | |
download | subsurface-96a94f1a19d22fa0432e10495315ce3e98b35c4f.tar.gz |
A widget to add a set-point change
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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()); |