From 337d9318ad37e2917672897f2625f78ebe049657 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 27 Feb 2021 19:42:42 +0100 Subject: planner: split addStop() into external and internal versions The DivePlannerPointsModel::addStop() function is called by the profile to add a planner-stop. It is also used internally to create profiles. If we ever want to include this in the undo system, we have to split these into to versions. One will ultimately place an undo command and update the profile, the other one doesn't. For now, this makes the external interface simpler, as some parameters are redundant. Signed-off-by: Berthold Stoeger --- qt-models/diveplannermodel.cpp | 5 +++++ qt-models/diveplannermodel.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'qt-models') diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index 51e3a1101..56d22bd15 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -750,6 +750,11 @@ void DivePlannerPointsModel::addDefaultStop() addStop(0, 0, -1, 0, true, UNDEF_COMP_TYPE); } +void DivePlannerPointsModel::addStop(int milimeters, int seconds) +{ + addStop(milimeters, seconds, -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 17e1fb75e..0b13f7247 100644 --- a/qt-models/diveplannermodel.h +++ b/qt-models/diveplannermodel.h @@ -61,7 +61,7 @@ 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); + void addStop(int millimeters, int seconds); public slots: void addDefaultStop(); @@ -117,6 +117,7 @@ signals: private: explicit DivePlannerPointsModel(QObject *parent = 0); void clear(); + int addStop(int millimeters, int seconds, int cylinderid_in, int ccpoint, bool entered, enum divemode_t); void setupStartTime(); void setupCylinders(); int lastEnteredPoint() const; -- cgit v1.2.3-70-g09d2