mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix the logic when to display the "language changed" warning
If the user had never set up the language selection they could end up getting the "language changed, restart required" warning even if they didn't touch the language setting at all. This fixes that issue by assuming that UseSystemLanguage is true if the setting is undefined and only comparing the selected language if that selection actually matters (i.e., UseSystemLanguage is false). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
9f8db51c03
commit
76251c27da
2 changed files with 5 additions and 4 deletions
|
@ -92,7 +92,7 @@ void init_ui(int *argcp, char ***argvp)
|
|||
QLocale loc;
|
||||
|
||||
if (!s.value("UseSystemLanguage", true).toBool()){
|
||||
loc = QLocale(s.value("UiLanguage", QLocale().uiLanguages().first()).toString());
|
||||
loc = QLocale(s.value("UiLanguage", QLocale().uiLanguages().first()).toString());
|
||||
}
|
||||
|
||||
QString uiLang = loc.uiLanguages().first();
|
||||
|
|
|
@ -116,7 +116,7 @@ void PreferencesDialog::setUiFromPrefs()
|
|||
|
||||
QSettings s;
|
||||
s.beginGroup("Language");
|
||||
ui.languageSystemDefault->setChecked(s.value("UseSystemLanguage").toBool());
|
||||
ui.languageSystemDefault->setChecked(s.value("UseSystemLanguage", true).toBool());
|
||||
QAbstractItemModel *m = ui.languageView->model();
|
||||
QModelIndexList languages = m->match( m->index(0,0), Qt::UserRole, s.value("UiLanguage").toString());
|
||||
if (languages.count())
|
||||
|
@ -190,8 +190,9 @@ void PreferencesDialog::syncSettings()
|
|||
|
||||
QLocale loc;
|
||||
s.beginGroup("Language");
|
||||
if (s.value("UiLanguage").toString() != ui.languageView->currentIndex().data(Qt::UserRole) ||
|
||||
s.value("UseSystemLanguage").toBool() != ui.languageSystemDefault->isChecked()) {
|
||||
bool useSystemLang = s.value("UseSystemLanguage", true).toBool();
|
||||
if (useSystemLang != ui.languageSystemDefault->isChecked() ||
|
||||
(!useSystemLang && s.value("UiLanguage").toString() != ui.languageView->currentIndex().data(Qt::UserRole))) {
|
||||
QMessageBox::warning(mainWindow(), tr("Restart required"),
|
||||
tr("To correctly load a new language you must restart Subsurface."));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue