From 68ceb75294348953baa8827fbe3f5778980efbec Mon Sep 17 00:00:00 2001 From: Joakim Bygdell Date: Tue, 7 Jul 2015 20:29:37 +0200 Subject: Planner: disable unrelated planner settings When VPM-B is the choosen deco algorithm changing, GF low and high have no effect. So lets disable them similar to what we do for recreational mode. Signed-off-by: Joakim Bygdell Signed-off-by: Dirk Hohndel --- qt-models/diveplannermodel.cpp | 2 +- qt-ui/diveplanner.cpp | 30 +++++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index e4cff38ec..e82daba11 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -447,7 +447,7 @@ void DivePlannerPointsModel::setDisplayTransitions(bool value) void DivePlannerPointsModel::setDecoMode(int mode) { prefs.deco_mode = deco_mode(mode); - emit recreationChanged(mode == int(RECREATIONAL)); + emit recreationChanged(mode == int(prefs.deco_mode)); emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS -1)); } diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 684ef44aa..f6f6c3894 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -219,11 +219,31 @@ void PlannerSettingsWidget::decoSacChanged(const double decosac) void PlannerSettingsWidget::disableDecoElements(bool value) { - ui.lastStop->setDisabled(value); - ui.backgasBreaks->setDisabled(value); - ui.bottompo2->setDisabled(value); - ui.decopo2->setDisabled(value); - ui.reserve_gas->setDisabled(!value); + if (prefs.deco_mode == RECREATIONAL) { + ui.lastStop->setDisabled(value); + ui.backgasBreaks->setDisabled(value); + ui.bottompo2->setDisabled(value); + ui.decopo2->setDisabled(value); + ui.reserve_gas->setDisabled(!value); + } + else if (prefs.deco_mode == VPMB) { + ui.gflow->setDisabled(value); + ui.gfhigh->setDisabled(value); + ui.lastStop->setDisabled(!value); + ui.backgasBreaks->setDisabled(!value); + ui.bottompo2->setDisabled(!value); + ui.decopo2->setDisabled(!value); + ui.reserve_gas->setDisabled(value); + } + else if (prefs.deco_mode == BUEHLMANN) { + ui.gflow->setDisabled(!value); + ui.gfhigh->setDisabled(!value); + ui.lastStop->setDisabled(!value); + ui.backgasBreaks->setDisabled(!value); + ui.bottompo2->setDisabled(!value); + ui.decopo2->setDisabled(!value); + ui.reserve_gas->setDisabled(value); + } } void DivePlannerWidget::printDecoPlan() -- cgit v1.2.3-70-g09d2