aboutsummaryrefslogtreecommitdiffstats
path: root/profile-widget
diff options
context:
space:
mode:
Diffstat (limited to 'profile-widget')
-rw-r--r--profile-widget/profilewidget2.cpp17
-rw-r--r--profile-widget/profilewidget2.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index bf8649834..1e1599937 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -21,6 +21,7 @@
#include "desktop-widgets/diveplanner.h"
#include "desktop-widgets/simplewidgets.h"
#include "desktop-widgets/divepicturewidget.h"
+#include "desktop-widgets/mainwindow.h"
#include "core/qthelper.h"
#include "core/gettextfromc.h"
#endif
@@ -1427,6 +1428,8 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
setpointAction->setData(event->globalPos());
QAction *action = m.addAction(tr("Add bookmark"), this, SLOT(addBookmark()));
action->setData(event->globalPos());
+ QAction *splitAction = m.addAction(tr("Split dive into two"), this, SLOT(splitDive()));
+ splitAction->setData(event->globalPos());
struct event *ev = NULL;
enum divemode_t divemode = UNDEF_COMP_TYPE;
QPointF scenePos = mapToScene(mapFromGlobal(event->globalPos()));
@@ -1640,6 +1643,20 @@ void ProfileWidget2::addSetpointChange()
SetpointDialog::instance()->show();
}
+void ProfileWidget2::splitDive()
+{
+ QAction *action = qobject_cast<QAction *>(sender());
+ QPointF scenePos = mapToScene(mapFromGlobal(action->data().toPoint()));
+ duration_t time;
+ time.seconds = lrint(timeAxis->valueAt((scenePos)));
+ split_dive_at_time(&displayed_dive, time);
+ emit updateDiveInfo(false);
+ mark_divelist_changed(true);
+ replot();
+ MainWindow::instance()->refreshProfile();
+ MainWindow::instance()->refreshDisplay();
+}
+
void ProfileWidget2::changeGas()
{
QAction *action = qobject_cast<QAction *>(sender());
diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h
index 1d85a125c..7c01a8139 100644
--- a/profile-widget/profilewidget2.h
+++ b/profile-widget/profilewidget2.h
@@ -115,6 +115,7 @@ slots: // Necessary to call from QAction's signals.
void setAddState();
void changeGas();
void addSetpointChange();
+ void splitDive();
void addBookmark();
void addDivemodeSwitch();
void hideEvents();