summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-09-20 12:35:49 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-09-20 12:35:49 -0700
commita31dd6c1c04016f5548411700ca3c03dd3f6f625 (patch)
tree422e7f077eb6c529f998d943c9bf3c839e33cd5d /core
parentc809a8873cd7e0a9df80d18a6273b227ae2177b4 (diff)
downloadsubsurface-a31dd6c1c04016f5548411700ca3c03dd3f6f625.tar.gz
Preferences: remember both the locale name and the user friendly text
Currently we are confused which it is we are looking at and so setting the language is broken. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r--core/pref.h1
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.cpp15
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.h1
3 files changed, 15 insertions, 2 deletions
diff --git a/core/pref.h b/core/pref.h
index 1e9002563..3d8076335 100644
--- a/core/pref.h
+++ b/core/pref.h
@@ -34,6 +34,7 @@ typedef struct {
typedef struct {
const char *language;
+ const char *lang_locale;
bool use_system_language;
} locale_prefs_t;
diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp
index 8c8762b65..42be027d6 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.cpp
+++ b/core/subsurface-qt/SettingsObjectWrapper.cpp
@@ -1636,8 +1636,8 @@ void UnitsSettings::setCoordinatesTraditional(bool value)
void UnitsSettings::setUnitSystem(const QString& value)
{
short int v = value == QStringLiteral("metric") ? METRIC
- : value == QStringLiteral("imperial")? IMPERIAL
- : PERSONALIZE;
+ : value == QStringLiteral("imperial")? IMPERIAL
+ : PERSONALIZE;
if (v == prefs.unit_system)
return;
@@ -1910,6 +1910,17 @@ void LanguageSettingsObjectWrapper::setUseSystemLanguage(bool value)
emit useSystemLanguageChanged(value);
}
+void LanguageSettingsObjectWrapper::setLangLocale(const QString &value)
+{
+ if (value == prefs.locale.lang_locale)
+ return;
+ QSettings s;
+ s.beginGroup(group);
+ s.setValue("UiLangLocale", value);
+ prefs.locale.lang_locale = copy_string(qPrintable(value));
+ // no need to emit languageChanged since we already do this for setLanguage
+}
+
void LanguageSettingsObjectWrapper::setLanguage(const QString& value)
{
if (value == prefs.locale.language)
diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h
index df9a13289..7edb74eb5 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.h
+++ b/core/subsurface-qt/SettingsObjectWrapper.h
@@ -603,6 +603,7 @@ public:
bool useSystemLanguage() const;
public slots:
+ void setLangLocale (const QString& value);
void setLanguage (const QString& value);
void setTimeFormat (const QString& value);
void setDateFormat (const QString& value);