+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 =
+ ui.useCustomStyleSheet->isChecked() != ui.useCustomStyleSheet->property("storedValue").toBool()
+ || (ui.useCustomStyleSheet->isChecked() && ui.customStyleSheetPath->text() != ui.customStyleSheetPath->property("storedValue").toString());
+
+ BufferSettings bufferSettings;
+ int redirectTarget = 0;
+ if (ui.userNoticesInDefaultBuffer->isChecked())
+ redirectTarget |= BufferSettings::DefaultBuffer;
+ if (ui.userNoticesInStatusBuffer->isChecked())
+ redirectTarget |= BufferSettings::StatusBuffer;
+ if (ui.userNoticesInCurrentBuffer->isChecked())
+ redirectTarget |= BufferSettings::CurrentBuffer;
+ bufferSettings.setUserNoticesTarget(redirectTarget);
+
+ redirectTarget = 0;
+ if (ui.serverNoticesInDefaultBuffer->isChecked())
+ redirectTarget |= BufferSettings::DefaultBuffer;
+ if (ui.serverNoticesInStatusBuffer->isChecked())
+ redirectTarget |= BufferSettings::StatusBuffer;
+ if (ui.serverNoticesInCurrentBuffer->isChecked())
+ redirectTarget |= BufferSettings::CurrentBuffer;
+ bufferSettings.setServerNoticesTarget(redirectTarget);
+
+ redirectTarget = 0;
+ if (ui.errorMsgsInDefaultBuffer->isChecked())
+ redirectTarget |= BufferSettings::DefaultBuffer;
+ if (ui.errorMsgsInStatusBuffer->isChecked())
+ redirectTarget |= BufferSettings::StatusBuffer;
+ if (ui.errorMsgsInCurrentBuffer->isChecked())
+ redirectTarget |= BufferSettings::CurrentBuffer;
+ bufferSettings.setErrorMsgsTarget(redirectTarget);
+
+ SettingsPage::save();
+ setChangedState(false);
+ if (needsStyleReload)
+ QtUi::style()->reload();
+}