summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2017-11-02 21:00:54 +0100
committerGravatar Robert C. Helling <helling@atdotde.de>2017-11-04 14:51:02 +0100
commitac25b238dd5b381d9970e0d26ebef9fc13fc075d (patch)
treedba500b869a5801b6e01dc639d3f17e38a785f9d /desktop-widgets
parent3ae0b5cbdddd4edf63a9374bdfda8c6444f549e7 (diff)
downloadsubsurface-ac25b238dd5b381d9970e0d26ebef9fc13fc075d.tar.gz
Disable o2 break option if last stop is not at 6m/20ft
Disable the possibility to plan o2 breaks of option "last stop at 6m/20ft" is not set. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/diveplanner.cpp17
-rw-r--r--desktop-widgets/diveplanner.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp
index 38d41d59a..008d39dd5 100644
--- a/desktop-widgets/diveplanner.cpp
+++ b/desktop-widgets/diveplanner.cpp
@@ -318,6 +318,21 @@ void PlannerSettingsWidget::disableDecoElements(int mode)
}
}
+void PlannerSettingsWidget::disableBackgasBreaks(bool enabled)
+{
+ if (enabled) {
+ 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);
+ }
+}
+
void DivePlannerWidget::printDecoPlan()
{
MainWindow::instance()->printPlan();
@@ -351,6 +366,7 @@ 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");
@@ -367,6 +383,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
connect(ui.vpmb_deco, SIGNAL(clicked()), modeMapper, SLOT(map()));
connect(ui.lastStop, SIGNAL(toggled(bool)), plannerModel, SLOT(setLastStop6m(bool)));
+ connect(ui.lastStop, SIGNAL(toggled(bool)), this, SLOT(disableBackgasBreaks(bool)));
connect(ui.verbatim_plan, SIGNAL(toggled(bool)), plannerModel, SLOT(setVerbatim(bool)));
connect(ui.display_duration, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayDuration(bool)));
connect(ui.display_runtime, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayRuntime(bool)));
diff --git a/desktop-widgets/diveplanner.h b/desktop-widgets/diveplanner.h
index 59884534c..955fc690a 100644
--- a/desktop-widgets/diveplanner.h
+++ b/desktop-widgets/diveplanner.h
@@ -86,6 +86,7 @@ slots:
void setBestmixEND(int depth);
void setBackgasBreaks(bool dobreaks);
void disableDecoElements(int mode);
+ void disableBackgasBreaks(bool enabled);
void setDiveMode(int mode);
private: