summaryrefslogtreecommitdiffstats
path: root/qt-ui/preferences.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-12-06 17:48:38 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-06 11:58:29 -0800
commit9b7b477d7cc868212045a78b30089363cbebcf91 (patch)
tree2d8a00b88f4a7637cb1920c0c629ff581e679ff1 /qt-ui/preferences.cpp
parent7436178fe0817a4c5defac28f1a395d84cf539b5 (diff)
downloadsubsurface-9b7b477d7cc868212045a78b30089363cbebcf91.tar.gz
Added 'English' and 'Use System Default' options.
These complete the ability to select languages from the preferences panel. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/preferences.cpp')
-rw-r--r--qt-ui/preferences.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
index 45777d320..930a263a1 100644
--- a/qt-ui/preferences.cpp
+++ b/qt-ui/preferences.cpp
@@ -114,10 +114,11 @@ void PreferencesDialog::setUiFromPrefs()
QSettings s;
s.beginGroup("Language");
- QAbstractItemModel *m = ui.languageView->model();
- QModelIndexList languages = m->match( m->index(0,0), Qt::DisplayRole, s.value("UiLanguage").toString());
- if (languages.count())
- ui.languageView->setCurrentIndex(languages.first());
+ ui.languageSystemDefault->setChecked(s.value("UseSystemLanguage").toBool());
+ QAbstractItemModel *m = ui.languageView->model();
+ QModelIndexList languages = m->match( m->index(0,0), Qt::UserRole, s.value("UiLanguage").toString());
+ if (languages.count())
+ ui.languageView->setCurrentIndex(languages.first());
}
void PreferencesDialog::restorePrefs()
@@ -187,10 +188,12 @@ void PreferencesDialog::syncSettings()
QLocale loc;
s.beginGroup("Language");
- if (s.value("UiLanguage").toString() != ui.languageView->currentIndex().data(Qt::UserRole)){
+ if (s.value("UiLanguage").toString() != ui.languageView->currentIndex().data(Qt::UserRole) ||
+ s.value("UseSystemLanguage").toBool() != ui.languageSystemDefault->isChecked()) {
QMessageBox::warning(mainWindow(), tr("Restart required"),
tr("To correctly load a new language you must restart Subsurface."));
}
+ s.setValue("UseSystemLanguage", ui.languageSystemDefault->isChecked());
s.setValue("UiLanguage", ui.languageView->currentIndex().data(Qt::UserRole));
emit settingsChanged();