aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-09-20 07:14:25 -0500
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-09-20 07:17:35 -0500
commite04acd4189d4b5307016d3acd1de947c094fcb11 (patch)
tree0e6072d6b70e33366277eaf826f63c4804b9054a /qt-ui/maintab.cpp
parent46c23c53a12485e3e59e8d52bf9ba6943bdfc200 (diff)
downloadsubsurface-e04acd4189d4b5307016d3acd1de947c094fcb11.tar.gz
Simplistic solution to add dive number to dive added
If this is the last dive and if the previous dive had a number, give this dive the next number. Of course there are a couple of issues with the current implementation. We have no way of changing the date / time of the added dive, so we KNOW that it will be the last one. But I put that check there so that once we add the ability to change the date / time (and hopefully remember to then move the dive to the correct spot in the dive_table), we only assign a number if it is the last dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index d35fefcf9..81ae8f364 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -398,6 +398,8 @@ void MainTab::acceptChanges()
if (editMode == ADD) {
// clean up the dive data (get duration, depth information from samples)
fixup_dive(current_dive);
+ if (current_dive == get_dive(dive_table.nr - 1) && get_dive(dive_table.nr - 2)->number)
+ current_dive->number = get_dive(dive_table.nr - 2)->number + 1;
DivePlannerPointsModel::instance()->cancelPlan();
mainWindow()->showProfile();
mainWindow()->refreshDisplay();