Preserve dive mode when planning a dive

Data such as cilinders and used gasses are populated fromn the currently
selected dive when starting the planner. It is more logical to use
the dive mode (OC, CCR, pSCR) of the currently selected dive
as well. This commits changes this.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
Jan Mulder 2017-04-19 08:05:28 +02:00 committed by Dirk Hohndel
parent 9b8fc9f64a
commit 89b914e47d
3 changed files with 9 additions and 0 deletions

View file

@ -186,6 +186,11 @@ void DivePlannerWidget::setSurfacePressure(int surface_pressure)
ui.ATMPressure->setValue(surface_pressure); ui.ATMPressure->setValue(surface_pressure);
} }
void PlannerSettingsWidget::setDiveMode(int mode)
{
ui.rebreathermode->setCurrentIndex(mode);
}
void DivePlannerWidget::setSalinity(int salinity) void DivePlannerWidget::setSalinity(int salinity)
{ {
ui.salinity->setValue(salinity / 10000.0); ui.salinity->setValue(salinity / 10000.0);

View file

@ -85,6 +85,7 @@ slots:
void setBestmixEND(int depth); void setBestmixEND(int depth);
void setBackgasBreaks(bool dobreaks); void setBackgasBreaks(bool dobreaks);
void disableDecoElements(int mode); void disableDecoElements(int mode);
void setDiveMode(int mode);
private: private:
Ui::plannerSettingsWidget ui; Ui::plannerSettingsWidget ui;

View file

@ -908,6 +908,7 @@ void MainWindow::setupForAddAndPlan(const char *model)
// setup the dive cylinders // setup the dive cylinders
DivePlannerPointsModel::instance()->clear(); DivePlannerPointsModel::instance()->clear();
DivePlannerPointsModel::instance()->setupCylinders(); DivePlannerPointsModel::instance()->setupCylinders();
} }
void MainWindow::on_actionReplanDive_triggered() void MainWindow::on_actionReplanDive_triggered()
@ -951,6 +952,8 @@ void MainWindow::on_actionDivePlanner_triggered()
setupForAddAndPlan("planned dive"); // don't translate, stored in XML file setupForAddAndPlan("planned dive"); // don't translate, stored in XML file
DivePlannerPointsModel::instance()->setupStartTime(); DivePlannerPointsModel::instance()->setupStartTime();
DivePlannerPointsModel::instance()->createSimpleDive(); DivePlannerPointsModel::instance()->createSimpleDive();
// plan the dive in the same mode as the currently selected one
divePlannerSettingsWidget()->setDiveMode(current_dive->dc.divemode);
DivePictureModel::instance()->updateDivePictures(); DivePictureModel::instance()->updateDivePictures();
divePlannerWidget()->setReplanButton(false); divePlannerWidget()->setReplanButton(false);
} }