mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
planner: get rid of global displayed_dive variable
Allocate the dive in the planner. This is all a bit convoluted and needs more cleanup. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
b5682369f8
commit
4c02d1c279
9 changed files with 251 additions and 233 deletions
|
@ -549,7 +549,7 @@ void MainWindow::on_actionPrint_triggered()
|
|||
{
|
||||
#ifndef NO_PRINTING
|
||||
// When in planner, only print the planned dive.
|
||||
dive *singleDive = appState == ApplicationState::PlanDive ? &displayed_dive
|
||||
dive *singleDive = appState == ApplicationState::PlanDive ? plannerWidgets->getDive()
|
||||
: nullptr;
|
||||
PrintDialog dlg(singleDive, this);
|
||||
|
||||
|
@ -636,8 +636,6 @@ bool MainWindow::plannerStateClean()
|
|||
|
||||
void MainWindow::planCanceled()
|
||||
{
|
||||
// while planning we might have modified the displayed_dive
|
||||
// let's refresh what's shown on the profile
|
||||
showProfile();
|
||||
refreshDisplay();
|
||||
}
|
||||
|
@ -665,8 +663,8 @@ void MainWindow::on_actionReplanDive_triggered()
|
|||
setApplicationState(ApplicationState::PlanDive);
|
||||
|
||||
disableShortcuts(true);
|
||||
copy_dive(current_dive, &displayed_dive); // Planning works on a copy of the dive (for now).
|
||||
profile->setPlanState(&displayed_dive, profile->dc);
|
||||
plannerWidgets->prepareReplanDive(current_dive);
|
||||
profile->setPlanState(plannerWidgets->getDive(), profile->dc);
|
||||
plannerWidgets->replanDive(profile->dc);
|
||||
}
|
||||
|
||||
|
@ -679,8 +677,9 @@ void MainWindow::on_actionDivePlanner_triggered()
|
|||
setApplicationState(ApplicationState::PlanDive);
|
||||
|
||||
disableShortcuts(true);
|
||||
profile->setPlanState(&displayed_dive, 0);
|
||||
plannerWidgets->planDive(current_dive);
|
||||
plannerWidgets->preparePlanDive(current_dive);
|
||||
profile->setPlanState(plannerWidgets->getDive(), 0);
|
||||
plannerWidgets->planDive();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionAddDive_triggered()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue