Added configuration options for vertical speed units.

Some people (free divers) are loving ft/s or m/s units for vertical speeds.
Now they can choose between /min or /s in the configuration (only Qt UI).

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Patrick Valsecchi 2013-10-04 07:57:48 +02:00 committed by Dirk Hohndel
parent 6ae6c768f3
commit c28fe00bfe
6 changed files with 80 additions and 18 deletions

View file

@ -547,6 +547,7 @@ void MainWindow::readSettings()
GET_UNIT("temperature", temperature, units::FAHRENHEIT, units::CELSIUS);
GET_UNIT("weight", weight, units::LBS, units::KG);
}
GET_UNIT("vertical_speed_time", vertical_speed_time, units::MINUTES, units::SECONDS);
s.endGroup();
s.beginGroup("DisplayListColumns");
GET_BOOL("CYLINDER", visible_cols.cylinder);
@ -614,6 +615,7 @@ void MainWindow::writeSettings()
SAVE_VALUE("volume", units.volume);
SAVE_VALUE("temperature", units.temperature);
SAVE_VALUE("weight", units.weight);
SAVE_VALUE("vertical_speed_time", units.vertical_speed_time);
settings.endGroup();
settings.beginGroup("DisplayListColumns");
SAVE_VALUE("TEMPERATURE", visible_cols.temperature);

View file

@ -73,6 +73,8 @@ void PreferencesDialog::setUiFromPrefs()
ui.defaultfilename->setText(prefs.default_filename);
ui.displayinvalid->setChecked(prefs.show_invalid);
ui.show_time->setChecked(prefs.show_time);
ui.vertical_speed_minutes->setChecked(prefs.units.vertical_speed_time == units::MINUTES);
ui.vertical_speed_seconds->setChecked(prefs.units.vertical_speed_time == units::SECONDS);
}
void PreferencesDialog::restorePrefs()
@ -109,6 +111,7 @@ void PreferencesDialog::setPrefsFromUi()
prefs.units.pressure = ui.psi->isChecked() ? units::PSI : units::BAR;
prefs.units.volume = ui.cuft->isChecked() ? units::CUFT : units::LITER;
prefs.units.weight = ui.lbs->isChecked() ? units::LBS : units::KG;
prefs.units.vertical_speed_time = ui.vertical_speed_minutes->isChecked() ? units::MINUTES : units::SECONDS;
prefs.divelist_font = strdup(ui.font->font().family().toUtf8().data());
prefs.font_size = ui.fontsize->value();
prefs.default_filename = strdup(ui.defaultfilename->text().toUtf8().data());
@ -151,6 +154,7 @@ void PreferencesDialog::syncSettings()
s.setValue("pressure", ui.psi->isChecked() ? units::PSI : units::BAR);
s.setValue("volume", ui.cuft->isChecked() ? units::CUFT : units::LITER);
s.setValue("weight", ui.lbs->isChecked() ? units::LBS : units::KG);
s.setValue("vertical_speed_time", ui.vertical_speed_minutes->isChecked() ? units::MINUTES : units::SECONDS);
s.endGroup();
// Defaults
s.beginGroup("GeneralSettings");

View file

@ -401,6 +401,46 @@
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QGroupBox">
<property name="title">
<string>Time units</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel">
<property name="text">
<string>Ascent/Descent speed denominator</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QRadioButton" name="vertical_speed_minutes">
<property name="text">
<string>Minutes</string>
</property>
<attribute name="buttonGroup">
<string notr="true">verticalSpeed</string>
</attribute>
</widget>
</item>
<item row="0" column="2">
<widget class="QRadioButton" name="vertical_speed_seconds">
<property name="text">
<string>Seconds</string>
</property>
<attribute name="buttonGroup">
<string notr="true">verticalSpeed</string>
</attribute>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@ -414,19 +454,6 @@
</property>
</spacer>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_3">
@ -999,5 +1026,6 @@
<buttongroup name="buttonGroup_5"/>
<buttongroup name="buttonGroup"/>
<buttongroup name="buttonGroup_6"/>
<buttongroup name="verticalSpeed"/>
</buttongroups>
</ui>