X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fappearancesettingspage.cpp;h=228fe40391888a51fe6fb7ccd75179dadef16ec9;hp=ab39344aa43dd46a2f8d39a6975cbaefadc70db2;hb=d7832127ff8412b09d9fa4e56570d8a890abcbbe;hpb=16b5271810620055f776d3b09f042451a108468f diff --git a/src/qtui/settingspages/appearancesettingspage.cpp b/src/qtui/settingspages/appearancesettingspage.cpp index ab39344a..228fe403 100644 --- a/src/qtui/settingspages/appearancesettingspage.cpp +++ b/src/qtui/settingspages/appearancesettingspage.cpp @@ -20,23 +20,16 @@ #include "appearancesettingspage.h" -#include "buffersettings.h" -#include "chatviewsettings.h" #include "qtui.h" #include "qtuisettings.h" #include "qtuistyle.h" -#include "util.h" #include -#include #include -#include -#include #include AppearanceSettingsPage::AppearanceSettingsPage(QWidget *parent) - : SettingsPage(tr("Interface"), QString(), parent), - _fontsChanged(false) + : SettingsPage(tr("Interface"), QString(), parent) { ui.setupUi(this); initAutoWidgets(); @@ -50,13 +43,6 @@ AppearanceSettingsPage::AppearanceSettingsPage(QWidget *parent) connect(checkBox, SIGNAL(clicked()), this, SLOT(widgetHasChanged())); } - mapper = new QSignalMapper(this); - connect(mapper, SIGNAL(mapped(QWidget *)), this, SLOT(chooseFont(QWidget *))); - - connect(ui.chooseInputLine, SIGNAL(clicked()), mapper, SLOT(map())); - - mapper->setMapping(ui.chooseInputLine, ui.demoInputLine); - connect(ui.chooseStyleSheet, SIGNAL(clicked()), SLOT(chooseStyleSheet())); } @@ -83,9 +69,6 @@ void AppearanceSettingsPage::initLanguageComboBox() { void AppearanceSettingsPage::defaults() { ui.styleComboBox->setCurrentIndex(0); - loadFonts(Settings::Default); - _fontsChanged = true; - SettingsPage::defaults(); widgetHasChanged(); } @@ -114,23 +97,10 @@ void AppearanceSettingsPage::load() { ui.languageComboBox->setProperty("storedValue", ui.languageComboBox->currentIndex()); Quassel::loadTranslation(selectedLocale()); - loadFonts(Settings::Custom); - SettingsPage::load(); setChangedState(false); } -void AppearanceSettingsPage::loadFonts(Settings::Mode mode) { - QtUiStyleSettings s("Fonts"); - - QFont inputLineFont; - if(mode == Settings::Custom) - inputLineFont = s.value("InputLine", QFont()).value(); - setFont(ui.demoInputLine, inputLineFont); - - _fontsChanged = false; -} - void AppearanceSettingsPage::save() { QtUiSettings uiSettings; @@ -146,15 +116,6 @@ void AppearanceSettingsPage::save() { uiSettings.setValue("Locale", selectedLocale()); } - // Fonts - QtUiStyleSettings fontSettings("Fonts"); - if(ui.demoInputLine->font() != QApplication::font()) - fontSettings.setValue("InputLine", ui.demoInputLine->font()); - else - fontSettings.setValue("InputLine", ""); - - _fontsChanged = false; - bool needsStyleReload = ui.useCustomStyleSheet->isChecked() != ui.useCustomStyleSheet->property("storedValue").toBool() || (ui.useCustomStyleSheet->isChecked() && ui.customStyleSheetPath->text() != ui.customStyleSheetPath->property("storedValue").toString()); @@ -178,26 +139,6 @@ QLocale AppearanceSettingsPage::selectedLocale() const { return locale; } -void AppearanceSettingsPage::setFont(QLabel *label, const QFont &font_) { - QFont font = font_; - if(font.family().isEmpty()) - font = QApplication::font(); - label->setFont(font); - label->setText(QString("%1 %2").arg(font.family()).arg(font.pointSize())); - widgetHasChanged(); -} - -void AppearanceSettingsPage::chooseFont(QWidget *widget) { - QLabel *label = qobject_cast(widget); - Q_ASSERT(label); - bool ok; - QFont font = QFontDialog::getFont(&ok, label->font()); - if(ok) { - _fontsChanged = true; - setFont(label, font); - } -} - void AppearanceSettingsPage::chooseStyleSheet() { QString name = QFileDialog::getOpenFileName(this, tr("Please choose a stylesheet file"), QString(), "*.qss"); if(!name.isEmpty()) @@ -209,8 +150,6 @@ void AppearanceSettingsPage::widgetHasChanged() { } bool AppearanceSettingsPage::testHasChanged() { - if(_fontsChanged) return true; // comparisons are nasty for now - if(ui.styleComboBox->currentIndex() != ui.styleComboBox->property("storedValue").toInt()) return true; if(selectedLocale() != QLocale()) return true; // QLocale() returns the default locale (manipulated via loadTranslation())