Properly handle the planner state

This does two independent things:

It sets the planner state early enough so the appropriate
default profile for the planner is created (without
safety stop).

Upon cancelling the planner, it resets the profile widget
to profile more (rather than planner) as otherwise upon
the next change into the planner the planner model is
not properly initialized.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2023-09-10 19:24:57 +02:00
parent 83e7f537fb
commit 81f35c1ecf
3 changed files with 3 additions and 1 deletions

View file

@ -568,6 +568,7 @@ divemode_t PlannerWidgets::getRebreatherMode() const
void PlannerWidgets::preparePlanDive(const dive *currentDive) void PlannerWidgets::preparePlanDive(const dive *currentDive)
{ {
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
// create a simple starting dive, using the first gas from the just copied cylinders // create a simple starting dive, using the first gas from the just copied cylinders
DivePlannerPointsModel::instance()->createSimpleDive(planned_dive.get()); DivePlannerPointsModel::instance()->createSimpleDive(planned_dive.get());

View file

@ -581,7 +581,7 @@ void MainWindow::enableShortcuts()
void MainWindow::showProfile() void MainWindow::showProfile()
{ {
enableShortcuts(); enableShortcuts();
profile->plotCurrentDive(); profile->plotDive(current_dive, profile->dc);
setApplicationState(ApplicationState::Default); setApplicationState(ApplicationState::Default);
} }

View file

@ -393,6 +393,7 @@ static void hideAll(const T &container)
void ProfileWidget2::clear() void ProfileWidget2::clear()
{ {
currentState = INIT;
#ifndef SUBSURFACE_MOBILE #ifndef SUBSURFACE_MOBILE
clearPictures(); clearPictures();
#endif #endif