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>
This commit is contained in:
Linus Torvalds 2015-10-01 21:17:37 -04:00 committed by Dirk Hohndel
parent b5b7bdda81
commit 7c427dcc02
4 changed files with 165 additions and 0 deletions

View file

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