Add icon property and changed signal to KDecoration

Replaces the pure virtual method which the Decoration had to
implement. Instead the Decoration can now connect to the signal.

For KCommonDecoration there is no change at all except that the
invoked method is turned into a slot.
This commit is contained in:
Martin Gräßlin 2013-08-23 17:14:52 +02:00
parent 63bb36e2ad
commit 22e4476777
8 changed files with 8 additions and 19 deletions

View file

@ -428,6 +428,7 @@ void Client::createDecoration(const QRect& oldgeom)
} else {
decoration = decorationPlugin()->createDecoration(bridge);
}
connect(this, &Client::iconChanged, decoration, &KDecoration::iconChanged);
connect(this, &Client::shadeChanged, decoration, &KDecoration::shadeChanged);
connect(this, &Client::desktopChanged, decoration, &KDecoration::desktopChanged);
connect(this, &Client::captionChanged, decoration, &KDecoration::captionChanged);

View file

@ -306,11 +306,6 @@ bool AuroraeClient::eventFilter(QObject *object, QEvent *event)
return false;
}
void AuroraeClient::iconChange()
{
emit iconChanged();
}
void AuroraeClient::maximizeChange()
{
emit maximizeChanged();

View file

@ -89,7 +89,6 @@ class AuroraeClient : public KDecoration
Q_OBJECT
Q_PROPERTY(QRect geometry READ geometry)
Q_PROPERTY(int height READ height)
Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged)
Q_PROPERTY(bool closeable READ isCloseable CONSTANT)
Q_PROPERTY(bool maximizeable READ isMaximizable CONSTANT)
Q_PROPERTY(bool minimizeable READ isMinimizable CONSTANT)
@ -114,7 +113,6 @@ public:
virtual ~AuroraeClient();
virtual bool eventFilter(QObject *object, QEvent *event);
virtual void borders(int& left, int& right, int& top, int& bottom) const;
virtual void iconChange();
virtual void init();
virtual void maximizeChange();
virtual QSize minimumSize() const;
@ -130,7 +128,6 @@ public:
Q_INVOKABLE QVariant readConfig(const QString &key, const QVariant &defaultValue = QVariant());
Q_SIGNALS:
void iconChanged();
void maximizeChanged();
void keepAboveChangedWrapper();
void keepBelowChangedWrapper();

View file

@ -61,6 +61,7 @@ KCommonDecoration::KCommonDecoration(KDecorationBridge* bridge, KDecorationFacto
connect(wrapper, &KDecoration::captionChanged, this, &KCommonDecoration::captionChange);
connect(wrapper, &KDecoration::desktopChanged, this, &KCommonDecoration::desktopChange);
connect(wrapper, &KDecoration::shadeChanged, this, &KCommonDecoration::shadeChange);
connect(wrapper, &KDecoration::iconChanged, this, &KCommonDecoration::iconChange);
}
KCommonDecoration::~KCommonDecoration()

View file

@ -257,12 +257,12 @@ public:
virtual void resize(const QSize& s);
virtual QSize minimumSize() const;
virtual void maximizeChange();
virtual void iconChange();
public Q_SLOTS:
virtual void activeChange();
virtual void captionChange();
virtual void desktopChange();
virtual void shadeChange();
virtual void iconChange();
void keepAboveChange(bool above);
void keepBelowChange(bool below);
void slotMaximize();

View file

@ -68,11 +68,6 @@ QSize KCommonDecorationWrapper::minimumSize() const
return decoration->minimumSize();
}
void KCommonDecorationWrapper::iconChange()
{
return decoration->iconChange();
}
void KCommonDecorationWrapper::maximizeChange()
{
return decoration->maximizeChange();

View file

@ -49,7 +49,6 @@ public:
virtual void borders(int& left, int& right, int& top, int& bottom) const;
virtual void resize(const QSize& s);
virtual QSize minimumSize() const;
virtual void iconChange();
virtual void maximizeChange();
virtual bool drawbound(const QRect& geom, bool clear);
virtual bool windowDocked(Position side);

View file

@ -495,6 +495,7 @@ class KWIN_EXPORT KDecoration
Q_PROPERTY(int desktop READ desktop WRITE setDesktop NOTIFY desktopChanged)
Q_PROPERTY(bool onAllDesktops READ isOnAllDesktops NOTIFY desktopChanged)
Q_PROPERTY(bool setShade READ isSetShade NOTIFY shadeChanged)
Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged)
public:
/**
* Constructs a KDecoration object. Both the arguments are passed from
@ -819,10 +820,6 @@ public:
virtual QSize minimumSize() const = 0;
public Q_SLOTS:
/**
* This function is called whenever the window icon changes. Use icon() to get it.
*/
virtual void iconChange() = 0;
/**
* This function is called whenever the maximalization state of the window changes.
* Use maximizeMode() to get the current state.
@ -850,6 +847,10 @@ Q_SIGNALS:
* isShade() to get the current state.
*/
void shadeChanged();
/**
* This signal is emitted whenever the window icon changes. Use icon() to get it.
*/
void iconChanged();
/**
* This signal is emitted whenever the window's keep-above state changes.
*/