minimal pO2 threshold: split max threshold into min and max

Nothing really special here. Just a split of the only p02 max threshold into
a min threshold and max threshold, and the adaptation of the UI. Change of
translatable strings included.

ref: https://github.com/Subsurface-divelog/subsurface/issues/259

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
Jan Mulder 2017-03-24 19:11:31 +01:00 committed by Dirk Hohndel
parent 1d0281c923
commit bb31c77597
7 changed files with 204 additions and 163 deletions

View file

@ -14,7 +14,8 @@ typedef struct
short po2;
short pn2;
short phe;
double po2_threshold;
double po2_threshold_min;
double po2_threshold_max;
double pn2_threshold;
double phe_threshold;
} partial_pressure_graphs_t;

View file

@ -166,11 +166,17 @@ short PartialPressureGasSettings::showPhe() const
return prefs.pp_graphs.phe;
}
double PartialPressureGasSettings::po2Threshold() const
double PartialPressureGasSettings::po2ThresholdMin() const
{
return prefs.pp_graphs.po2_threshold;
return prefs.pp_graphs.po2_threshold_min;
}
double PartialPressureGasSettings::po2ThresholdMax() const
{
return prefs.pp_graphs.po2_threshold_max;
}
double PartialPressureGasSettings::pn2Threshold() const
{
return prefs.pp_graphs.pn2_threshold;
@ -217,16 +223,28 @@ void PartialPressureGasSettings::setShowPhe(short value)
emit showPheChanged(value);
}
void PartialPressureGasSettings::setPo2Threshold(double value)
void PartialPressureGasSettings::setPo2ThresholdMin(double value)
{
if (value == prefs.pp_graphs.po2_threshold)
if (value == prefs.pp_graphs.po2_threshold_min)
return;
QSettings s;
s.beginGroup(group);
s.setValue("po2threshold", value);
prefs.pp_graphs.po2_threshold = value;
emit po2ThresholdChanged(value);
s.setValue("po2thresholdmin", value);
prefs.pp_graphs.po2_threshold_min = value;
emit po2ThresholdMinChanged(value);
}
void PartialPressureGasSettings::setPo2ThresholdMax(double value)
{
if (value == prefs.pp_graphs.po2_threshold_max)
return;
QSettings s;
s.beginGroup(group);
s.setValue("po2thresholdmax", value);
prefs.pp_graphs.po2_threshold_max = value;
emit po2ThresholdMaxChanged(value);
}
void PartialPressureGasSettings::setPn2Threshold(double value)
@ -2167,7 +2185,8 @@ void SettingsObjectWrapper::load()
GET_BOOL("po2graph", pp_graphs.po2);
GET_BOOL("pn2graph", pp_graphs.pn2);
GET_BOOL("phegraph", pp_graphs.phe);
GET_DOUBLE("po2threshold", pp_graphs.po2_threshold);
GET_DOUBLE("po2thresholdmin", pp_graphs.po2_threshold_min);
GET_DOUBLE("po2thresholdmax", pp_graphs.po2_threshold_max);
GET_DOUBLE("pn2threshold", pp_graphs.pn2_threshold);
GET_DOUBLE("phethreshold", pp_graphs.phe_threshold);
GET_BOOL("mod", mod);

View file

@ -69,19 +69,21 @@ private:
/* Control the state of the Partial Pressure Graphs preferences */
class PartialPressureGasSettings : public QObject {
Q_OBJECT
Q_PROPERTY(short show_po2 READ showPo2 WRITE setShowPo2 NOTIFY showPo2Changed)
Q_PROPERTY(short show_pn2 READ showPn2 WRITE setShowPn2 NOTIFY showPn2Changed)
Q_PROPERTY(short show_phe READ showPhe WRITE setShowPhe NOTIFY showPheChanged)
Q_PROPERTY(double po2_threshold READ po2Threshold WRITE setPo2Threshold NOTIFY po2ThresholdChanged)
Q_PROPERTY(double pn2_threshold READ pn2Threshold WRITE setPn2Threshold NOTIFY pn2ThresholdChanged)
Q_PROPERTY(double phe_threshold READ pheThreshold WRITE setPheThreshold NOTIFY pheThresholdChanged)
Q_PROPERTY(short show_po2 READ showPo2 WRITE setShowPo2 NOTIFY showPo2Changed)
Q_PROPERTY(short show_pn2 READ showPn2 WRITE setShowPn2 NOTIFY showPn2Changed)
Q_PROPERTY(short show_phe READ showPhe WRITE setShowPhe NOTIFY showPheChanged)
Q_PROPERTY(double po2_threshold_min READ po2ThresholdMin WRITE setPo2ThresholdMin NOTIFY po2ThresholdMinChanged)
Q_PROPERTY(double po2_threshold_max READ po2ThresholdMax WRITE setPo2ThresholdMax NOTIFY po2ThresholdMaxChanged)
Q_PROPERTY(double pn2_threshold READ pn2Threshold WRITE setPn2Threshold NOTIFY pn2ThresholdChanged)
Q_PROPERTY(double phe_threshold READ pheThreshold WRITE setPheThreshold NOTIFY pheThresholdChanged)
public:
PartialPressureGasSettings(QObject *parent);
short showPo2() const;
short showPn2() const;
short showPhe() const;
double po2Threshold() const;
double po2ThresholdMin() const;
double po2ThresholdMax() const;
double pn2Threshold() const;
double pheThreshold() const;
@ -89,7 +91,8 @@ public slots:
void setShowPo2(short value);
void setShowPn2(short value);
void setShowPhe(short value);
void setPo2Threshold(double value);
void setPo2ThresholdMin(double value);
void setPo2ThresholdMax(double value);
void setPn2Threshold(double value);
void setPheThreshold(double value);
@ -97,7 +100,8 @@ signals:
void showPo2Changed(short value);
void showPn2Changed(short value);
void showPheChanged(short value);
void po2ThresholdChanged(double value);
void po2ThresholdMaxChanged(double value);
void po2ThresholdMinChanged(double value);
void pn2ThresholdChanged(double value);
void pheThresholdChanged(double value);

View file

@ -20,7 +20,8 @@ struct preferences default_prefs = {
.po2 = false,
.pn2 = false,
.phe = false,
.po2_threshold = 1.6,
.po2_threshold_min = 0.16,
.po2_threshold_max = 1.6,
.pn2_threshold = 4.0,
.phe_threshold = 13.0,
},

View file

@ -20,7 +20,8 @@ PreferencesGraph::~PreferencesGraph()
void PreferencesGraph::refreshSettings()
{
ui->pheThreshold->setValue(prefs.pp_graphs.phe_threshold);
ui->po2Threshold->setValue(prefs.pp_graphs.po2_threshold);
ui->po2ThresholdMax->setValue(prefs.pp_graphs.po2_threshold_max);
ui->po2ThresholdMin->setValue(prefs.pp_graphs.po2_threshold_min);
ui->pn2Threshold->setValue(prefs.pp_graphs.pn2_threshold);
ui->maxpo2->setValue(prefs.modpO2);
ui->red_ceiling->setChecked(prefs.redceiling);
@ -56,7 +57,8 @@ void PreferencesGraph::syncSettings()
auto pp_gas = SettingsObjectWrapper::instance()->pp_gas;
pp_gas->setPheThreshold(ui->pheThreshold->value());
pp_gas->setPo2Threshold(ui->po2Threshold->value());
pp_gas->setPo2ThresholdMax(ui->po2ThresholdMax->value());
pp_gas->setPo2ThresholdMin(ui->po2ThresholdMin->value());
pp_gas->setPn2Threshold(ui->pn2Threshold->value());
auto tech = SettingsObjectWrapper::instance()->techDetails;

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>650</width>
<height>581</height>
<height>634</height>
</rect>
</property>
<property name="windowTitle">
@ -26,12 +26,12 @@
<bool>true</bool>
</property>
<property name="text">
<string>Threshold for pO₂</string>
<string>Threshold for pO₂ (minimum, maximum)</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="po2Threshold">
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="pn2Threshold">
<property name="enabled">
<bool>true</bool>
</property>
@ -49,12 +49,32 @@
<bool>true</bool>
</property>
<property name="text">
<string>Threshold for pN₂</string>
<string>Threshold for pN₂ (maximum only)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="pn2Threshold">
<item row="4" column="0">
<widget class="QLabel" name="label_26">
<property name="text">
<string>CCR options:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="pheThreshold">
<property name="enabled">
<bool>true</bool>
</property>
<property name="suffix">
<string>bar</string>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="maxpo2">
<property name="enabled">
<bool>true</bool>
</property>
@ -72,20 +92,7 @@
<bool>true</bool>
</property>
<property name="text">
<string>Threshold for pHe</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="pheThreshold">
<property name="enabled">
<bool>true</bool>
</property>
<property name="suffix">
<string>bar</string>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
<string>Threshold for pHe (maximum only)</string>
</property>
</widget>
</item>
@ -95,27 +102,14 @@
<bool>true</bool>
</property>
<property name="text">
<string>pO₂ in calculating MOD</string>
<string>pO₂ in calculating MOD (maximum only )</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="maxpo2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="suffix">
<string>bar</string>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_26">
<item row="5" column="1" colspan="2">
<widget class="QCheckBox" name="show_ccr_setpoint">
<property name="text">
<string>CCR options:</string>
<string>Show setpoints when viewing pO₂</string>
</property>
</widget>
</item>
@ -142,13 +136,6 @@
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QCheckBox" name="show_ccr_setpoint">
<property name="text">
<string>Show setpoints when viewing pO₂</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="2">
<widget class="QCheckBox" name="show_ccr_sensors">
<property name="text">
@ -156,6 +143,32 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QDoubleSpinBox" name="po2ThresholdMax">
<property name="enabled">
<bool>true</bool>
</property>
<property name="suffix">
<string>bar</string>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="po2ThresholdMin">
<property name="enabled">
<bool>true</bool>
</property>
<property name="suffix">
<string>bar</string>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -165,13 +178,13 @@
<string>Ceiling display setup</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="red_ceiling">
<property name="enabled">
<bool>true</bool>
</property>
<item row="2" column="1">
<widget class="QLabel" name="label_VPMB">
<property name="text">
<string>Draw dive computer reported ceiling red</string>
<string>Conservatism level</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
@ -185,23 +198,96 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="vpmb">
<item row="3" column="0">
<widget class="QRadioButton" name="buehlmann">
<property name="text">
<string>VPM-B</string>
<string>B&amp;ühlmann</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_VPMB">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="red_ceiling">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Conservatism level</string>
<string>Draw dive computer reported ceiling red</string>
</property>
</widget>
</item>
<item row="5" column="4">
<widget class="QSpinBox" name="pscrfactor">
<property name="suffix">
<string/>
</property>
<property name="prefix">
<string>1:</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="label_GFhigh">
<property name="text">
<string>GFHigh</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QDoubleSpinBox" name="psro2rate">
<property name="suffix">
<string>/min</string>
</property>
<property name="decimals">
<number>3</number>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QSpinBox" name="gflow">
<property name="suffix">
<string>%</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>150</number>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="MetabolicRate">
<property name="text">
<string>Metabolic rate O₂</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QLabel" name="label_28">
<property name="text">
<string>Dilution ratio</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="4" column="2" colspan="2">
<widget class="QCheckBox" name="gf_low_at_maxdepth">
<property name="text">
<string>GFLow at max. depth</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QSpinBox" name="vpmb_conservatism">
<property name="prefix">
@ -215,23 +301,17 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QRadioButton" name="buehlmann">
<item row="5" column="0">
<widget class="QLabel" name="pSCR">
<property name="text">
<string>Bühlmann</string>
</property>
<property name="checked">
<bool>true</bool>
<string>pSCR options:</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="label_GFhigh">
<item row="2" column="0">
<widget class="QRadioButton" name="vpmb">
<property name="text">
<string>GFHigh</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<string>&amp;VPM-B</string>
</property>
</widget>
</item>
@ -258,73 +338,6 @@
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QSpinBox" name="gflow">
<property name="suffix">
<string>%</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>150</number>
</property>
</widget>
</item>
<item row="4" column="2" colspan="2">
<widget class="QCheckBox" name="gf_low_at_maxdepth">
<property name="text">
<string>GFLow at max. depth</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="pSCR">
<property name="text">
<string>pSCR options:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="MetabolicRate">
<property name="text">
<string>Metabolic rate O₂</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="5" column="2">
<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="3">
<widget class="QLabel" name="label_28">
<property name="text">
<string>Dilution ratio</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="5" column="4">
<widget class="QSpinBox" name="pscrfactor">
<property name="suffix">
<string/>
</property>
<property name="prefix">
<string>1:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -367,7 +380,6 @@
</layout>
</widget>
<tabstops>
<tabstop>po2Threshold</tabstop>
<tabstop>pn2Threshold</tabstop>
<tabstop>pheThreshold</tabstop>
<tabstop>maxpo2</tabstop>

View file

@ -351,13 +351,15 @@ void ProfileWidget2::setupItemOnScene()
CREATE_PP_GAS(pn2GasItem, PN2, PN2, PN2_ALERT, &prefs.pp_graphs.pn2_threshold);
CREATE_PP_GAS(pheGasItem, PHE, PHE, PHE_ALERT, &prefs.pp_graphs.phe_threshold);
CREATE_PP_GAS(po2GasItem, PO2, PO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold);
CREATE_PP_GAS(o2SetpointGasItem, O2SETPOINT, PO2_ALERT, PO2_ALERT, &prefs.pp_graphs.po2_threshold);
CREATE_PP_GAS(ccrsensor1GasItem, CCRSENSOR1, CCRSENSOR1, PO2_ALERT, &prefs.pp_graphs.po2_threshold);
CREATE_PP_GAS(ccrsensor2GasItem, CCRSENSOR2, CCRSENSOR2, PO2_ALERT, &prefs.pp_graphs.po2_threshold);
CREATE_PP_GAS(ccrsensor3GasItem, CCRSENSOR3, CCRSENSOR3, PO2_ALERT, &prefs.pp_graphs.po2_threshold);
CREATE_PP_GAS(po2GasItem, PO2, PO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_max);
CREATE_PP_GAS(o2SetpointGasItem, O2SETPOINT, PO2_ALERT, PO2_ALERT, &prefs.pp_graphs.po2_threshold_max);
CREATE_PP_GAS(ccrsensor1GasItem, CCRSENSOR1, CCRSENSOR1, PO2_ALERT, &prefs.pp_graphs.po2_threshold_max);
CREATE_PP_GAS(ccrsensor2GasItem, CCRSENSOR2, CCRSENSOR2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_max);
CREATE_PP_GAS(ccrsensor3GasItem, CCRSENSOR3, CCRSENSOR3, PO2_ALERT, &prefs.pp_graphs.po2_threshold_max);
#undef CREATE_PP_GAS
#ifndef SUBSURFACE_MOBILE
// Visibility Connections
connect(SettingsObjectWrapper::instance()->pp_gas, &PartialPressureGasSettings::showPheChanged, pheGasItem, &PartialPressureGasItem::setVisible);
connect(SettingsObjectWrapper::instance()->pp_gas, &PartialPressureGasSettings::showPo2Changed, po2GasItem, &PartialPressureGasItem::setVisible);