From a7b29e09cefe50f6ef6e9e603997da0c1753885a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Fl=C3=B6ser?= Date: Sun, 20 Aug 2017 09:24:10 +0200 Subject: [PATCH] Make AbstractClient::caption no longer a virtual method Summary: The implementation can now be shared, it doesn't differ anymore between X11 (Client) and Wayland (ShellClient). So instead of code duplication a shared implementation in AbstractClient. Test Plan: X11 and ShellClient tests still pass Reviewers: #kwin, #plasma Subscribers: plasma-devel, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D7426 --- abstract_client.cpp | 13 +++++++++++++ abstract_client.h | 2 +- client.cpp | 16 ---------------- client.h | 1 - shell_client.cpp | 9 --------- shell_client.h | 1 - 6 files changed, 14 insertions(+), 28 deletions(-) diff --git a/abstract_client.cpp b/abstract_client.cpp index bd6262b42f..1116b469a6 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -1766,4 +1766,17 @@ AbstractClient *AbstractClient::findClientWithSameCaption() const return workspace()->findAbstractClient(fetchNameInternalPredicate); } +QString AbstractClient::caption(bool full) const +{ + QString cap = captionNormal(); + if (full) { + cap += captionSuffix(); + if (unresponsive()) { + cap += QLatin1String(" "); + cap += i18nc("Application is not responding, appended to window title", "(Not Responding)"); + } + } + return cap; +} + } diff --git a/abstract_client.h b/abstract_client.h index d92c531bac..833cc456b0 100644 --- a/abstract_client.h +++ b/abstract_client.h @@ -348,7 +348,7 @@ public: * @see captionNormal * @see captionSuffix **/ - virtual QString caption(bool full = true) const = 0; + QString caption(bool full = true) const; /** * @returns The caption as set by the AbstractClient without any suffix. * @see caption diff --git a/client.cpp b/client.cpp index ad8d48aeef..7cb3480e8d 100644 --- a/client.cpp +++ b/client.cpp @@ -1513,22 +1513,6 @@ void Client::fetchIconicName() } } -/** - * \reimp - */ -QString Client::caption(bool full) const -{ - QString cap = cap_normal; - if (full) { - cap += cap_suffix; - if (unresponsive()) { - cap += QLatin1String(" "); - cap += i18nc("Application is not responding, appended to window title", "(Not Responding)"); - } - } - return cap; -} - bool Client::tabTo(Client *other, bool behind, bool activate) { Q_ASSERT(other && other != this); diff --git a/client.h b/client.h index 0e90a1be43..656536ceee 100644 --- a/client.h +++ b/client.h @@ -219,7 +219,6 @@ public: void setBlockingCompositing(bool block); inline bool isBlockingCompositing() { return blocks_compositing; } - QString caption(bool full = true) const override; QString captionNormal() const override { return cap_normal; } diff --git a/shell_client.cpp b/shell_client.cpp index 381a11b85a..e4b169e677 100644 --- a/shell_client.cpp +++ b/shell_client.cpp @@ -566,15 +566,6 @@ void ShellClient::blockActivityUpdates(bool b) Q_UNUSED(b) } -QString ShellClient::caption(bool full) const -{ - QString caption = m_caption; - if (full) { - caption += m_captionSuffix; - } - return caption; -} - void ShellClient::updateCaption() { const QString oldSuffix = m_captionSuffix; diff --git a/shell_client.h b/shell_client.h index a5ad7544e5..0b15b7a4a8 100644 --- a/shell_client.h +++ b/shell_client.h @@ -63,7 +63,6 @@ public: } void blockActivityUpdates(bool b = true) override; - QString caption(bool full = true) const override; QString captionNormal() const override { return m_caption; }