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>
This commit is contained in:
Murillo Bernardes 2017-12-03 21:04:45 +08:00 committed by Dirk Hohndel
parent 4688ee8db0
commit fafffbb8df

View file

@ -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();