summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2015-10-01 21:17:37 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-01 22:29:43 -0400
commit7c427dcc020064e0ea867c77ee86db6e1f4755bb (patch)
treea27def977fcbad963d41e0e88dba42c4fb7cad34 /qt-ui
parentb5b7bdda81acd0ee8c14a081f8bfd38d9809cec8 (diff)
downloadsubsurface-7c427dcc020064e0ea867c77ee86db6e1f4755bb.tar.gz
Add support to "split" a dive with surface time in the middle
Right now this requires that (a) the dive have only one divecomputer associated with it. Trying to split a dive with multiple dive computers would be *much* harder to do, since you'd have to try to line up the surface interval between computers etc. So just don't do it after downloading multiple dive computers for the same dive. (b) there must be at least one minute between the sample that came up to the surface and the sample that goes down again. If you just peeked your head above the surface, don't try to split things into two dives. Maybe we can relax this for freediving or something. also note that the split dive will only get new numbering if the dive that was split was the very last dive in the divelist. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/divelistview.cpp14
-rw-r--r--qt-ui/divelistview.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index 90d0b4627..51720a317 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -616,6 +616,19 @@ void DiveListView::mergeDives()
MainWindow::instance()->refreshDisplay();
}
+void DiveListView::splitDives()
+{
+ int i;
+ struct dive *dive;
+
+ for_each_dive (i, dive) {
+ if (dive->selected)
+ split_dive(dive);
+ }
+ MainWindow::instance()->refreshProfile();
+ MainWindow::instance()->refreshDisplay();
+}
+
void DiveListView::renumberDives()
{
RenumberDialog::instance()->renumberOnlySelected();
@@ -882,6 +895,7 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event)
if (amount_selected >= 1) {
popup.addAction(tr("Renumber dive(s)"), this, SLOT(renumberDives()));
popup.addAction(tr("Shift dive times"), this, SLOT(shiftTimes()));
+ popup.addAction(tr("Split selected dives"), this, SLOT(splitDives()));
popup.addAction(tr("Load image(s) from file(s)"), this, SLOT(loadImages()));
popup.addAction(tr("Load image(s) from web"), this, SLOT(loadWebImages()));
}
diff --git a/qt-ui/divelistview.h b/qt-ui/divelistview.h
index 42802b6ea..aaec37af5 100644
--- a/qt-ui/divelistview.h
+++ b/qt-ui/divelistview.h
@@ -49,6 +49,7 @@ slots:
void addToTripAbove();
void addToTripBelow();
void mergeDives();
+ void splitDives();
void renumberDives();
void shiftTimes();
void loadImages();