summaryrefslogtreecommitdiffstats
path: root/core/settings/qPrefUnit.cpp
diff options
context:
space:
mode:
authorGravatar jan Iversen <jan@casacondor.com>2020-01-02 13:41:55 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-01-04 10:56:55 -0800
commit14db76004484a56c6b3a2237732d7a2acad05953 (patch)
tree3da3e78670c6d463beb9e5f64c4da7ee4e9bd0c9 /core/settings/qPrefUnit.cpp
parentd000cb2b0d038264abb1384c037da10d753549b9 (diff)
downloadsubsurface-14db76004484a56c6b3a2237732d7a2acad05953.tar.gz
core/settings: split "normal" version of unit_system
All unit functions have a string version and a normal version, except unit_system. Make a non string version of unit_system. Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/settings/qPrefUnit.cpp')
-rw-r--r--core/settings/qPrefUnit.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/core/settings/qPrefUnit.cpp b/core/settings/qPrefUnit.cpp
index 8a2244c8b..c415f8287 100644
--- a/core/settings/qPrefUnit.cpp
+++ b/core/settings/qPrefUnit.cpp
@@ -89,18 +89,20 @@ DISK_LOADSYNC_ENUM_EXT(Units, "temperature", units::TEMPERATURE, temperature, un
QString qPrefUnits::unit_system()
{
return prefs.unit_system == METRIC ? QStringLiteral("metric") :
- prefs.unit_system == IMPERIAL ? QStringLiteral("imperial") :
- QStringLiteral("personalized");
+ prefs.unit_system == IMPERIAL ? QStringLiteral("imperial") :
+ QStringLiteral("personalized");
}
void qPrefUnits::set_unit_system(const QString& value)
{
- short int v = value == QStringLiteral("metric") ? METRIC :
- value == QStringLiteral("imperial")? IMPERIAL :
- PERSONALIZE;
- if (v == METRIC) {
+ set_unit_system(value == QStringLiteral("metric") ? METRIC : value == QStringLiteral("imperial")? IMPERIAL : PERSONALIZE);
+ emit instance()->unit_systemStringChanged(value);
+}
+void qPrefUnits::set_unit_system(unit_system_values value)
+{
+ if (value == METRIC) {
prefs.unit_system = METRIC;
prefs.units = SI_units;
- } else if (v == IMPERIAL) {
+ } else if (value == IMPERIAL) {
prefs.unit_system = IMPERIAL;
prefs.units = IMPERIAL_units;
} else {