- BufferSettings bufferSettings;
- bufferSettings.enableUserStateIcons(ui.showUserStateIcons->isChecked());
-
- // Fonts
- QtUiStyleSettings fontSettings("Fonts");
- if(ui.demoInputLine->font() != QApplication::font())
- fontSettings.setValue("InputLine", ui.demoInputLine->font());
- else
- fontSettings.setValue("InputLine", "");
-
- if(ui.demoBufferView->font() != QApplication::font())
- fontSettings.setValue("BufferView", ui.demoBufferView->font());
- else
- fontSettings.setValue("BufferView", "");
-
- QTextCharFormat chatFormat = QtUi::style()->format(UiStyle::None);
- chatFormat.setFont(ui.demoChatView->font());
- QtUi::style()->setFormat(UiStyle::None, chatFormat, Settings::Custom);
+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();
+}