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>
This commit is contained in:
Robert C. Helling 2014-11-25 21:22:02 +01:00 committed by Dirk Hohndel
parent 584775cbc0
commit 96a94f1a19
4 changed files with 180 additions and 0 deletions

View file

@ -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());