aboutsummaryrefslogtreecommitdiffstats
path: root/subsurface-mobile-main.cpp
diff options
context:
space:
mode:
authorGravatar Murillo Bernardes <mfbernardes@gmail.com>2017-12-03 21:04:45 +0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-12-03 11:33:30 -0800
commitfafffbb8df7922b93afc5a9fb56b44d08330cbfa (patch)
tree0b43185d3125d7211700d8266b98edd946e9d7cb /subsurface-mobile-main.cpp
parent4688ee8db0ed9e2b7c6b0f4e0edfaabc311c9491 (diff)
downloadsubsurface-fafffbb8df7922b93afc5a9fb56b44d08330cbfa.tar.gz
Use QLocale to identify unit system
Identifying unit system ends up being more complex than just checking language for -US. Some users might use US English, but prefer the metric system. Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-mobile-main.cpp')
-rw-r--r--subsurface-mobile-main.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/subsurface-mobile-main.cpp b/subsurface-mobile-main.cpp
index 63add7c50..03a28e5e8 100644
--- a/subsurface-mobile-main.cpp
+++ b/subsurface-mobile-main.cpp
@@ -17,6 +17,7 @@
#include <QStringList>
#include <QApplication>
#include <QLoggingCategory>
+#include <QLocale>
#include <git2.h>
int main(int argc, char **argv)
@@ -39,7 +40,9 @@ int main(int argc, char **argv)
}
git_libgit2_init();
setup_system_prefs();
- if (uiLanguage(0).contains("-US"))
+ if (QLocale().measurementSystem() == QLocale::MetricSystem)
+ default_prefs.units = SI_units;
+ else
default_prefs.units = IMPERIAL_units;
copy_prefs(&default_prefs, &prefs);
fill_profile_color();