summaryrefslogtreecommitdiffstats
path: root/core/subsurface-qt/SettingsObjectWrapper.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-05-06 13:44:22 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-05-06 13:49:36 -0700
commit876b479d695acda652e7b6c81c6b899946d42a85 (patch)
treecc01ab6c306c94e0d542fd43000d11f62e056cd8 /core/subsurface-qt/SettingsObjectWrapper.cpp
parent38b9185974e4f5199ee8f65bac97dab76b058e41 (diff)
downloadsubsurface-876b479d695acda652e7b6c81c6b899946d42a85.tar.gz
Wire up duration units preference UI
Now we track the preference, but we don't act on it, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/subsurface-qt/SettingsObjectWrapper.cpp')
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp
index 2752567ae..25161a904 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.cpp
+++ b/core/subsurface-qt/SettingsObjectWrapper.cpp
@@ -1626,6 +1626,11 @@ int UnitsSettings::verticalSpeedTime() const
return prefs.units.vertical_speed_time;
}
+int UnitsSettings::durationUnits() const
+{
+ return prefs.units.duration_units;
+}
+
QString UnitsSettings::unitSystem() const
{
return prefs.unit_system == METRIC ? QStringLiteral("metric")
@@ -1705,6 +1710,17 @@ void UnitsSettings::setVerticalSpeedTime(int value)
emit verticalSpeedTimeChanged(value);
}
+void UnitsSettings::setDurationUnits(int value)
+{
+ if (value == prefs.units.duration_units)
+ return;
+ QSettings s;
+ s.beginGroup(group);
+ s.setValue("duration_units", value);
+ prefs.units.duration_units = (units::DURATION) value;
+ emit durationUnitChanged(value);
+}
+
void UnitsSettings::setCoordinatesTraditional(bool value)
{
if (value == prefs.coordinates_traditional)
@@ -2180,6 +2196,7 @@ void SettingsObjectWrapper::load()
GET_UNIT("weight", weight, units::LBS, units::KG);
}
GET_UNIT("vertical_speed_time", vertical_speed_time, units::MINUTES, units::SECONDS);
+ GET_UNIT3("duration_units", duration_units, units::MIXED, units::ALWAYS_HOURS, units::DURATION);
GET_BOOL("coordinates", coordinates_traditional);
s.endGroup();
s.beginGroup("TecDetails");