summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2017-11-24 21:06:42 +0100
committerGravatar Robert C. Helling <helling@atdotde.de>2017-11-25 20:17:35 +0100
commit60677e513ba413f89d17038611de5a6f24881eb3 (patch)
tree7cc4f5b02402f1f8220f8bcf9cdafb8638fe0c7d /desktop-widgets/diveplanner.cpp
parent088db5e12be569ea85fc2ac34c22413a30090cba (diff)
downloadsubsurface-60677e513ba413f89d17038611de5a6f24881eb3.tar.gz
Planner UI improvements: Enable/disable options
Don't accidentally enable o2breaks option when entering planner in RECREATIONAL mode. Disable also label for min_switch_duration according to dive mode. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'desktop-widgets/diveplanner.cpp')
-rw-r--r--desktop-widgets/diveplanner.cpp34
1 files changed, 31 insertions, 3 deletions
diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp
index 008d39dd5..6950d5bc2 100644
--- a/desktop-widgets/diveplanner.cpp
+++ b/desktop-widgets/diveplanner.cpp
@@ -256,6 +256,9 @@ void PlannerSettingsWidget::disableDecoElements(int mode)
ui.gfhigh->setDisabled(false);
ui.lastStop->setDisabled(true);
ui.backgasBreaks->setDisabled(true);
+ ui.backgasBreaks->blockSignals(true);
+ ui.backgasBreaks->setChecked(false);
+ ui.backgasBreaks->blockSignals(false);
ui.bottompo2->setDisabled(false);
ui.decopo2->setDisabled(true);
ui.safetystop->setDisabled(false);
@@ -265,6 +268,7 @@ void PlannerSettingsWidget::disableDecoElements(int mode)
ui.vpmb_conservatism->setDisabled(true);
ui.switch_at_req_stop->setDisabled(true);
ui.min_switch_duration->setDisabled(true);
+ ui.label_min_switch_duration->setDisabled(true);
ui.sacfactor->setDisabled(true);
ui.problemsolvingtime->setDisabled(true);
ui.sacfactor->blockSignals(true);
@@ -280,7 +284,17 @@ void PlannerSettingsWidget::disableDecoElements(int mode)
ui.gflow->setDisabled(true);
ui.gfhigh->setDisabled(true);
ui.lastStop->setDisabled(false);
- ui.backgasBreaks->setDisabled(false);
+ if (prefs.last_stop) {
+ ui.backgasBreaks->setDisabled(false);
+ ui.backgasBreaks->blockSignals(true);
+ ui.backgasBreaks->setChecked(prefs.doo2breaks);
+ ui.backgasBreaks->blockSignals(false);
+ } else {
+ ui.backgasBreaks->setDisabled(true);
+ ui.backgasBreaks->blockSignals(true);
+ ui.backgasBreaks->setChecked(false);
+ ui.backgasBreaks->blockSignals(false);
+ }
ui.bottompo2->setDisabled(false);
ui.decopo2->setDisabled(false);
ui.safetystop->setDisabled(true);
@@ -290,6 +304,7 @@ void PlannerSettingsWidget::disableDecoElements(int mode)
ui.vpmb_conservatism->setDisabled(false);
ui.switch_at_req_stop->setDisabled(false);
ui.min_switch_duration->setDisabled(false);
+ ui.label_min_switch_duration->setDisabled(false);
ui.sacfactor->setDisabled(false);
ui.problemsolvingtime->setDisabled(false);
ui.sacfactor->setValue(prefs.sacfactor / 100.0);
@@ -301,7 +316,17 @@ void PlannerSettingsWidget::disableDecoElements(int mode)
ui.gflow->setDisabled(false);
ui.gfhigh->setDisabled(false);
ui.lastStop->setDisabled(false);
- ui.backgasBreaks->setDisabled(false);
+ if (prefs.last_stop) {
+ ui.backgasBreaks->setDisabled(false);
+ ui.backgasBreaks->blockSignals(true);
+ ui.backgasBreaks->setChecked(prefs.doo2breaks);
+ ui.backgasBreaks->blockSignals(false);
+ } else {
+ ui.backgasBreaks->setDisabled(true);
+ ui.backgasBreaks->blockSignals(true);
+ ui.backgasBreaks->setChecked(false);
+ ui.backgasBreaks->blockSignals(false);
+ }
ui.bottompo2->setDisabled(false);
ui.decopo2->setDisabled(false);
ui.safetystop->setDisabled(true);
@@ -311,6 +336,7 @@ void PlannerSettingsWidget::disableDecoElements(int mode)
ui.vpmb_conservatism->setDisabled(true);
ui.switch_at_req_stop->setDisabled(false);
ui.min_switch_duration->setDisabled(false);
+ ui.label_min_switch_duration->setDisabled(false);
ui.sacfactor->setDisabled(false);
ui.problemsolvingtime->setDisabled(false);
ui.sacfactor->setValue(prefs.sacfactor / 100.0);
@@ -320,6 +346,9 @@ void PlannerSettingsWidget::disableDecoElements(int mode)
void PlannerSettingsWidget::disableBackgasBreaks(bool enabled)
{
+ if (prefs.planner_deco_mode == RECREATIONAL)
+ return;
+
if (enabled) {
ui.backgasBreaks->setDisabled(false);
ui.backgasBreaks->blockSignals(true);
@@ -366,7 +395,6 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
ui.buehlmann_deco->setChecked(prefs.planner_deco_mode == BUEHLMANN);
ui.vpmb_deco->setChecked(prefs.planner_deco_mode == VPMB);
disableDecoElements((int) prefs.planner_deco_mode);
- disableBackgasBreaks(prefs.last_stop);
// should be the same order as in dive_comp_type!
rebreather_modes << tr("Open circuit") << tr("CCR") << tr("pSCR");