From fafffbb8df7922b93afc5a9fb56b44d08330cbfa Mon Sep 17 00:00:00 2001 From: Murillo Bernardes Date: Sun, 3 Dec 2017 21:04:45 +0800 Subject: [PATCH] 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 Signed-off-by: Dirk Hohndel --- subsurface-mobile-main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 #include #include +#include #include 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();