UI for pSCR preferences

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2015-01-19 15:28:56 +01:00 committed by Dirk Hohndel
parent 2bb81d0fe5
commit 2923329e8e
2 changed files with 45 additions and 6 deletions

View file

@ -125,6 +125,8 @@ void PreferencesDialog::setUiFromPrefs()
ui.gf_low_at_maxdepth->setChecked(prefs.gf_low_at_maxdepth);
ui.show_ccr_setpoint->setChecked(prefs.show_ccr_setpoint);
ui.defaultSetpoint->setValue((double)prefs.defaultsetpoint / 1000.0);
ui.psro2rate->setValue(prefs.o2consumption / 1000.0);
ui.pscrfactor->setValue(rint(1000.0 / prefs.pscr_ratio));
// units
if (prefs.unit_system == METRIC)
@ -299,7 +301,9 @@ void PreferencesDialog::syncSettings()
s.setValue("default_filename", ui.defaultfilename->text());
s.setValue("default_cylinder", ui.default_cylinder->currentText());
s.setValue("use_default_file", ui.btnUseDefaultFile->isChecked());
s.setValue("defaultsetpoint", (int) (ui.defaultSetpoint->value() * 1000.0));
s.setValue("defaultsetpoint", rint(ui.defaultSetpoint->value() * 1000.0));
s.setValue("o2consumption", rint(ui.psro2rate->value() *1000.0));
s.setValue("pscr_ratio", rint(1000.0 / ui.pscrfactor->value()));
s.endGroup();
s.beginGroup("Display");
@ -397,7 +401,6 @@ void PreferencesDialog::loadSettings()
GET_BOOL("show_sac", show_sac);
GET_BOOL("display_unused_tanks", display_unused_tanks);
GET_BOOL("show_average_depth", show_average_depth);
GET_INT("default_setpoint", defaultsetpoint);
s.endGroup();
s.beginGroup("GeneralSettings");
@ -405,6 +408,8 @@ void PreferencesDialog::loadSettings()
GET_TXT("default_cylinder", default_cylinder);
GET_BOOL("use_default_file", use_default_file);
GET_INT("defaultsetpoint", defaultsetpoint);
GET_INT("o2consumption", o2consumption);
GET_INT("pscr_ratio", pscr_ratio);
s.endGroup();
s.beginGroup("Display");

View file

@ -151,7 +151,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>5</number>
<number>2</number>
</property>
<widget class="QWidget" name="defaults_page">
<layout class="QVBoxLayout" name="verticalLayout_3">
@ -789,14 +789,14 @@
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label_26">
<property name="text">
<string>Default CCR set-point</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QDoubleSpinBox" name="defaultSetpoint">
<property name="suffix">
<string>bar</string>
@ -819,6 +819,40 @@
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="pSCR">
<property name="text">
<string>pSCR O₂ metabolism rate</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_28">
<property name="text">
<string>pSCR ratio</string>
</property>
</widget>
</item>
<item row="8" 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="9" column="1">
<widget class="QSpinBox" name="pscrfactor">
<property name="suffix">
<string/>
</property>
<property name="prefix">
<string>1:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -1400,10 +1434,10 @@
</connection>
</connections>
<buttongroups>
<buttongroup name="buttonGroup"/>
<buttongroup name="verticalSpeed"/>
<buttongroup name="buttonGroup_2"/>
<buttongroup name="buttonGroup_3"/>
<buttongroup name="buttonGroup"/>
<buttongroup name="buttonGroup_4"/>
<buttongroup name="buttonGroup_5"/>
<buttongroup name="buttonGroup_6"/>