mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add ability to replan a dive that we planned before
When doing this, all waypoints of the calculated ascent are now waypoints in the plan - so the user has to remove the ascent part of the dive in order to really replan the dive. That's a pain, but we don't keep the data around that would tell us which waypoints are user input and which ones were calculated. Fixes #527 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
76f3c0f028
commit
a85a219df3
4 changed files with 41 additions and 7 deletions
|
@ -1155,7 +1155,9 @@ void DivePlannerPointsModel::createPlan()
|
||||||
|
|
||||||
//TODO: C-based function here?
|
//TODO: C-based function here?
|
||||||
plan(&diveplan, &cache, isPlanner(), true);
|
plan(&diveplan, &cache, isPlanner(), true);
|
||||||
record_dive(clone_dive(&displayed_dive));
|
if (!current_dive || displayed_dive.id != current_dive->id)
|
||||||
|
// we were planning a new dive, not re-planning an existing on
|
||||||
|
record_dive(clone_dive(&displayed_dive));
|
||||||
mark_divelist_changed(true);
|
mark_divelist_changed(true);
|
||||||
|
|
||||||
// Remove and clean the diveplan, so we don't delete
|
// Remove and clean the diveplan, so we don't delete
|
||||||
|
|
|
@ -404,11 +404,13 @@ void MainWindow::planCanceled()
|
||||||
void MainWindow::planCreated()
|
void MainWindow::planCreated()
|
||||||
{
|
{
|
||||||
// get the new dive selected and assign a number if reasonable
|
// get the new dive selected and assign a number if reasonable
|
||||||
dive_list()->unselectDives();
|
if (displayed_dive.id == 0) {
|
||||||
select_dive(dive_table.nr - 1);
|
// we might have added a new dive (so displayed_dive was cleared out by clone_dive()
|
||||||
dive_list()->selectDive(selected_dive);
|
dive_list()->unselectDives();
|
||||||
set_dive_nr_for_current_dive();
|
select_dive(dive_table.nr - 1);
|
||||||
|
dive_list()->selectDive(selected_dive);
|
||||||
|
set_dive_nr_for_current_dive();
|
||||||
|
}
|
||||||
showProfile();
|
showProfile();
|
||||||
refreshDisplay();
|
refreshDisplay();
|
||||||
}
|
}
|
||||||
|
@ -448,9 +450,32 @@ void MainWindow::setupForAddAndPlan(const char *model)
|
||||||
DivePlannerPointsModel::instance()->setupCylinders();
|
DivePlannerPointsModel::instance()->setupCylinders();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionReplanDive_triggered()
|
||||||
|
{
|
||||||
|
if (!plannerStateClean())
|
||||||
|
return;
|
||||||
|
if (!current_dive || strcmp(current_dive->dc.model, "planned dive")) {
|
||||||
|
qDebug() << current_dive->dc.model;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ui.ListWidget->endSearch();
|
||||||
|
// put us in PLAN mode
|
||||||
|
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
|
||||||
|
|
||||||
|
ui.newProfile->setPlanState();
|
||||||
|
ui.infoPane->setCurrentIndex(PLANNERWIDGET);
|
||||||
|
DivePlannerPointsModel::instance()->loadFromDive(current_dive);
|
||||||
|
reset_cylinders(&displayed_dive, true);
|
||||||
|
ui.diveListPane->setCurrentIndex(1); // switch to the plan output
|
||||||
|
ui.globePane->setCurrentIndex(1);
|
||||||
|
#ifdef NO_MARBLE
|
||||||
|
ui.globePane->show();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionDivePlanner_triggered()
|
void MainWindow::on_actionDivePlanner_triggered()
|
||||||
{
|
{
|
||||||
if(!plannerStateClean())
|
if (!plannerStateClean())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ui.ListWidget->endSearch();
|
ui.ListWidget->endSearch();
|
||||||
|
|
|
@ -118,6 +118,7 @@ slots:
|
||||||
void on_actionAboutSubsurface_triggered();
|
void on_actionAboutSubsurface_triggered();
|
||||||
void on_actionUserManual_triggered();
|
void on_actionUserManual_triggered();
|
||||||
void on_actionDivePlanner_triggered();
|
void on_actionDivePlanner_triggered();
|
||||||
|
void on_actionReplanDive_triggered();
|
||||||
void on_action_Check_for_Updates_triggered();
|
void on_action_Check_for_Updates_triggered();
|
||||||
|
|
||||||
void current_dive_changed(int divenr);
|
void current_dive_changed(int divenr);
|
||||||
|
|
|
@ -722,6 +722,7 @@ p, li { white-space: pre-wrap; }
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionAddDive"/>
|
<addaction name="actionAddDive"/>
|
||||||
<addaction name="actionDivePlanner"/>
|
<addaction name="actionDivePlanner"/>
|
||||||
|
<addaction name="actionReplanDive"/>
|
||||||
<addaction name="copy"/>
|
<addaction name="copy"/>
|
||||||
<addaction name="paste"/>
|
<addaction name="paste"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
@ -1074,6 +1075,11 @@ p, li { white-space: pre-wrap; }
|
||||||
<string>Configure Dive Computer</string>
|
<string>Configure Dive Computer</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionReplanDive">
|
||||||
|
<property name="text">
|
||||||
|
<string>Re-plan dive</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|
Loading…
Add table
Reference in a new issue