From 22e44767774d70a2743c749d6db0ad66f24cd791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 23 Aug 2013 17:14:52 +0200 Subject: [PATCH] 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. --- client.cpp | 1 + clients/aurorae/src/aurorae.cpp | 5 ----- clients/aurorae/src/aurorae.h | 3 --- libkdecorations/kcommondecoration.cpp | 1 + libkdecorations/kcommondecoration.h | 2 +- libkdecorations/kcommondecoration_p.cpp | 5 ----- libkdecorations/kcommondecoration_p.h | 1 - libkdecorations/kdecoration.h | 9 +++++---- 8 files changed, 8 insertions(+), 19 deletions(-) diff --git a/client.cpp b/client.cpp index d74cdff361..19a88d2649 100644 --- a/client.cpp +++ b/client.cpp @@ -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); diff --git a/clients/aurorae/src/aurorae.cpp b/clients/aurorae/src/aurorae.cpp index bcacd3dcc2..dc9d3c4dae 100644 --- a/clients/aurorae/src/aurorae.cpp +++ b/clients/aurorae/src/aurorae.cpp @@ -306,11 +306,6 @@ bool AuroraeClient::eventFilter(QObject *object, QEvent *event) return false; } -void AuroraeClient::iconChange() -{ - emit iconChanged(); -} - void AuroraeClient::maximizeChange() { emit maximizeChanged(); diff --git a/clients/aurorae/src/aurorae.h b/clients/aurorae/src/aurorae.h index 32513f2192..c39febea96 100644 --- a/clients/aurorae/src/aurorae.h +++ b/clients/aurorae/src/aurorae.h @@ -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(); diff --git a/libkdecorations/kcommondecoration.cpp b/libkdecorations/kcommondecoration.cpp index 84c1ae1461..8f5440be72 100644 --- a/libkdecorations/kcommondecoration.cpp +++ b/libkdecorations/kcommondecoration.cpp @@ -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() diff --git a/libkdecorations/kcommondecoration.h b/libkdecorations/kcommondecoration.h index f9ab4a4f96..d77a8de501 100644 --- a/libkdecorations/kcommondecoration.h +++ b/libkdecorations/kcommondecoration.h @@ -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(); diff --git a/libkdecorations/kcommondecoration_p.cpp b/libkdecorations/kcommondecoration_p.cpp index 477f2ee2fc..2bc8427d6f 100644 --- a/libkdecorations/kcommondecoration_p.cpp +++ b/libkdecorations/kcommondecoration_p.cpp @@ -68,11 +68,6 @@ QSize KCommonDecorationWrapper::minimumSize() const return decoration->minimumSize(); } -void KCommonDecorationWrapper::iconChange() -{ - return decoration->iconChange(); -} - void KCommonDecorationWrapper::maximizeChange() { return decoration->maximizeChange(); diff --git a/libkdecorations/kcommondecoration_p.h b/libkdecorations/kcommondecoration_p.h index 8a0246eb5e..494e9f4c04 100644 --- a/libkdecorations/kcommondecoration_p.h +++ b/libkdecorations/kcommondecoration_p.h @@ -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); diff --git a/libkdecorations/kdecoration.h b/libkdecorations/kdecoration.h index e367d50d89..524871a6d4 100644 --- a/libkdecorations/kdecoration.h +++ b/libkdecorations/kdecoration.h @@ -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. */