Settings update: Fix missing groups and Language initialization

There's one function named uiLanguage() that should return
the current uiLanguage() that subsurface is running, but
it actually sets a whole lot of preferences, I think
that the general idea of that function is okay, but it seems
broken for me.

still, I used it to load the correct language from the preferences
since it's what this function is currently doing right now.

Also, a lot of missing groups where added.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2016-08-27 22:13:33 -03:00 committed by Dirk Hohndel
parent 270864d073
commit 0a6f6b4382
3 changed files with 21 additions and 4 deletions

View file

@ -481,6 +481,9 @@ extern "C" const char *subsurface_user_agent()
return strdup(qPrintable(uA));
}
/* TOOD: Move this to SettingsObjectWrapper, and also fix this complexity.
* gezus.
*/
QString uiLanguage(QLocale *callerLoc)
{
QString shortDateFormat;
@ -489,6 +492,7 @@ QString uiLanguage(QLocale *callerLoc)
QSettings s;
QVariant v;
s.beginGroup("Language");
GET_BOOL("UseSystemLanguage", locale.use_system_language);
if (!s.value("UseSystemLanguage", true).toBool()) {
loc = QLocale(s.value("UiLanguage", QLocale().uiLanguages().first()).toString());