summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-02-12 11:36:24 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-04-02 13:53:23 -0700
commitb4c307c775c6f1cd306094cb89ee53378b71c81e (patch)
tree86dd712cac9440b97caa6b0b6ef267e7aebd2827 /desktop-widgets
parent4d60662531b3c4ad1ce17c0fd2d7f9844cf52ece (diff)
downloadsubsurface-b4c307c775c6f1cd306094cb89ee53378b71c81e.tar.gz
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>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/diveplanner.cpp4
-rw-r--r--desktop-widgets/mainwindow.cpp2
2 files changed, 2 insertions, 4 deletions
diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp
index e237097c5..527e0021a 100644
--- a/desktop-widgets/diveplanner.cpp
+++ b/desktop-widgets/diveplanner.cpp
@@ -540,8 +540,6 @@ PlannerWidgets::PlannerWidgets()
void PlannerWidgets::planDive()
{
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
-
- MainWindow::instance()->graphics->setPlanState(&displayed_dive, 0);
dc_number = 0;
// 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()->loadFromDive(&displayed_dive);
- MainWindow::instance()->graphics->setPlanState(&displayed_dive, 0);
-
plannerWidget.setReplanButton(true);
plannerWidget.setupStartTime(timestampToDateTime(displayed_dive.when));
if (displayed_dive.surface_pressure.mbar)
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index b6cae1e96..92a2c11a0 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -771,6 +771,7 @@ void MainWindow::on_actionReplanDive_triggered()
// put us in PLAN mode
setApplicationState(ApplicationState::PlanDive);
+ graphics->setPlanState(&displayed_dive, 0);
plannerWidgets->replanDive();
}
@@ -782,6 +783,7 @@ void MainWindow::on_actionDivePlanner_triggered()
// put us in PLAN mode
setApplicationState(ApplicationState::PlanDive);
+ graphics->setPlanState(&displayed_dive, 0);
plannerWidgets->planDive();
}