aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-23 11:41:42 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-04-02 13:53:23 -0700
commitd68c3d8ab5353ed736249d705e7683dc8f5d6062 (patch)
tree890a5b800e37d52c7c0669de09f72be42285c72c /qt-models
parent5196ea6149a3c98a7c4e2db9aad8944fec825928 (diff)
downloadsubsurface-d68c3d8ab5353ed736249d705e7683dc8f5d6062.tar.gz
cleanup: add DivePlannerPointsModel::addDefaultStop() function
When clicking on "+" in the planner, a default stop point was added using a signal/slot connection. This used the archaic string-based connect syntax, because it was realized with default parameters passed to "addStop()". Instead, add a "addDefaultStop()" slot, which passes the default parameters. Since all other callers do not use callbacks, unslotify "addStop()". The slot was the only user of the default parameters, so they can be removed alltogether. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/diveplannermodel.cpp5
-rw-r--r--qt-models/diveplannermodel.h3
2 files changed, 7 insertions, 1 deletions
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp
index 945118b54..a7be4b975 100644
--- a/qt-models/diveplannermodel.cpp
+++ b/qt-models/diveplannermodel.cpp
@@ -750,6 +750,11 @@ int DivePlannerPointsModel::lastEnteredPoint() const
return -1;
}
+void DivePlannerPointsModel::addDefaultStop()
+{
+ addStop(0, 0, -1, 0, true, UNDEF_COMP_TYPE);
+}
+
// cylinderid_in == -1 means same gas as before.
// divemode == UNDEF_COMP_TYPE means determine from previous point.
int DivePlannerPointsModel::addStop(int milimeters, int seconds, int cylinderid_in, int ccpoint, bool entered, enum divemode_t divemode)
diff --git a/qt-models/diveplannermodel.h b/qt-models/diveplannermodel.h
index 978ce818d..52c01dd36 100644
--- a/qt-models/diveplannermodel.h
+++ b/qt-models/diveplannermodel.h
@@ -66,9 +66,10 @@ public:
struct deco_state final_deco_state;
void loadFromDive(dive *d);
+ int addStop(int millimeters, int seconds, int cylinderid_in, int ccpoint, bool entered, enum divemode_t);
public
slots:
- int addStop(int millimeters = 0, int seconds = 0, int cylinderid_in = -1, int ccpoint = 0, bool entered = true, enum divemode_t = UNDEF_COMP_TYPE);
+ void addDefaultStop();
void addCylinder_clicked();
void setGFHigh(const int gfhigh);
void setGFLow(const int gflow);