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
This commit is contained in:
parent
6685288d48
commit
a7b29e09ce
6 changed files with 14 additions and 28 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
16
client.cpp
16
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);
|
||||
|
|
1
client.h
1
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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue