diff --git a/clients/aurorae/src/aurorae.cpp b/clients/aurorae/src/aurorae.cpp index 466d00409c..352f751126 100644 --- a/clients/aurorae/src/aurorae.cpp +++ b/clients/aurorae/src/aurorae.cpp @@ -85,8 +85,17 @@ bool AuroraeFactory::reset(unsigned long changed) if (changed & SettingButtons) { emit buttonsChanged(); } - init(); - resetDecorations(changed); + const KConfig conf("auroraerc"); + const KConfigGroup group(&conf, "Engine"); + const QString themeName = group.readEntry("ThemeName", "example-deco"); + const KConfig config("aurorae/themes/" + themeName + '/' + themeName + "rc", KConfig::FullConfig, "data"); + const KConfigGroup themeGroup(&conf, themeName); + if (themeName != m_theme->themeName()) { + m_theme->loadTheme(themeName, config); + resetDecorations(changed); + } + m_theme->setBorderSize((KDecorationDefines::BorderSize)themeGroup.readEntry("BorderSize", KDecorationDefines::BorderNormal)); + m_theme->setButtonSize((KDecorationDefines::BorderSize)themeGroup.readEntry("ButtonSize", KDecorationDefines::BorderNormal)); return false; // need hard reset } @@ -332,15 +341,6 @@ KDecorationDefines::Position AuroraeClient::mousePosition(const QPoint &point) c void AuroraeClient::reset(long unsigned int changed) { - if (changed & SettingCompositing) { - AuroraeFactory::instance()->theme()->setCompositingActive(compositingActive()); - } - if (changed & SettingButtons) { - // TODO: update buttons - } - if (changed & SettingFont) { - // TODO: set font - } KDecoration::reset(changed); } diff --git a/clients/aurorae/src/lib/auroraetheme.cpp b/clients/aurorae/src/lib/auroraetheme.cpp index bc1d5d710f..0b199b3321 100644 --- a/clients/aurorae/src/lib/auroraetheme.cpp +++ b/clients/aurorae/src/lib/auroraetheme.cpp @@ -84,6 +84,8 @@ AuroraeTheme::AuroraeTheme(QObject* parent) : QObject(parent) , d(new AuroraeThemePrivate) { + connect(this, SIGNAL(themeChanged()), SIGNAL(borderSizesChanged())); + connect(this, SIGNAL(buttonSizesChanged()), SIGNAL(borderSizesChanged())); } AuroraeTheme::~AuroraeTheme() @@ -455,11 +457,18 @@ QString AuroraeTheme::defaultButtonsRight() const void AuroraeTheme::setBorderSize(KDecorationDefines::BorderSize size) { + if (d->borderSize == size) { + return; + } d->borderSize = size; + emit borderSizesChanged(); } void AuroraeTheme::setButtonSize(KDecorationDefines::BorderSize size) { + if (d->buttonSize == size) { + return; + } d->buttonSize = size; emit buttonSizesChanged(); } diff --git a/clients/aurorae/src/lib/auroraetheme.h b/clients/aurorae/src/lib/auroraetheme.h index 3dfd2138aa..3705932b7b 100644 --- a/clients/aurorae/src/lib/auroraetheme.h +++ b/clients/aurorae/src/lib/auroraetheme.h @@ -55,14 +55,14 @@ enum DecorationPosition { class /*LIBAURORAE_EXPORT*/ AuroraeTheme : public QObject { Q_OBJECT - Q_PROPERTY(int borderLeft READ leftBorder NOTIFY themeChanged) - Q_PROPERTY(int borderRight READ rightBorder NOTIFY themeChanged) - Q_PROPERTY(int borderTop READ topBorder NOTIFY themeChanged) - Q_PROPERTY(int borderBottom READ bottomBorder NOTIFY themeChanged) - Q_PROPERTY(int borderLeftMaximized READ leftBorderMaximized NOTIFY themeChanged) - Q_PROPERTY(int borderRightMaximized READ rightBorderMaximized NOTIFY themeChanged) - Q_PROPERTY(int borderTopMaximized READ topBorderMaximized NOTIFY themeChanged) - Q_PROPERTY(int borderBottomMaximized READ bottomBorderMaximized NOTIFY themeChanged) + Q_PROPERTY(int borderLeft READ leftBorder NOTIFY borderSizesChanged) + Q_PROPERTY(int borderRight READ rightBorder NOTIFY borderSizesChanged) + Q_PROPERTY(int borderTop READ topBorder NOTIFY borderSizesChanged) + Q_PROPERTY(int borderBottom READ bottomBorder NOTIFY borderSizesChanged) + Q_PROPERTY(int borderLeftMaximized READ leftBorderMaximized NOTIFY borderSizesChanged) + Q_PROPERTY(int borderRightMaximized READ rightBorderMaximized NOTIFY borderSizesChanged) + Q_PROPERTY(int borderTopMaximized READ topBorderMaximized NOTIFY borderSizesChanged) + Q_PROPERTY(int borderBottomMaximized READ bottomBorderMaximized NOTIFY borderSizesChanged) Q_PROPERTY(int paddingLeft READ paddingLeft NOTIFY themeChanged) Q_PROPERTY(int paddingRight READ paddingRight NOTIFY themeChanged) Q_PROPERTY(int paddingTop READ paddingTop NOTIFY themeChanged) @@ -203,6 +203,7 @@ public Q_SLOTS: Q_SIGNALS: void themeChanged(); void buttonSizesChanged(); + void borderSizesChanged(); private: /**