X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fappearancesettingspage.cpp;fp=src%2Fqtui%2Fsettingspages%2Fappearancesettingspage.cpp;h=6891c7441ecc96e99074668e2a485d64f5190b3d;hp=58178158898759bb874153f3d63c9bd642ff47bd;hb=0603a509f3a29006560197a7901624954a1671d6;hpb=11a1e4372551439769eafba3f3f5403adff763fb diff --git a/src/qtui/settingspages/appearancesettingspage.cpp b/src/qtui/settingspages/appearancesettingspage.cpp index 58178158..6891c744 100644 --- a/src/qtui/settingspages/appearancesettingspage.cpp +++ b/src/qtui/settingspages/appearancesettingspage.cpp @@ -46,6 +46,7 @@ AppearanceSettingsPage::AppearanceSettingsPage(QWidget *parent) initAutoWidgets(); initStyleComboBox(); initLanguageComboBox(); + initIconThemeComboBox(); foreach(QComboBox *comboBox, findChildren()) { connect(comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(widgetHasChanged())); @@ -98,6 +99,23 @@ void AppearanceSettingsPage::initLanguageComboBox() } } +void AppearanceSettingsPage::initIconThemeComboBox() +{ +#if defined WITH_OXYGEN || defined WITH_BREEZE || defined WITH_BREEZE_DARK +# if defined WITH_OXYGEN + ui.iconthemeComboBox->addItem(tr("Oxygen"), QVariant("oxygen")); +# endif +# if defined WITH_BREEZE + ui.iconthemeComboBox->addItem(tr("Breeze Light"), QVariant("breeze")); +# endif +# if defined WITH_BREEZE_DARK + ui.iconthemeComboBox->addItem(tr("Breeze Dark"), QVariant("breezedark")); +# endif +#else + ui.iconthemeComboBox->hide(); +#endif +} + void AppearanceSettingsPage::defaults() { @@ -134,6 +152,14 @@ void AppearanceSettingsPage::load() 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(); @@ -177,6 +203,15 @@ void AppearanceSettingsPage::save() } 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 = ui.useCustomStyleSheet->isChecked() != ui.useCustomStyleSheet->property("storedValue").toBool() || (ui.useCustomStyleSheet->isChecked() && ui.customStyleSheetPath->text() != ui.customStyleSheetPath->property("storedValue").toString()); @@ -230,6 +265,10 @@ QLocale AppearanceSettingsPage::selectedLocale() const return locale; } +QString AppearanceSettingsPage::selectedIconTheme() const +{ + return ui.iconthemeComboBox->itemData(ui.iconthemeComboBox->currentIndex()).toString(); +} void AppearanceSettingsPage::chooseStyleSheet() { @@ -255,6 +294,7 @@ bool AppearanceSettingsPage::testHasChanged() { if (ui.styleComboBox->currentIndex() != ui.styleComboBox->property("storedValue").toInt()) return true; if (ui.languageComboBox->currentIndex() != ui.languageComboBox->property("storedValue").toInt()) return true; + if (ui.iconthemeComboBox->currentIndex() != ui.iconthemeComboBox->property("storedValue").toInt()) return true; if (SettingsPage::hasChanged(ui.userNoticesInStatusBuffer)) return true; if (SettingsPage::hasChanged(ui.userNoticesInDefaultBuffer)) return true;