Proper resetting of Aurorae on changes

Most settings don't require a reload of the decorations.
This commit is contained in:
Martin Gräßlin 2012-01-13 12:58:00 +01:00
parent 5f5499a74f
commit de72df5a90
3 changed files with 29 additions and 19 deletions

View file

@ -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<int>("BorderSize", KDecorationDefines::BorderNormal));
m_theme->setButtonSize((KDecorationDefines::BorderSize)themeGroup.readEntry<int>("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);
}

View file

@ -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();
}

View file

@ -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:
/**