summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2016-10-03 16:25:48 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-10-11 21:58:41 -0700
commit0d20344c901c697d109d2ac071293bcb47db039a (patch)
tree57c7196135655e73f90c40e7b5c1f51affee2fa6
parentb5de08b709819783e5d79ffffa333cea05f5186f (diff)
downloadsubsurface-0d20344c901c697d109d2ac071293bcb47db039a.tar.gz
Add preference to change deco model
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.cpp21
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.h4
-rw-r--r--desktop-widgets/preferences/preferences_graph.cpp17
-rw-r--r--desktop-widgets/preferences/preferences_graph.h3
-rw-r--r--desktop-widgets/preferences/preferences_graph.ui123
5 files changed, 114 insertions, 54 deletions
diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp
index 437bf7f56..8303afa8a 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.cpp
+++ b/core/subsurface-qt/SettingsObjectWrapper.cpp
@@ -299,6 +299,11 @@ bool TechnicalDetailsSettings::calcndltts() const
return prefs.calcndltts;
}
+bool TechnicalDetailsSettings::buehlmann() const
+{
+ return (prefs.deco_mode == BUEHLMANN);
+}
+
int TechnicalDetailsSettings::gflow() const
{
return prefs.gflow;
@@ -499,6 +504,17 @@ void TechnicalDetailsSettings::setCalcndltts(bool value)
emit calcndlttsChanged(value);
}
+void TechnicalDetailsSettings::setBuehlmann(bool value)
+{
+ if (value == (prefs.deco_mode == BUEHLMANN))
+ return;
+ QSettings s;
+ s.beginGroup(group);
+ s.setValue("buehlmann", value);
+ prefs.deco_mode = value ? BUEHLMANN : VPMB;
+ emit buehlmannChanged(value);
+}
+
void TechnicalDetailsSettings::setGflow(int value)
{
if (value == prefs.gflow)
@@ -2105,6 +2121,11 @@ void SettingsObjectWrapper::load()
GET_BOOL("tankbar", tankbar);
GET_BOOL("RulerBar", rulergraph);
GET_BOOL("percentagegraph", percentagegraph);
+ v = s.value("buehlmann");
+ if (v.isValid())
+ prefs.deco_mode = v.toBool() ? BUEHLMANN : VPMB;
+ else
+ prefs.deco_mode = BUEHLMANN;
GET_INT("gflow", gflow);
GET_INT("gfhigh", gfhigh);
GET_INT("vpmb_conservatism", vpmb_conservatism);
diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h
index 1ab32083b..8097fc3c9 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.h
+++ b/core/subsurface-qt/SettingsObjectWrapper.h
@@ -116,6 +116,7 @@ class TechnicalDetailsSettings : public QObject {
Q_PROPERTY(bool calcceiling3m READ calcceiling3m WRITE setCalcceiling3m NOTIFY calcceiling3mChanged)
Q_PROPERTY(bool calcalltissues READ calcalltissues WRITE setCalcalltissues NOTIFY calcalltissuesChanged)
Q_PROPERTY(bool calcndltts READ calcndltts WRITE setCalcndltts NOTIFY calcndlttsChanged)
+ Q_PROPERTY(bool buehlmann READ buehlmann WRITE setBuehlmann NOTIFY buehlmannChanged)
Q_PROPERTY(int gflow READ gflow WRITE setGflow NOTIFY gflowChanged)
Q_PROPERTY(int gfhigh READ gfhigh WRITE setGfhigh NOTIFY gfhighChanged)
Q_PROPERTY(short vpmb_conservatism READ vpmbConservatism WRITE setVpmbConservatism NOTIFY vpmbConservatismChanged)
@@ -143,6 +144,7 @@ public:
bool calcceiling3m() const;
bool calcalltissues() const;
bool calcndltts() const;
+ bool buehlmann() const;
int gflow() const;
int gfhigh() const;
short vpmbConservatism() const;
@@ -169,6 +171,7 @@ public slots:
void setCalcceiling3m(bool value);
void setCalcalltissues(bool value);
void setCalcndltts(bool value);
+ void setBuehlmann(bool value);
void setGflow(int value);
void setGfhigh(int value);
void setVpmbConservatism(short);
@@ -195,6 +198,7 @@ signals:
void calcceiling3mChanged(bool value);
void calcalltissuesChanged(bool value);
void calcndlttsChanged(bool value);
+ void buehlmannChanged(bool value);
void gflowChanged(int value);
void gfhighChanged(int value);
void vpmbConservatismChanged(short value);
diff --git a/desktop-widgets/preferences/preferences_graph.cpp b/desktop-widgets/preferences/preferences_graph.cpp
index c13915e37..8f3e5e7bf 100644
--- a/desktop-widgets/preferences/preferences_graph.cpp
+++ b/desktop-widgets/preferences/preferences_graph.cpp
@@ -25,6 +25,13 @@ void PreferencesGraph::refreshSettings()
ui->maxpo2->setValue(prefs.modpO2);
ui->red_ceiling->setChecked(prefs.redceiling);
+ if (prefs.deco_mode == BUEHLMANN) {
+ ui->buehlmann->setChecked(true);
+ ui->vpmb->setChecked(false);
+ } else {
+ ui->buehlmann->setChecked(false);
+ ui->vpmb->setChecked(false);
+ }
ui->gflow->setValue(prefs.gflow);
ui->gfhigh->setValue(prefs.gfhigh);
ui->vpmb_conservatism->setValue(prefs.vpmb_conservatism);
@@ -54,6 +61,7 @@ void PreferencesGraph::syncSettings()
auto tech = SettingsObjectWrapper::instance()->techDetails;
tech->setModp02(ui->maxpo2->value());
tech->setRedceiling(ui->red_ceiling->isChecked());
+ tech->setBuehlmann(ui->buehlmann->isChecked());
tech->setGflow(ui->gflow->value());
tech->setGfhigh(ui->gfhigh->value());
tech->setVpmbConservatism(ui->vpmb_conservatism->value());
@@ -73,4 +81,13 @@ void PreferencesGraph::on_gfhigh_valueChanged(int gf)
{
ui->gfhigh->setStyleSheet(DANGER_GF);
}
+
+void PreferencesGraph::on_buehlmann_toggled(bool buehlmann)
+{
+ ui->gfhigh->setEnabled(buehlmann);
+ ui->gflow->setEnabled(buehlmann);
+ ui->gf_low_at_maxdepth->setEnabled(buehlmann);
+ ui->vpmb_conservatism->setEnabled(!buehlmann);
+}
+
#undef DANGER_GF
diff --git a/desktop-widgets/preferences/preferences_graph.h b/desktop-widgets/preferences/preferences_graph.h
index ca40c0a92..328f348a2 100644
--- a/desktop-widgets/preferences/preferences_graph.h
+++ b/desktop-widgets/preferences/preferences_graph.h
@@ -18,10 +18,11 @@ public:
private slots:
void on_gflow_valueChanged(int gf);
void on_gfhigh_valueChanged(int gf);
+ void on_buehlmann_toggled(bool buelmann);
private:
Ui::PreferencesGraph *ui;
};
-#endif \ No newline at end of file
+#endif
diff --git a/desktop-widgets/preferences/preferences_graph.ui b/desktop-widgets/preferences/preferences_graph.ui
index b8d6a4656..ab5c191c9 100644
--- a/desktop-widgets/preferences/preferences_graph.ui
+++ b/desktop-widgets/preferences/preferences_graph.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>505</width>
- <height>555</height>
+ <height>575</height>
</rect>
</property>
<property name="windowTitle">
@@ -133,15 +133,15 @@
<string>Misc</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
+ <item row="1" column="0">
<widget class="QLabel" name="label_19">
<property name="text">
<string>GFLow</string>
</property>
</widget>
</item>
- <item row="0" column="1">
- <widget class="QSpinBox" name="gflow">
+ <item row="2" column="1">
+ <widget class="QSpinBox" name="gfhigh">
<property name="minimum">
<number>1</number>
</property>
@@ -150,15 +150,22 @@
</property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_20">
+ <item row="8" column="0" colspan="2">
+ <widget class="QCheckBox" name="show_ccr_setpoint">
<property name="text">
- <string>GFHigh</string>
+ <string>CCR: show setpoints when viewing pO₂</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="0" colspan="2">
+ <widget class="QCheckBox" name="gf_low_at_maxdepth">
+ <property name="text">
+ <string>GFLow at max depth</string>
</property>
</widget>
</item>
<item row="1" column="1">
- <widget class="QSpinBox" name="gfhigh">
+ <widget class="QSpinBox" name="gflow">
<property name="minimum">
<number>1</number>
</property>
@@ -168,33 +175,61 @@
</widget>
</item>
<item row="2" column="0">
+ <widget class="QLabel" name="label_20">
+ <property name="text">
+ <string>GFHigh</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <widget class="QSpinBox" name="pscrfactor">
+ <property name="suffix">
+ <string/>
+ </property>
+ <property name="prefix">
+ <string>1:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0">
+ <widget class="QLabel" name="label_28">
+ <property name="text">
+ <string>pSCR ratio</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
<widget class="QLabel" name="label_21">
<property name="text">
<string>VPM-B Conservatism</string>
</property>
</widget>
</item>
- <item row="2" column="1">
- <widget class="QSpinBox" name="vpmb_conservatism">
- <property name="prefix">
- <string>+</string>
+ <item row="9" column="0" colspan="2">
+ <widget class="QCheckBox" name="show_ccr_sensors">
+ <property name="text">
+ <string>CCR: show individual O₂ sensor values when viewing pO₂</string>
</property>
- <property name="minimum">
- <number>0</number>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QDoubleSpinBox" name="psro2rate">
+ <property name="suffix">
+ <string>ℓ/min</string>
</property>
- <property name="maximum">
- <number>4</number>
+ <property name="decimals">
+ <number>3</number>
</property>
</widget>
</item>
- <item row="3" column="0">
+ <item row="4" column="0">
<widget class="QLabel" name="label_26">
<property name="text">
<string>Default CCR set-point for dive planning</string>
</property>
</widget>
</item>
- <item row="3" column="1">
+ <item row="4" column="1">
<widget class="QDoubleSpinBox" name="defaultSetpoint">
<property name="suffix">
<string>bar</string>
@@ -210,58 +245,40 @@
</property>
</widget>
</item>
- <item row="4" column="0">
+ <item row="5" column="0">
<widget class="QLabel" name="pSCR">
<property name="text">
<string>pSCR O₂ metabolism rate</string>
</property>
</widget>
</item>
- <item row="4" column="1">
- <widget class="QDoubleSpinBox" name="psro2rate">
- <property name="suffix">
- <string>ℓ/min</string>
- </property>
- <property name="decimals">
- <number>3</number>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QLabel" name="label_28">
- <property name="text">
- <string>pSCR ratio</string>
+ <item row="3" column="1">
+ <widget class="QSpinBox" name="vpmb_conservatism">
+ <property name="prefix">
+ <string>+</string>
</property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QSpinBox" name="pscrfactor">
- <property name="suffix">
- <string/>
+ <property name="minimum">
+ <number>0</number>
</property>
- <property name="prefix">
- <string>1:</string>
+ <property name="maximum">
+ <number>4</number>
</property>
</widget>
</item>
- <item row="6" column="0" colspan="2">
- <widget class="QCheckBox" name="gf_low_at_maxdepth">
+ <item row="0" column="0">
+ <widget class="QRadioButton" name="buehlmann">
<property name="text">
- <string>GFLow at max depth</string>
+ <string>Bühlmann</string>
</property>
- </widget>
- </item>
- <item row="7" column="0" colspan="2">
- <widget class="QCheckBox" name="show_ccr_setpoint">
- <property name="text">
- <string>CCR: show setpoints when viewing pO₂</string>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
</item>
- <item row="8" column="0" colspan="2">
- <widget class="QCheckBox" name="show_ccr_sensors">
+ <item row="0" column="1">
+ <widget class="QRadioButton" name="vpmb">
<property name="text">
- <string>CCR: show individual O₂ sensor values when viewing pO₂</string>
+ <string>VPM-B</string>
</property>
</widget>
</item>