From 1d3d4b1013433257ffdaa908d43b6e833cf6dc75 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 6 Dec 2017 14:14:49 +0100 Subject: [PATCH] Cleanup color scheme manager part of KCM Deco code Summary: PreviewCient is internal to the KCM, it's not used by actual decorations where we need API compatibility. This property is not used by the KCM. The current code parses every color scheme config file for every decoration. This is one of the big contributing factors to this KCM being a bit sluggish. It was effectively deprecated in 2015 when a decoration palette was introduced. If we wanted to add colorscheme functionality in the KCM, we'd use that instead at a previewclient level. Test Plan: Found this was a problem with hotspot Grepped code for usage Ran KCM Reviewers: #plasma Subscribers: plasma-devel, kwin, #kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D9239 --- .../declarative-plugin/previewclient.cpp | 24 ------------------- .../declarative-plugin/previewclient.h | 10 -------- 2 files changed, 34 deletions(-) diff --git a/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp b/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp index 7d7c413c2f..2a022473f2 100644 --- a/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp +++ b/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp @@ -21,9 +21,6 @@ #include #include -#include -#include - #include #include #include @@ -37,8 +34,6 @@ namespace Preview PreviewClient::PreviewClient(DecoratedClient *c, Decoration *decoration) : QObject(decoration) , ApplicationMenuEnabledDecoratedClientPrivate(c, decoration) - , m_colorSchemeManager(new KColorSchemeManager(this)) - , m_colorSchemeIndex(0) , m_icon(QIcon::fromTheme(QStringLiteral("start-here-kde"))) , m_iconName(m_icon.name()) , m_palette(QStringLiteral("kdeglobals")) @@ -272,25 +267,6 @@ QColor PreviewClient::color(ColorGroup group, ColorRole role) const return m_palette.color(group, role); } -QAbstractItemModel *PreviewClient::colorSchemeModel() const -{ - return m_colorSchemeManager->model(); -} - -int PreviewClient::colorSchemeIndex() const -{ - return m_colorSchemeIndex; -} - -void PreviewClient::setColorSchemeIndex(int index) -{ - if (m_colorSchemeIndex == index) { - return; - } - m_colorSchemeIndex = index; - emit colorSchemeIndexChanged(m_colorSchemeIndex); -} - Qt::Edges PreviewClient::adjacentScreenEdges() const { Qt::Edges edges; diff --git a/kcmkwin/kwindecoration/declarative-plugin/previewclient.h b/kcmkwin/kwindecoration/declarative-plugin/previewclient.h index 47ff2c415d..8fb681e1ef 100644 --- a/kcmkwin/kwindecoration/declarative-plugin/previewclient.h +++ b/kcmkwin/kwindecoration/declarative-plugin/previewclient.h @@ -26,7 +26,6 @@ #include #include -class KColorSchemeManager; class QAbstractItemModel; namespace KDecoration2 @@ -40,8 +39,6 @@ class PreviewClient : public QObject, public ApplicationMenuEnabledDecoratedClie Q_PROPERTY(QString caption READ caption WRITE setCaption NOTIFY captionChanged) Q_PROPERTY(QIcon icon READ icon WRITE setIcon NOTIFY iconChanged) Q_PROPERTY(QString iconName READ iconName WRITE setIconName NOTIFY iconNameChanged) - Q_PROPERTY(QAbstractItemModel *colorSchemeModel READ colorSchemeModel CONSTANT) - Q_PROPERTY(int colorSchemeIndex READ colorSchemeIndex WRITE setColorSchemeIndex NOTIFY colorSchemeIndexChanged) Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged) Q_PROPERTY(bool closeable READ isCloseable WRITE setCloseable NOTIFY closeableChanged) Q_PROPERTY(bool keepAbove READ isKeepAbove WRITE setKeepAbove NOTIFY keepAboveChanged) @@ -137,10 +134,6 @@ public: void setIconName(const QString &icon); void setIcon(const QIcon &icon); - QAbstractItemModel *colorSchemeModel() const; - int colorSchemeIndex() const; - void setColorSchemeIndex(int index); - bool bordersTopEdge() const; bool bordersLeftEdge() const; bool bordersRightEdge() const; @@ -174,7 +167,6 @@ Q_SIGNALS: void desktopChanged(int); void widthChanged(int); void heightChanged(int); - void colorSchemeIndexChanged(int); void paletteChanged(const QPalette&); void bordersTopEdgeChanged(bool); void bordersLeftEdgeChanged(bool); @@ -187,8 +179,6 @@ Q_SIGNALS: void closeRequested(); private: - KColorSchemeManager *m_colorSchemeManager; - int m_colorSchemeIndex; QString m_caption; QIcon m_icon; QString m_iconName;