mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Preferences: move units to the new dialog
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c53615315e
commit
57d7b59bdc
7 changed files with 336 additions and 527 deletions
|
@ -146,7 +146,6 @@ void PreferencesDialog::setUiFromPrefs()
|
|||
ui.pn2Threshold->setValue(prefs.pp_graphs.pn2_threshold);
|
||||
ui.maxpo2->setValue(prefs.modpO2);
|
||||
ui.red_ceiling->setChecked(prefs.redceiling);
|
||||
ui.units_group->setEnabled(ui.personalize->isChecked());
|
||||
|
||||
ui.gflow->setValue(prefs.gflow);
|
||||
ui.gfhigh->setValue(prefs.gfhigh);
|
||||
|
@ -157,31 +156,8 @@ void PreferencesDialog::setUiFromPrefs()
|
|||
ui.psro2rate->setValue(prefs.o2consumption / 1000.0);
|
||||
ui.pscrfactor->setValue(rint(1000.0 / prefs.pscr_ratio));
|
||||
|
||||
// units
|
||||
if (prefs.unit_system == METRIC)
|
||||
ui.metric->setChecked(true);
|
||||
else if (prefs.unit_system == IMPERIAL)
|
||||
ui.imperial->setChecked(true);
|
||||
else
|
||||
ui.personalize->setChecked(true);
|
||||
ui.gpsTraditional->setChecked(prefs.coordinates_traditional);
|
||||
ui.gpsDecimal->setChecked(!prefs.coordinates_traditional);
|
||||
|
||||
ui.celsius->setChecked(prefs.units.temperature == units::CELSIUS);
|
||||
ui.fahrenheit->setChecked(prefs.units.temperature == units::FAHRENHEIT);
|
||||
ui.meter->setChecked(prefs.units.length == units::METERS);
|
||||
ui.feet->setChecked(prefs.units.length == units::FEET);
|
||||
ui.bar->setChecked(prefs.units.pressure == units::BAR);
|
||||
ui.psi->setChecked(prefs.units.pressure == units::PSI);
|
||||
ui.liter->setChecked(prefs.units.volume == units::LITER);
|
||||
ui.cuft->setChecked(prefs.units.volume == units::CUFT);
|
||||
ui.kg->setChecked(prefs.units.weight == units::KG);
|
||||
ui.lbs->setChecked(prefs.units.weight == units::LBS);
|
||||
|
||||
ui.display_unused_tanks->setChecked(prefs.display_unused_tanks);
|
||||
ui.show_average_depth->setChecked(prefs.show_average_depth);
|
||||
ui.vertical_speed_minutes->setChecked(prefs.units.vertical_speed_time == units::MINUTES);
|
||||
ui.vertical_speed_seconds->setChecked(prefs.units.vertical_speed_time == units::SECONDS);
|
||||
|
||||
QSettings s;
|
||||
|
||||
|
@ -237,20 +213,6 @@ void PreferencesDialog::syncSettings()
|
|||
SAVE_OR_REMOVE("show_average_depth", default_prefs.show_average_depth, ui.show_average_depth->isChecked());
|
||||
s.endGroup();
|
||||
|
||||
// Units
|
||||
s.beginGroup("Units");
|
||||
QString unitSystem[] = {"metric", "imperial", "personal"};
|
||||
short unitValue = ui.metric->isChecked() ? METRIC : (ui.imperial->isChecked() ? IMPERIAL : PERSONALIZE);
|
||||
SAVE_OR_REMOVE_SPECIAL("unit_system", default_prefs.unit_system, unitValue, unitSystem[unitValue]);
|
||||
s.setValue("temperature", ui.fahrenheit->isChecked() ? units::FAHRENHEIT : units::CELSIUS);
|
||||
s.setValue("length", ui.feet->isChecked() ? units::FEET : units::METERS);
|
||||
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.setValue("coordinates", ui.gpsTraditional->isChecked());
|
||||
s.endGroup();
|
||||
|
||||
// Defaults
|
||||
s.beginGroup("GeneralSettings");
|
||||
s.setValue("defaultsetpoint", rint(ui.defaultSetpoint->value() * 1000.0));
|
||||
|
@ -391,7 +353,6 @@ void PreferencesDialog::buttonClicked(QAbstractButton *button)
|
|||
void PreferencesDialog::on_resetSettings_clicked()
|
||||
{
|
||||
QSettings s;
|
||||
|
||||
QMessageBox response(this);
|
||||
response.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
|
||||
response.setDefaultButton(QMessageBox::Cancel);
|
||||
|
|
|
@ -83,16 +83,6 @@
|
|||
<property name="currentRow">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Units</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/units</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Graph</string>
|
||||
|
@ -134,309 +124,8 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="units_page">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_units">
|
||||
<property name="title">
|
||||
<string>Unit system</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>System</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="metric">
|
||||
<property name="text">
|
||||
<string>&Metric</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup_6</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="imperial">
|
||||
<property name="text">
|
||||
<string>Imperial</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup_6</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="personalize">
|
||||
<property name="text">
|
||||
<string>Personali&ze</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup_6</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="units_group">
|
||||
<property name="title">
|
||||
<string>Individual settings</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Depth</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="meter">
|
||||
<property name="text">
|
||||
<string>meter</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="feet">
|
||||
<property name="text">
|
||||
<string>feet</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Pressure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QRadioButton" name="bar">
|
||||
<property name="text">
|
||||
<string>bar</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup_2</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QRadioButton" name="psi">
|
||||
<property name="text">
|
||||
<string>psi</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup_2</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Volume</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QRadioButton" name="liter">
|
||||
<property name="text">
|
||||
<string>&liter</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup_3</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QRadioButton" name="cuft">
|
||||
<property name="text">
|
||||
<string>cu ft</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup_3</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Temperature</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QRadioButton" name="celsius">
|
||||
<property name="text">
|
||||
<string>celsius</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup_4</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QRadioButton" name="fahrenheit">
|
||||
<property name="text">
|
||||
<string>fahrenheit</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup_4</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Weight</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QRadioButton" name="kg">
|
||||
<property name="text">
|
||||
<string>kg</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup_5</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QRadioButton" name="lbs">
|
||||
<property name="text">
|
||||
<string>lbs</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup_5</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Time units</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label13">
|
||||
<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>
|
||||
<widget class="QGroupBox" name="groupBox_11">
|
||||
<property name="title">
|
||||
<string>GPS coordinates</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="text">
|
||||
<string>Location Display</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="gpsTraditional">
|
||||
<property name="text">
|
||||
<string>traditional (dms)</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup_7</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="gpsDecimal">
|
||||
<property name="text">
|
||||
<string>decimal</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup_7</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="graph_page">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||
|
@ -1120,182 +809,6 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>personalize</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>units_group</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>185</x>
|
||||
<y>19</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>186</x>
|
||||
<y>23</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>imperial</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>feet</receiver>
|
||||
<slot>setChecked(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>164</x>
|
||||
<y>19</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>175</x>
|
||||
<y>34</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>metric</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>meter</receiver>
|
||||
<slot>setChecked(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>142</x>
|
||||
<y>19</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>153</x>
|
||||
<y>34</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>imperial</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>psi</receiver>
|
||||
<slot>setChecked(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>164</x>
|
||||
<y>19</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>175</x>
|
||||
<y>33</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>metric</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>bar</receiver>
|
||||
<slot>setChecked(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>142</x>
|
||||
<y>19</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>153</x>
|
||||
<y>33</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>imperial</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>cuft</receiver>
|
||||
<slot>setChecked(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>164</x>
|
||||
<y>19</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>175</x>
|
||||
<y>31</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>metric</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>liter</receiver>
|
||||
<slot>setChecked(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>142</x>
|
||||
<y>19</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>153</x>
|
||||
<y>31</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>imperial</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>fahrenheit</receiver>
|
||||
<slot>setChecked(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>164</x>
|
||||
<y>19</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>175</x>
|
||||
<y>29</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>metric</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>celsius</receiver>
|
||||
<slot>setChecked(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>142</x>
|
||||
<y>19</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>153</x>
|
||||
<y>29</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>imperial</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>lbs</receiver>
|
||||
<slot>setChecked(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>164</x>
|
||||
<y>19</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>175</x>
|
||||
<y>28</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>metric</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>kg</receiver>
|
||||
<slot>setChecked(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>142</x>
|
||||
<y>19</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>153</x>
|
||||
<y>28</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>proxyAuthRequired</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
|
|
|
@ -15,6 +15,7 @@ set(SUBSURFACE_PREFERENCES_LIB_SRCS
|
|||
preferences_language.cpp
|
||||
preferences_georeference.cpp
|
||||
preferences_defaults.cpp
|
||||
preferences_units.cpp
|
||||
)
|
||||
|
||||
source_group("Subsurface Preferences" FILES ${SUBSURFACE_PREFERENCES_LIB_SRCS})
|
||||
|
|
60
desktop-widgets/preferences/preferences_units.cpp
Normal file
60
desktop-widgets/preferences/preferences_units.cpp
Normal file
|
@ -0,0 +1,60 @@
|
|||
#include "preferences_units.h"
|
||||
#include "ui_preferences_units.h"
|
||||
#include "prefs-macros.h"
|
||||
#include "qthelper.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
PreferencesUnits::PreferencesUnits(): AbstractPreferencesWidget(tr("Units"),QIcon(":units"),1), ui(new Ui::PreferencesUnits())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
PreferencesUnits::~PreferencesUnits()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PreferencesUnits::refreshSettings()
|
||||
{
|
||||
QSettings s;
|
||||
s.beginGroup("Units");
|
||||
QString unitSystem[] = {"metric", "imperial", "personal"};
|
||||
short unitValue = ui->metric->isChecked() ? METRIC : (ui->imperial->isChecked() ? IMPERIAL : PERSONALIZE);
|
||||
SAVE_OR_REMOVE_SPECIAL("unit_system", default_prefs.unit_system, unitValue, unitSystem[unitValue]);
|
||||
s.setValue("temperature", ui->fahrenheit->isChecked() ? units::FAHRENHEIT : units::CELSIUS);
|
||||
s.setValue("length", ui->feet->isChecked() ? units::FEET : units::METERS);
|
||||
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.setValue("coordinates", ui->gpsTraditional->isChecked());
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
void PreferencesUnits::syncSettings()
|
||||
{
|
||||
switch(prefs.unit_system) {
|
||||
case METRIC: ui->metric->setChecked(true); break;
|
||||
case IMPERIAL: ui->imperial->setChecked(true); break;
|
||||
default: ui->personalize->setChecked(true); break;
|
||||
}
|
||||
|
||||
ui->gpsTraditional->setChecked(prefs.coordinates_traditional);
|
||||
ui->gpsDecimal->setChecked(!prefs.coordinates_traditional);
|
||||
|
||||
ui->celsius->setChecked(prefs.units.temperature == units::CELSIUS);
|
||||
ui->fahrenheit->setChecked(prefs.units.temperature == units::FAHRENHEIT);
|
||||
ui->meter->setChecked(prefs.units.length == units::METERS);
|
||||
ui->feet->setChecked(prefs.units.length == units::FEET);
|
||||
ui->bar->setChecked(prefs.units.pressure == units::BAR);
|
||||
ui->psi->setChecked(prefs.units.pressure == units::PSI);
|
||||
ui->liter->setChecked(prefs.units.volume == units::LITER);
|
||||
ui->cuft->setChecked(prefs.units.volume == units::CUFT);
|
||||
ui->kg->setChecked(prefs.units.weight == units::KG);
|
||||
ui->lbs->setChecked(prefs.units.weight == units::LBS);
|
||||
ui->units_group->setEnabled(ui->personalize->isChecked());
|
||||
|
||||
ui->vertical_speed_minutes->setChecked(prefs.units.vertical_speed_time == units::MINUTES);
|
||||
ui->vertical_speed_seconds->setChecked(prefs.units.vertical_speed_time == units::SECONDS);
|
||||
}
|
21
desktop-widgets/preferences/preferences_units.h
Normal file
21
desktop-widgets/preferences/preferences_units.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef PREFERENCES_UNITS_H
|
||||
#define PREFERENCES_UNITS_H
|
||||
|
||||
#include "abstractpreferenceswidget.h"
|
||||
|
||||
namespace Ui {
|
||||
class PreferencesUnits;
|
||||
}
|
||||
|
||||
class PreferencesUnits : public AbstractPreferencesWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
PreferencesUnits();
|
||||
virtual ~PreferencesUnits();
|
||||
virtual void refreshSettings();
|
||||
virtual void syncSettings();
|
||||
private:
|
||||
Ui::PreferencesUnits *ui;
|
||||
};
|
||||
|
||||
#endif
|
251
desktop-widgets/preferences/preferences_units.ui
Normal file
251
desktop-widgets/preferences/preferences_units.ui
Normal file
|
@ -0,0 +1,251 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PreferencesUnits</class>
|
||||
<widget class="QWidget" name="PreferencesUnits">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>374</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_units">
|
||||
<property name="title">
|
||||
<string>Unit system</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>System</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="metric">
|
||||
<property name="text">
|
||||
<string>&Metric</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="imperial">
|
||||
<property name="text">
|
||||
<string>Imperial</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="personalize">
|
||||
<property name="text">
|
||||
<string>Personali&ze</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="units_group">
|
||||
<property name="title">
|
||||
<string>Individual settings</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Depth</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="meter">
|
||||
<property name="text">
|
||||
<string>meter</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="feet">
|
||||
<property name="text">
|
||||
<string>feet</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Pressure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QRadioButton" name="bar">
|
||||
<property name="text">
|
||||
<string>bar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QRadioButton" name="psi">
|
||||
<property name="text">
|
||||
<string>psi</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Volume</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QRadioButton" name="liter">
|
||||
<property name="text">
|
||||
<string>&liter</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QRadioButton" name="cuft">
|
||||
<property name="text">
|
||||
<string>cu ft</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Temperature</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QRadioButton" name="celsius">
|
||||
<property name="text">
|
||||
<string>celsius</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QRadioButton" name="fahrenheit">
|
||||
<property name="text">
|
||||
<string>fahrenheit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Weight</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QRadioButton" name="kg">
|
||||
<property name="text">
|
||||
<string>kg</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QRadioButton" name="lbs">
|
||||
<property name="text">
|
||||
<string>lbs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Time units</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label13">
|
||||
<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>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="vertical_speed_seconds">
|
||||
<property name="text">
|
||||
<string>Seconds</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_11">
|
||||
<property name="title">
|
||||
<string>GPS coordinates</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="text">
|
||||
<string>Location Display</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="gpsTraditional">
|
||||
<property name="text">
|
||||
<string>traditional (dms)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="gpsDecimal">
|
||||
<property name="text">
|
||||
<string>decimal</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -4,6 +4,7 @@
|
|||
#include "preferences_language.h"
|
||||
#include "preferences_georeference.h"
|
||||
#include "preferences_defaults.h"
|
||||
#include "preferences_units.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
|
@ -37,6 +38,7 @@ PreferencesDialogV2::PreferencesDialogV2()
|
|||
addPreferencePage(new PreferencesLanguage());
|
||||
addPreferencePage(new PreferencesGeoreference());
|
||||
addPreferencePage(new PreferencesDefaults());
|
||||
addPreferencePage(new PreferencesUnits());
|
||||
refreshPages();
|
||||
|
||||
connect(pagesList, &QListWidget::currentRowChanged,
|
||||
|
|
Loading…
Add table
Reference in a new issue