#include <QStyleFactory>
AppearanceSettingsPage::AppearanceSettingsPage(QWidget *parent)
- : SettingsPage(tr("Appearance"), QString(), parent)
+ : SettingsPage(tr("Appearance"), QString(), parent),
+ _fontsChanged(false)
{
ui.setupUi(this);
initStyleComboBox();
loadFonts(Settings::Default);
_fontsChanged = true;
+
+ ui.showWebPreview->setChecked(true);
+ ui.showUserStateIcons->setChecked(true);
+
widgetHasChanged();
}
QtUiSettings uiSettings;
// Gui Style
- settings["Style"] = uiSettings.value("Style", QString(""));
- if(settings["Style"].toString() == "") {
+ QString style = uiSettings.value("Style", QString("")).toString();
+ if(style.isEmpty()) {
ui.styleComboBox->setCurrentIndex(0);
} else {
- ui.styleComboBox->setCurrentIndex(ui.styleComboBox->findText(settings["Style"].toString(), Qt::MatchExactly));
- QApplication::setStyle(settings["Style"].toString());
+ ui.styleComboBox->setCurrentIndex(ui.styleComboBox->findText(style, Qt::MatchExactly));
+ QApplication::setStyle(style);
}
+ ui.styleComboBox->setProperty("storedValue", ui.styleComboBox->currentIndex());
// Language
QLocale locale = uiSettings.value("Locale", QLocale::system()).value<QLocale>();
ui.languageComboBox->setCurrentIndex(1);
else
ui.languageComboBox->setCurrentIndex(ui.languageComboBox->findText(QLocale::languageToString(locale.language()), Qt::MatchExactly));
+ ui.languageComboBox->setProperty("storedValue", ui.languageComboBox->currentIndex());
Quassel::loadTranslation(selectedLocale());
ChatViewSettings chatViewSettings;
bufferViewFont = s.value("BufferView", QFont()).value<QFont>();
setFont(ui.demoBufferView, bufferViewFont);
- QTextCharFormat chatFormat = QtUi::style()->format(UiStyle::None, mode);
- setFont(ui.demoChatView, chatFormat.font());
+ //QTextCharFormat chatFormat = QtUi::style()->cachedFormat(UiStyle::None, 0); // FIXME
+ //setFont(ui.demoChatView, chatFormat.font());
_fontsChanged = false;
}
else
fontSettings.setValue("BufferView", "");
- QTextCharFormat chatFormat = QtUi::style()->format(UiStyle::None);
- chatFormat.setFont(ui.demoChatView->font());
- QtUi::style()->setFormat(UiStyle::None, chatFormat, Settings::Custom);
+ //QTextCharFormat chatFormat = QtUi::style()->format(UiStyle::None);
+ //chatFormat.setFont(ui.demoChatView->font());
+ //QtUi::style()->setFormat(UiStyle::None, chatFormat, Settings::Custom);
_fontsChanged = false;
bool ok;
QFont font = QFontDialog::getFont(&ok, label->font());
if(ok) {
- setFont(label, font);
_fontsChanged = true;
+ setFont(label, font);
}
}
bool AppearanceSettingsPage::testHasChanged() {
if(_fontsChanged) return true; // comparisons are nasty for now
- if(settings["Style"].toString() != ui.styleComboBox->currentText()) return true;
+ if(ui.styleComboBox->currentIndex() != ui.styleComboBox->property("storedValue").toInt()) return true;
+
if(selectedLocale() != QLocale()) return true; // QLocale() returns the default locale (manipulated via loadTranslation())
if(SettingsPage::hasChanged(ui.showWebPreview)) return true;