planner: set profile to planner state in main window

Remove mainwindow-access from the planner, by setting
the profile to planner state in the owner of the profile,
viz. the MainWindow.

The MainWindow sets the application state to planner, so
it seems legit that it also sets the profile state.

This removes a further interdependency.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-02-12 11:36:24 +01:00 committed by Dirk Hohndel
parent 4d60662531
commit b4c307c775
2 changed files with 2 additions and 4 deletions

View file

@ -540,8 +540,6 @@ PlannerWidgets::PlannerWidgets()
void PlannerWidgets::planDive() void PlannerWidgets::planDive()
{ {
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN); DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
MainWindow::instance()->graphics->setPlanState(&displayed_dive, 0);
dc_number = 0; dc_number = 0;
// 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
@ -569,8 +567,6 @@ void PlannerWidgets::replanDive()
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN); DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
DivePlannerPointsModel::instance()->loadFromDive(&displayed_dive); DivePlannerPointsModel::instance()->loadFromDive(&displayed_dive);
MainWindow::instance()->graphics->setPlanState(&displayed_dive, 0);
plannerWidget.setReplanButton(true); plannerWidget.setReplanButton(true);
plannerWidget.setupStartTime(timestampToDateTime(displayed_dive.when)); plannerWidget.setupStartTime(timestampToDateTime(displayed_dive.when));
if (displayed_dive.surface_pressure.mbar) if (displayed_dive.surface_pressure.mbar)

View file

@ -771,6 +771,7 @@ void MainWindow::on_actionReplanDive_triggered()
// put us in PLAN mode // put us in PLAN mode
setApplicationState(ApplicationState::PlanDive); setApplicationState(ApplicationState::PlanDive);
graphics->setPlanState(&displayed_dive, 0);
plannerWidgets->replanDive(); plannerWidgets->replanDive();
} }
@ -782,6 +783,7 @@ void MainWindow::on_actionDivePlanner_triggered()
// put us in PLAN mode // put us in PLAN mode
setApplicationState(ApplicationState::PlanDive); setApplicationState(ApplicationState::PlanDive);
graphics->setPlanState(&displayed_dive, 0);
plannerWidgets->planDive(); plannerWidgets->planDive();
} }