From 09e7fdc253aefcd05b2133d0745dceba34955247 Mon Sep 17 00:00:00 2001 From: Jocke Date: Sun, 16 Sep 2018 21:34:39 +0200 Subject: Mobile: git prefs overrules locale The unit types are set from system locale when the app starts. We need to explicitly set the units to match the unit system that is saved in the git repo. Or we end up with situations where the preferences and git say "metric" but the units are "imperial". Signed-off-by: Joakim Bygdell Signed-off-by: Dirk Hohndel --- mobile-widgets/qmlmanager.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index c2b993b0c..d6c00c870 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -38,6 +38,7 @@ #include "core/settings/qPrefLocationService.h" #include "core/settings/qPrefTechnicalDetails.h" #include "core/settings/qPrefPartialPressureGas.h" +#include "core/settings/qPrefUnit.h" QMLManager *QMLManager::m_instance = NULL; bool noCloudToCloud = false; @@ -278,12 +279,10 @@ void QMLManager::openLocalThenRemote(QString url) // if we can load from the cache, we know that we have a valid cloud account if (QMLPrefs::instance()->credentialStatus() == qPrefCloudStorage::CS_UNKNOWN) QMLPrefs::instance()->setCredentialStatus(qPrefCloudStorage::CS_VERIFIED); - prefs.unit_system = git_prefs.unit_system; if (git_prefs.unit_system == IMPERIAL) - git_prefs.units = IMPERIAL_units; + qPrefUnits::set_unit_system("imperial"); else if (git_prefs.unit_system == METRIC) - git_prefs.units = SI_units; - prefs.units = git_prefs.units; + qPrefUnits::set_unit_system("metric"); qPrefTechnicalDetails::set_tankbar(git_prefs.tankbar); qPrefTechnicalDetails::set_dcceiling(git_prefs.dcceiling); qPrefTechnicalDetails::set_show_ccr_setpoint(git_prefs.show_ccr_setpoint); -- cgit v1.2.3-70-g09d2