mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile/planner: don't update dive in ProfileWidget2::plotDive()
In planner or profile-edit mode, the plotDive() function takes the current plan and turns it into a dive profile. Not only is this a layering violation (the display layer modifying the dive), it is also fundamentally flawed. The control-flow is out of control, if you wish. There are numerous reasons why the profile needs to be replot, many of which do not need a recalculated dive profile. Move the code that updates the dive-profile to the DivePlannerPointsModel. Thus, the profile recalculations and replots can be pooled. This will break the planner, since there now might be missing calls to the profile recalculation. But it already has some positive effects: when removing multiple points, the profile is only recalculated once. This will need much more work, but it is a start. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
337d9318ad
commit
77a6bc6d62
3 changed files with 24 additions and 14 deletions
|
@ -89,8 +89,6 @@ slots:
|
|||
void remove(const QModelIndex &index);
|
||||
void cancelPlan();
|
||||
void removeDeco();
|
||||
void createTemporaryPlan();
|
||||
void recalcTemporaryPlan(); // Writes the plan into the dive.
|
||||
void deleteTemporaryPlan();
|
||||
void emitDataChanged();
|
||||
void setRebreatherMode(int mode);
|
||||
|
@ -123,6 +121,8 @@ private:
|
|||
int lastEnteredPoint() const;
|
||||
bool updateMaxDepth();
|
||||
void createPlan(bool replanCopy);
|
||||
void updateDiveProfile(); // Creates a temporary plan and updates the dive profile with it.
|
||||
void createTemporaryPlan();
|
||||
struct diveplan diveplan;
|
||||
struct divedatapoint *cloneDiveplan(struct diveplan *plan_src, struct diveplan *plan_copy);
|
||||
void computeVariationsDone(QString text);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue