planner: move repopulation of models to planner

The gas and dive-type models were repopulated in the
diveplanner model. The former are used in the planner.
However, the latter is also used outside of the planner,
when editing non-planned dives. Thus the former shouldn't
be repopulated by the latter, but by the code that needs
it.

Side note: repopulating the dive-type model seems to
make no sense whatsoever since the values never change,
but let's keep it for now.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-11-07 18:45:30 +01:00 committed by bstoeger
parent d51589b9a7
commit 3dd09b31e3
3 changed files with 5 additions and 5 deletions

View file

@ -560,6 +560,8 @@ void PlannerWidgets::planDive(dive *currentDive)
else // No salinity means salt water
plannerWidget.setSalinity(SEAWATER_SALINITY);
}
GasSelectionModel::instance()->repopulate();
DiveTypeSelectionModel::instance()->repopulate();
plannerWidget.setReplanButton(false);
plannerWidget.setupStartTime(timestampToDateTime(displayed_dive.when)); // This will reload the profile!
@ -570,6 +572,7 @@ void PlannerWidgets::replanDive(int currentDC)
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
DivePlannerPointsModel::instance()->loadFromDive(&displayed_dive, currentDC);
DiveTypeSelectionModel::instance()->repopulate();
plannerWidget.setReplanButton(true);
plannerWidget.setupStartTime(timestampToDateTime(displayed_dive.when));
if (displayed_dive.surface_pressure.mbar)