-void AppearanceSettingsPage::save() {
- QtUiSettings uiSettings;
-
- if(ui.styleComboBox->currentIndex() < 1) {
- uiSettings.setValue("Style", QString(""));
- } else {
- uiSettings.setValue("Style", ui.styleComboBox->currentText());
- QApplication::setStyle(ui.styleComboBox->currentText());
- }
- ui.styleComboBox->setProperty("storedValue", ui.styleComboBox->currentIndex());
-
- if(ui.languageComboBox->currentIndex() == 1) {
- uiSettings.remove("Locale"); // force the default (QLocale::system())
- } else {
- uiSettings.setValue("Locale", selectedLocale());
- }
- ui.languageComboBox->setProperty("storedValue", ui.languageComboBox->currentIndex());
-
- bool needsStyleReload =
+
+void AppearanceSettingsPage::load()
+{
+ QtUiSettings uiSettings;
+
+ // Gui Style
+ QString style = uiSettings.value("Style", QString("")).toString();
+ if (style.isEmpty()) {
+ ui.styleComboBox->setCurrentIndex(0);
+ }
+ else {
+ ui.styleComboBox->setCurrentIndex(ui.styleComboBox->findText(style, Qt::MatchExactly));
+ }
+ ui.styleComboBox->setProperty("storedValue", ui.styleComboBox->currentIndex());
+
+ // Language
+ QLocale locale = uiSettings.value("Locale", QLocale::system()).value<QLocale>();
+ if (locale == QLocale::system())
+ ui.languageComboBox->setCurrentIndex(1);
+ else if (locale.language() == QLocale::C) // we use C for "untranslated"
+ ui.languageComboBox->setCurrentIndex(0);
+ else
+ ui.languageComboBox->setCurrentIndex(ui.languageComboBox->findText(QLocale::languageToString(locale.language()), Qt::MatchExactly));
+ ui.languageComboBox->setProperty("storedValue", ui.languageComboBox->currentIndex());
+ Quassel::loadTranslation(selectedLocale());
+
+ // IconTheme
+ QString icontheme = uiSettings.value("IconTheme", QVariant("")).toString();
+ if (icontheme == "")
+ ui.iconthemeComboBox->setCurrentIndex(0);
+ else
+ ui.iconthemeComboBox->setCurrentIndex(ui.iconthemeComboBox->findData(icontheme));
+ ui.iconthemeComboBox->setProperty("storedValue", ui.iconthemeComboBox->currentIndex());
+
+ // bufferSettings:
+ BufferSettings bufferSettings;
+ int redirectTarget = bufferSettings.userNoticesTarget();
+ SettingsPage::load(ui.userNoticesInDefaultBuffer, redirectTarget & BufferSettings::DefaultBuffer);
+ SettingsPage::load(ui.userNoticesInStatusBuffer, redirectTarget & BufferSettings::StatusBuffer);
+ SettingsPage::load(ui.userNoticesInCurrentBuffer, redirectTarget & BufferSettings::CurrentBuffer);
+
+ redirectTarget = bufferSettings.serverNoticesTarget();
+ SettingsPage::load(ui.serverNoticesInDefaultBuffer, redirectTarget & BufferSettings::DefaultBuffer);
+ SettingsPage::load(ui.serverNoticesInStatusBuffer, redirectTarget & BufferSettings::StatusBuffer);
+ SettingsPage::load(ui.serverNoticesInCurrentBuffer, redirectTarget & BufferSettings::CurrentBuffer);
+
+ redirectTarget = bufferSettings.errorMsgsTarget();
+ SettingsPage::load(ui.errorMsgsInDefaultBuffer, redirectTarget & BufferSettings::DefaultBuffer);
+ SettingsPage::load(ui.errorMsgsInStatusBuffer, redirectTarget & BufferSettings::StatusBuffer);
+ SettingsPage::load(ui.errorMsgsInCurrentBuffer, redirectTarget & BufferSettings::CurrentBuffer);
+
+ SettingsPage::load();
+ setChangedState(false);
+}
+
+
+void AppearanceSettingsPage::save()
+{
+ QtUiSettings uiSettings;
+
+ if (ui.styleComboBox->currentIndex() < 1) {
+ uiSettings.setValue("Style", QString(""));
+ }
+ else {
+ uiSettings.setValue("Style", ui.styleComboBox->currentText());
+ QApplication::setStyle(ui.styleComboBox->currentText());
+ }
+ ui.styleComboBox->setProperty("storedValue", ui.styleComboBox->currentIndex());
+
+ if (ui.languageComboBox->currentIndex() == 1) {
+ uiSettings.remove("Locale"); // force the default (QLocale::system())
+ }
+ else {
+ uiSettings.setValue("Locale", selectedLocale());
+ }
+ ui.languageComboBox->setProperty("storedValue", ui.languageComboBox->currentIndex());
+
+ if (selectedIconTheme()=="") {
+ uiSettings.remove("IconTheme");
+ }
+ else {
+ uiSettings.setValue("IconTheme", selectedIconTheme());
+ QIcon::setThemeName(selectedIconTheme());
+ }
+ ui.iconthemeComboBox->setProperty("storedValue", ui.iconthemeComboBox->currentIndex());
+
+ bool needsStyleReload =