mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
c809a8873c
commit
a31dd6c1c0
3 changed files with 15 additions and 2 deletions
|
@ -34,6 +34,7 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *language;
|
const char *language;
|
||||||
|
const char *lang_locale;
|
||||||
bool use_system_language;
|
bool use_system_language;
|
||||||
} locale_prefs_t;
|
} locale_prefs_t;
|
||||||
|
|
||||||
|
|
|
@ -1636,8 +1636,8 @@ void UnitsSettings::setCoordinatesTraditional(bool value)
|
||||||
void UnitsSettings::setUnitSystem(const QString& value)
|
void UnitsSettings::setUnitSystem(const QString& value)
|
||||||
{
|
{
|
||||||
short int v = value == QStringLiteral("metric") ? METRIC
|
short int v = value == QStringLiteral("metric") ? METRIC
|
||||||
: value == QStringLiteral("imperial")? IMPERIAL
|
: value == QStringLiteral("imperial")? IMPERIAL
|
||||||
: PERSONALIZE;
|
: PERSONALIZE;
|
||||||
|
|
||||||
if (v == prefs.unit_system)
|
if (v == prefs.unit_system)
|
||||||
return;
|
return;
|
||||||
|
@ -1910,6 +1910,17 @@ void LanguageSettingsObjectWrapper::setUseSystemLanguage(bool value)
|
||||||
emit useSystemLanguageChanged(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)
|
void LanguageSettingsObjectWrapper::setLanguage(const QString& value)
|
||||||
{
|
{
|
||||||
if (value == prefs.locale.language)
|
if (value == prefs.locale.language)
|
||||||
|
|
|
@ -603,6 +603,7 @@ public:
|
||||||
bool useSystemLanguage() const;
|
bool useSystemLanguage() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void setLangLocale (const QString& value);
|
||||||
void setLanguage (const QString& value);
|
void setLanguage (const QString& value);
|
||||||
void setTimeFormat (const QString& value);
|
void setTimeFormat (const QString& value);
|
||||||
void setDateFormat (const QString& value);
|
void setDateFormat (const QString& value);
|
||||||
|
|
Loading…
Add table
Reference in a new issue