summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2019-01-10 21:18:53 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-01-13 15:02:07 -0800
commit2c794348c1060c8f6ce55c598c0a20690c4967f2 (patch)
treef5a47767117dd43ee20a878c7132b944e2609682 /desktop-widgets
parent7f2c7aa7dee10d419fe3ce208d6a36cc1e93b580 (diff)
downloadsubsurface-2c794348c1060c8f6ce55c598c0a20690c4967f2.tar.gz
Planner: Add checkbox to force OC bailout
This adds a checkbox for rebreather modes of the planner that force the ascent to be in OC mode. Before, one had to add a one minute last segment with the mode change but this is not practical when manually searching for the maximal bottom time given gas reserves. Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/diveplanner.cpp22
-rw-r--r--desktop-widgets/diveplanner.h2
-rw-r--r--desktop-widgets/mainwindow.cpp1
-rw-r--r--desktop-widgets/plannerSettings.ui197
4 files changed, 127 insertions, 95 deletions
diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp
index bda612431..c5467aa08 100644
--- a/desktop-widgets/diveplanner.cpp
+++ b/desktop-widgets/diveplanner.cpp
@@ -123,6 +123,7 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg
ui.waterType->setItemData(1, SEAWATER_SALINITY);
ui.waterType->setItemData(2, EN13319_SALINITY);
waterTypeUpdateTexts();
+
QTableView *view = ui.cylinderTableWidget->view();
view->setColumnHidden(CylindersModel::START, true);
view->setColumnHidden(CylindersModel::END, true);
@@ -307,6 +308,10 @@ void PlannerSettingsWidget::disableDecoElements(int mode)
ui.backgasBreaks->blockSignals(true);
ui.backgasBreaks->setChecked(false);
ui.backgasBreaks->blockSignals(false);
+ ui.bailout->setDisabled(true);
+ ui.bailout->blockSignals(true);
+ ui.bailout->setChecked(false);
+ ui.bailout->blockSignals(false);
ui.bottompo2->setDisabled(false);
ui.decopo2->setDisabled(true);
ui.safetystop->setDisabled(false);
@@ -344,6 +349,7 @@ void PlannerSettingsWidget::disableDecoElements(int mode)
ui.backgasBreaks->setChecked(false);
ui.backgasBreaks->blockSignals(false);
}
+ ui.bailout->setDisabled(!(displayed_dive.dc.divemode == CCR || displayed_dive.dc.divemode == PSCR));
ui.bottompo2->setDisabled(false);
ui.decopo2->setDisabled(false);
ui.safetystop->setDisabled(true);
@@ -377,6 +383,7 @@ void PlannerSettingsWidget::disableDecoElements(int mode)
ui.backgasBreaks->setChecked(false);
ui.backgasBreaks->blockSignals(false);
}
+ ui.bailout->setDisabled(!(displayed_dive.dc.divemode == CCR || displayed_dive.dc.divemode == PSCR));
ui.bottompo2->setDisabled(false);
ui.decopo2->setDisabled(false);
ui.safetystop->setDisabled(true);
@@ -438,6 +445,8 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
ui.bottompo2->setValue(prefs.bottompo2 / 1000.0);
ui.decopo2->setValue(prefs.decopo2 / 1000.0);
ui.backgasBreaks->setChecked(prefs.doo2breaks);
+ setBailout(false);
+ setBailoutVisibility(false);
ui.drop_stone_mode->setChecked(prefs.drop_stone_mode);
ui.switch_at_req_stop->setChecked(prefs.switch_at_req_stop);
ui.min_switch_duration->setValue(prefs.min_switch_duration / 60);
@@ -481,9 +490,11 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int)));
connect(ui.vpmb_conservatism, SIGNAL(valueChanged(int)), plannerModel, SLOT(setVpmbConservatism(int)));
connect(ui.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool)));
+ connect(ui.bailout, SIGNAL(toggled(bool)), this, SLOT(setBailout(bool)));
connect(ui.switch_at_req_stop, SIGNAL(toggled(bool)), plannerModel, SLOT(setSwitchAtReqStop(bool)));
connect(ui.min_switch_duration, SIGNAL(valueChanged(int)), plannerModel, SLOT(setMinSwitchDuration(int)));
connect(ui.rebreathermode, SIGNAL(currentIndexChanged(int)), plannerModel, SLOT(setRebreatherMode(int)));
+ connect(ui.rebreathermode, SIGNAL(currentIndexChanged(int)), this, SLOT(setBailoutVisibility(int)));
connect(ui.bottompo2, SIGNAL(valueChanged(double)), CylindersModel::instance(), SLOT(updateBestMixes()));
connect(ui.bestmixEND, SIGNAL(valueChanged(int)), CylindersModel::instance(), SLOT(updateBestMixes()));
@@ -656,6 +667,17 @@ void PlannerSettingsWidget::setBackgasBreaks(bool dobreaks)
plannerModel->emitDataChanged();
}
+void PlannerSettingsWidget::setBailout(bool dobailout)
+{
+ qPrefDivePlanner::instance()->set_dobailout(dobailout);
+ plannerModel->emitDataChanged();
+}
+
+void PlannerSettingsWidget::setBailoutVisibility(int mode)
+{
+ ui.bailout->setDisabled(!(mode == CCR || mode == PSCR));
+}
+
PlannerDetails::PlannerDetails(QWidget *parent) : QWidget(parent)
{
ui.setupUi(this);
diff --git a/desktop-widgets/diveplanner.h b/desktop-widgets/diveplanner.h
index bf35ed7ec..6d17c956b 100644
--- a/desktop-widgets/diveplanner.h
+++ b/desktop-widgets/diveplanner.h
@@ -85,9 +85,11 @@ slots:
void setDecoPo2(double po2);
void setBestmixEND(int depth);
void setBackgasBreaks(bool dobreaks);
+ void setBailout(bool dobailout);
void disableDecoElements(int mode);
void disableBackgasBreaks(bool enabled);
void setDiveMode(int mode);
+ void setBailoutVisibility(int mode);
private:
Ui::plannerSettingsWidget ui;
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 2e4342511..64cdc6cb3 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -1005,6 +1005,7 @@ void MainWindow::on_actionDivePlanner_triggered()
// plan the dive in the same mode as the currently selected one
if (current_dive) {
divePlannerSettingsWidget->setDiveMode(current_dive->dc.divemode);
+ divePlannerSettingsWidget->setBailoutVisibility(current_dive->dc.divemode);
if (current_dive->salinity)
divePlannerWidget->setSalinity(current_dive->salinity);
}
diff --git a/desktop-widgets/plannerSettings.ui b/desktop-widgets/plannerSettings.ui
index 81d6d4a4b..72aec7c55 100644
--- a/desktop-widgets/plannerSettings.ui
+++ b/desktop-widgets/plannerSettings.ui
@@ -255,7 +255,7 @@
<property name="spacing">
<number>2</number>
</property>
- <item row="2" column="2">
+ <item row="4" column="2">
<widget class="QSpinBox" name="reserve_gas">
<property name="suffix">
<string>bar</string>
@@ -274,7 +274,7 @@
</property>
</widget>
</item>
- <item row="4" column="1">
+ <item row="6" column="1">
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -287,7 +287,7 @@
</property>
</spacer>
</item>
- <item row="18" column="1" colspan="2">
+ <item row="22" column="1" colspan="2">
<widget class="QCheckBox" name="switch_at_req_stop">
<property name="toolTip">
<string>Postpone gas change if a stop is not required</string>
@@ -297,54 +297,63 @@
</property>
</widget>
</item>
- <item row="10" column="1">
- <widget class="QLabel" name="label_gfhigh">
+ <item row="18" column="1" colspan="2">
+ <widget class="QCheckBox" name="lastStop">
<property name="text">
- <string>GFHigh</string>
- </property>
- <property name="indent">
- <number>25</number>
+ <string>Last stop at 6m</string>
</property>
</widget>
</item>
- <item row="9" column="1">
- <widget class="QLabel" name="label_gflow">
- <property name="text">
- <string>GFLow</string>
+ <item row="15" column="2">
+ <widget class="QSpinBox" name="vpmb_conservatism">
+ <property name="prefix">
+ <string>+</string>
</property>
- <property name="indent">
- <number>26</number>
+ <property name="maximum">
+ <number>4</number>
</property>
</widget>
</item>
- <item row="9" column="2">
- <widget class="QSpinBox" name="gflow">
+ <item row="12" column="2">
+ <widget class="QSpinBox" name="gfhigh">
<property name="suffix">
<string>%</string>
</property>
<property name="minimum">
- <number>10</number>
+ <number>40</number>
</property>
<property name="maximum">
<number>150</number>
</property>
</widget>
</item>
- <item row="15" column="1" colspan="2">
- <widget class="QCheckBox" name="drop_stone_mode">
- <property name="text">
- <string>Drop to first depth</string>
+ <item row="23" column="2">
+ <widget class="QSpinBox" name="min_switch_duration">
+ <property name="suffix">
+ <string>min</string>
+ </property>
+ <property name="prefix">
+ <string/>
+ </property>
+ <property name="minimum">
+ <number>0</number>
+ </property>
+ <property name="maximum">
+ <number>9</number>
+ </property>
+ <property name="value">
+ <number>1</number>
</property>
</widget>
</item>
- <item row="19" column="1">
- <widget class="QLabel" name="label_min_switch_duration">
+ <item row="20" column="1" colspan="2">
+ <widget class="QCheckBox" name="backgasBreaks">
<property name="text">
- <string>Min. switch duration O₂% below 100%</string>
+ <string>Plan backgas breaks</string>
</property>
</widget>
</item>
- <item row="21" column="1">
+ <item row="25" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -357,40 +366,54 @@
</property>
</spacer>
</item>
+ <item row="23" column="1">
+ <widget class="QLabel" name="label_min_switch_duration">
+ <property name="text">
+ <string>Min. switch duration O₂% below 100%</string>
+ </property>
+ </widget>
+ </item>
<item row="17" column="1" colspan="2">
- <widget class="QCheckBox" name="backgasBreaks">
+ <widget class="QCheckBox" name="drop_stone_mode">
<property name="text">
- <string>Plan backgas breaks</string>
+ <string>Drop to first depth</string>
</property>
</widget>
</item>
- <item row="19" column="2">
- <widget class="QSpinBox" name="min_switch_duration">
+ <item row="11" column="2">
+ <widget class="QSpinBox" name="gflow">
<property name="suffix">
- <string>min</string>
- </property>
- <property name="prefix">
- <string/>
+ <string>%</string>
</property>
<property name="minimum">
- <number>0</number>
+ <number>10</number>
</property>
<property name="maximum">
- <number>9</number>
+ <number>150</number>
</property>
- <property name="value">
- <number>1</number>
+ </widget>
+ </item>
+ <item row="11" column="1">
+ <widget class="QLabel" name="label_gflow">
+ <property name="text">
+ <string>GFLow</string>
+ </property>
+ <property name="indent">
+ <number>26</number>
</property>
</widget>
</item>
- <item row="16" column="1" colspan="2">
- <widget class="QCheckBox" name="lastStop">
+ <item row="12" column="1">
+ <widget class="QLabel" name="label_gfhigh">
<property name="text">
- <string>Last stop at 6m</string>
+ <string>GFHigh</string>
+ </property>
+ <property name="indent">
+ <number>25</number>
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="3" column="1">
<widget class="QRadioButton" name="recreational_deco">
<property name="toolTip">
<string>Maximize bottom time allowed by gas and no decompression limits</string>
@@ -400,47 +423,24 @@
</property>
</widget>
</item>
- <item row="10" column="2">
- <widget class="QSpinBox" name="gfhigh">
- <property name="suffix">
- <string>%</string>
- </property>
- <property name="minimum">
- <number>40</number>
+ <item row="15" column="1">
+ <widget class="QLabel" name="label_vpmb_conservatism">
+ <property name="text">
+ <string>Conservatism level</string>
</property>
- <property name="maximum">
- <number>150</number>
+ <property name="indent">
+ <number>25</number>
</property>
</widget>
</item>
- <item row="12" column="1">
+ <item row="14" column="1">
<widget class="QRadioButton" name="vpmb_deco">
<property name="text">
<string>VPM-B deco</string>
</property>
</widget>
</item>
- <item row="5" column="1">
- <widget class="QRadioButton" name="buehlmann_deco">
- <property name="text">
- <string>Bühlmann deco</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLabel" name="label_reserve_gas">
- <property name="text">
- <string>Reserve gas</string>
- </property>
- <property name="indent">
- <number>26</number>
- </property>
- </widget>
- </item>
- <item row="3" column="1" alignment="Qt::AlignHCenter">
+ <item row="5" column="1" alignment="Qt::AlignHCenter">
<widget class="QCheckBox" name="safetystop">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
@@ -453,7 +453,7 @@
</property>
</widget>
</item>
- <item row="11" column="1">
+ <item row="13" column="1">
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -466,7 +466,7 @@
</property>
</spacer>
</item>
- <item row="14" column="1">
+ <item row="16" column="1">
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -479,26 +479,6 @@
</property>
</spacer>
</item>
- <item row="13" column="1">
- <widget class="QLabel" name="label_vpmb_conservatism">
- <property name="text">
- <string>Conservatism level</string>
- </property>
- <property name="indent">
- <number>25</number>
- </property>
- </widget>
- </item>
- <item row="13" column="2">
- <widget class="QSpinBox" name="vpmb_conservatism">
- <property name="prefix">
- <string>+</string>
- </property>
- <property name="maximum">
- <number>4</number>
- </property>
- </widget>
- </item>
<item row="0" column="2">
<widget class="QComboBox" name="rebreathermode">
<property name="currentText">
@@ -516,6 +496,33 @@
</property>
</widget>
</item>
+ <item row="7" column="1">
+ <widget class="QRadioButton" name="buehlmann_deco">
+ <property name="text">
+ <string>Bühlmann deco</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QLabel" name="label_reserve_gas">
+ <property name="text">
+ <string>Reserve gas</string>
+ </property>
+ <property name="indent">
+ <number>26</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="bailout">
+ <property name="text">
+ <string>Bailout: Deco on OC</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>