From 89b9a8337df5ce40c35f1dfc2fb158b0db60da0a Mon Sep 17 00:00:00 2001
From: Murillo Bernardes <mfbernardes@gmail.com>
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 <mfbernardes@gmail.com>
---
 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 <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();
-- 
2.13.6 (Apple Git-96)

