diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-01-25 21:45:29 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-04-02 13:53:23 -0700 |
commit | e419ebf55a28d2483951e52ca274aedd96f11789 (patch) | |
tree | 32d5168bdaa00cde2216842f62c005fa21779db5 /qt-models | |
parent | 02ef58a48bfa9042e034e83cb128ae6b7f83628e (diff) | |
download | subsurface-e419ebf55a28d2483951e52ca274aedd96f11789.tar.gz |
planner: move clearing of model into loadFromDive() function
Both loadFromDive() callers were clearing the model before
calling loadFromDive(). Move the clearing into that function
since it makes no sense to load into a non-cleared model.
Apparently this changes the way that no-cylinder dives are
treated and the code in ProfileWidget2::repositionDiveHandlers()
must now explicitly check for that condition.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/diveplannermodel.cpp | 5 | ||||
-rw-r--r-- | qt-models/diveplannermodel.h | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index bb52a1061..e0c0e2d69 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -106,9 +106,10 @@ void DivePlannerPointsModel::loadFromDive(dive *d) duration_t lasttime = { 0 }; duration_t lastrecordedtime = {}; duration_t newtime = {}; + + clear(); free_dps(&diveplan); - if (mode != PLAN) - clear(); + diveplan.when = d->when; // is this a "new" dive where we marked manually entered samples? // if yes then the first sample should be marked diff --git a/qt-models/diveplannermodel.h b/qt-models/diveplannermodel.h index 52c01dd36..8cc12c5c8 100644 --- a/qt-models/diveplannermodel.h +++ b/qt-models/diveplannermodel.h @@ -40,7 +40,6 @@ public: void setPlanMode(Mode mode); bool isPlanner() const; void createSimpleDive(); - void clear(); Mode currentMode() const; bool setRecalc(bool recalc); bool recalcQ() const; @@ -119,6 +118,7 @@ signals: private: explicit DivePlannerPointsModel(QObject *parent = 0); + void clear(); void setupStartTime(); void setupCylinders(); int lastEnteredPoint() const; |