summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/profile/profilewidget2.cpp10
-rw-r--r--qt-ui/profile/profilewidget2.h1
-rw-r--r--qt-ui/simplewidgets.cpp7
3 files changed, 17 insertions, 1 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index e1892b2fa..347cc1bf8 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -1128,6 +1128,8 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
gasChange->addAction(action);
}
}
+ QAction *setpointAction = m.addAction(tr("Add set-point change"), this, SLOT(addSetpointChange()));
+ setpointAction->setData(event->globalPos());
QAction *action = m.addAction(tr("Add bookmark"), this, SLOT(addBookmark()));
action->setData(event->globalPos());
if (DiveEventItem *item = dynamic_cast<DiveEventItem *>(sceneItem)) {
@@ -1282,6 +1284,14 @@ void ProfileWidget2::addBookmark()
replot();
}
+void ProfileWidget2::addSetpointChange()
+{
+ QAction *action = qobject_cast<QAction *>(sender());
+ QPointF scenePos = mapToScene(mapFromGlobal(action->data().toPoint()));
+ SetpointDialog::instance()->setpointData(current_dc, timeAxis->valueAt(scenePos));
+ SetpointDialog::instance()->show();
+}
+
void ProfileWidget2::changeGas()
{
QAction *action = qobject_cast<QAction *>(sender());
diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h
index 4c7951533..a1f216e48 100644
--- a/qt-ui/profile/profilewidget2.h
+++ b/qt-ui/profile/profilewidget2.h
@@ -92,6 +92,7 @@ slots: // Necessary to call from QAction's signals.
void setPlanState();
void setAddState();
void changeGas();
+ void addSetpointChange();
void addBookmark();
void hideEvents();
void unhideEvents();
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index 6ab4566fd..91d003dc9 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -172,13 +172,18 @@ void SetpointDialog::setpointData(struct divecomputer *divecomputer, int second)
{
dc = divecomputer;
time = second;
+ qDebug() << second << time;
}
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");
+ qDebug() << time << (int)(1000.0 * ui.spinbox->value());
+ add_event(dc, time, SAMPLE_EVENT_PO2, 0, (int)(1000.0 * ui.spinbox->value()), "SP change");
}
+ mark_divelist_changed(true);
+ MainWindow::instance()->graphics()->replot();
+
}
SetpointDialog::SetpointDialog(QWidget *parent) : QDialog(parent)