summaryrefslogtreecommitdiffstats
path: root/qt-models/diveplannermodel.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-02-27 22:34:08 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-04-02 13:53:23 -0700
commitf0f3b4a13c59f7886ae41de85929831fa100b5bb (patch)
tree06c86936f94b9615b13de04c4d7913e8f92f6792 /qt-models/diveplannermodel.cpp
parentc7dcd7fbf0173fb665e5b9c348e0ead7f969e827 (diff)
downloadsubsurface-f0f3b4a13c59f7886ae41de85929831fa100b5bb.tar.gz
planner: call removeDeco() explicitly
removeDeco() was called by addStop() if the recalc flag was set. If the caller didn't want to call removeDeco() it had to clear and restore the flag. Instead, call removeDeco() explicitly when needed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/diveplannermodel.cpp')
-rw-r--r--qt-models/diveplannermodel.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp
index 082b5d5d4..b51e45a05 100644
--- a/qt-models/diveplannermodel.cpp
+++ b/qt-models/diveplannermodel.cpp
@@ -61,6 +61,7 @@ void DivePlannerPointsModel::createSimpleDive(struct dive *dIn)
d->dc.model = strdup("planned dive"); // don't translate! this is stored in the XML file
clear();
+ removeDeco();
setupCylinders();
setupStartTime();
@@ -119,6 +120,7 @@ void DivePlannerPointsModel::loadFromDive(dive *dIn)
duration_t newtime = {};
clear();
+ removeDeco();
free_dps(&diveplan);
diveplan.when = d->when;
@@ -748,11 +750,13 @@ int DivePlannerPointsModel::lastEnteredPoint() const
void DivePlannerPointsModel::addDefaultStop()
{
+ removeDeco();
addStop(0, 0, -1, 0, true, UNDEF_COMP_TYPE);
}
void DivePlannerPointsModel::addStop(int milimeters, int seconds)
{
+ removeDeco();
addStop(milimeters, seconds, -1, 0, true, UNDEF_COMP_TYPE);
updateDiveProfile();
}
@@ -767,8 +771,6 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, int cylinderid_
cylinderid = cylinderid_in;
else
usePrevious = true;
- if (recalc)
- removeDeco();
int row = divepoints.count();
if (seconds == 0 && milimeters == 0 && row != 0) {