From 63bb36e2ad77c8a70db8573fc64596f6b2b7cf0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 23 Aug 2013 17:06:57 +0200 Subject: [PATCH] Add shade 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 | 2 +- clients/aurorae/src/aurorae.cpp | 5 ----- clients/aurorae/src/aurorae.h | 4 ---- libkdecorations/kcommondecoration.cpp | 1 + libkdecorations/kcommondecoration.h | 2 +- libkdecorations/kcommondecoration_p.cpp | 5 ----- libkdecorations/kcommondecoration_p.h | 1 - libkdecorations/kdecoration.h | 11 ++++++----- 8 files changed, 9 insertions(+), 22 deletions(-) diff --git a/client.cpp b/client.cpp index 1100bac192..d74cdff361 100644 --- a/client.cpp +++ b/client.cpp @@ -428,7 +428,7 @@ void Client::createDecoration(const QRect& oldgeom) } else { decoration = decorationPlugin()->createDecoration(bridge); } - connect(this, SIGNAL(shadeChanged()), decoration, SLOT(shadeChange())); + connect(this, &Client::shadeChanged, decoration, &KDecoration::shadeChanged); connect(this, &Client::desktopChanged, decoration, &KDecoration::desktopChanged); connect(this, &Client::captionChanged, decoration, &KDecoration::captionChanged); connect(this, &Client::activeChanged, decoration, &KDecoration::activeChanged); diff --git a/clients/aurorae/src/aurorae.cpp b/clients/aurorae/src/aurorae.cpp index cf89d96f8c..bcacd3dcc2 100644 --- a/clients/aurorae/src/aurorae.cpp +++ b/clients/aurorae/src/aurorae.cpp @@ -327,11 +327,6 @@ void AuroraeClient::resize(const QSize &s) widget()->resize(s); } -void AuroraeClient::shadeChange() -{ - emit shadeChanged(); -} - void AuroraeClient::borders(int &left, int &right, int &top, int &bottom) const { if (!m_item) { diff --git a/clients/aurorae/src/aurorae.h b/clients/aurorae/src/aurorae.h index 6acfdbba2f..32513f2192 100644 --- a/clients/aurorae/src/aurorae.h +++ b/clients/aurorae/src/aurorae.h @@ -97,8 +97,6 @@ class AuroraeClient : public KDecoration Q_PROPERTY(bool moveable READ isMovable CONSTANT) Q_PROPERTY(bool preview READ isPreview CONSTANT) Q_PROPERTY(bool resizeable READ isResizable CONSTANT) - Q_PROPERTY(bool setShade READ isSetShade NOTIFY shadeChanged) - Q_PROPERTY(bool shade READ isShade WRITE setShade NOTIFY shadeChanged) Q_PROPERTY(bool shadeable READ isShadeable) Q_PROPERTY(bool keepAbove READ keepAbove WRITE setKeepAbove NOTIFY keepAboveChangedWrapper) Q_PROPERTY(bool keepBelow READ keepBelow WRITE setKeepBelow NOTIFY keepBelowChangedWrapper) @@ -122,7 +120,6 @@ public: virtual QSize minimumSize() const; virtual Position mousePosition(const QPoint& p) const; virtual void resize(const QSize& s); - virtual void shadeChange(); // optional overrides virtual void padding(int &left, int &right, int &top, int &bottom) const; bool isMaximized() const; @@ -135,7 +132,6 @@ public: Q_SIGNALS: void iconChanged(); void maximizeChanged(); - void shadeChanged(); void keepAboveChangedWrapper(); void keepBelowChangedWrapper(); void buttonsChanged(); diff --git a/libkdecorations/kcommondecoration.cpp b/libkdecorations/kcommondecoration.cpp index 1b9261408f..84c1ae1461 100644 --- a/libkdecorations/kcommondecoration.cpp +++ b/libkdecorations/kcommondecoration.cpp @@ -60,6 +60,7 @@ KCommonDecoration::KCommonDecoration(KDecorationBridge* bridge, KDecorationFacto connect(wrapper, &KDecoration::activeChanged, this, &KCommonDecoration::activeChange); connect(wrapper, &KDecoration::captionChanged, this, &KCommonDecoration::captionChange); connect(wrapper, &KDecoration::desktopChanged, this, &KCommonDecoration::desktopChange); + connect(wrapper, &KDecoration::shadeChanged, this, &KCommonDecoration::shadeChange); } KCommonDecoration::~KCommonDecoration() diff --git a/libkdecorations/kcommondecoration.h b/libkdecorations/kcommondecoration.h index 55bd4dc37b..f9ab4a4f96 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 shadeChange(); virtual void iconChange(); public Q_SLOTS: virtual void activeChange(); virtual void captionChange(); virtual void desktopChange(); + virtual void shadeChange(); void keepAboveChange(bool above); void keepBelowChange(bool below); void slotMaximize(); diff --git a/libkdecorations/kcommondecoration_p.cpp b/libkdecorations/kcommondecoration_p.cpp index 1a4159db24..477f2ee2fc 100644 --- a/libkdecorations/kcommondecoration_p.cpp +++ b/libkdecorations/kcommondecoration_p.cpp @@ -78,11 +78,6 @@ void KCommonDecorationWrapper::maximizeChange() return decoration->maximizeChange(); } -void KCommonDecorationWrapper::shadeChange() -{ - return decoration->shadeChange(); -} - bool KCommonDecorationWrapper::drawbound(const QRect& geom, bool clear) { return decoration->drawbound(geom, clear); diff --git a/libkdecorations/kcommondecoration_p.h b/libkdecorations/kcommondecoration_p.h index 3ce5d40d4e..8a0246eb5e 100644 --- a/libkdecorations/kcommondecoration_p.h +++ b/libkdecorations/kcommondecoration_p.h @@ -51,7 +51,6 @@ public: virtual QSize minimumSize() const; virtual void iconChange(); virtual void maximizeChange(); - virtual void shadeChange(); virtual bool drawbound(const QRect& geom, bool clear); virtual bool windowDocked(Position side); diff --git a/libkdecorations/kdecoration.h b/libkdecorations/kdecoration.h index 9eb31507c1..e367d50d89 100644 --- a/libkdecorations/kdecoration.h +++ b/libkdecorations/kdecoration.h @@ -494,6 +494,7 @@ class KWIN_EXPORT KDecoration Q_PROPERTY(QString caption READ caption NOTIFY captionChanged) 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) public: /** * Constructs a KDecoration object. Both the arguments are passed from @@ -827,11 +828,6 @@ public Q_SLOTS: * Use maximizeMode() to get the current state. */ virtual void maximizeChange() = 0; - /** - * This function is called whenever the window is shaded or unshaded. Use - * isShade() to get the current state. - */ - virtual void shadeChange() = 0; Q_SIGNALS: /** @@ -849,6 +845,11 @@ Q_SIGNALS: * on which the window is. */ void desktopChanged(); + /** + * This signal is emitted whenever the window is shaded or unshaded. Use + * isShade() to get the current state. + */ + void shadeChanged(); /** * This signal is emitted whenever the window's keep-above state changes. */