diff --git a/kcms/lookandfeel/kcm.h b/kcms/lookandfeel/kcm.h --- a/kcms/lookandfeel/kcm.h +++ b/kcms/lookandfeel/kcm.h @@ -22,7 +22,6 @@ #include #include -#include #include #include @@ -39,19 +38,12 @@ Q_PROPERTY(QStandardItemModel *lookAndFeelModel READ lookAndFeelModel CONSTANT) Q_PROPERTY(QString selectedPlugin READ selectedPlugin WRITE setSelectedPlugin NOTIFY selectedPluginChanged) Q_PROPERTY(int selectedPluginIndex READ selectedPluginIndex NOTIFY selectedPluginIndexChanged) - - Q_PROPERTY(bool applyColors READ applyColors WRITE setApplyColors NOTIFY applyColorsChanged) - Q_PROPERTY(bool applyWidgetStyle READ applyWidgetStyle WRITE setApplyWidgetStyle NOTIFY applyWidgetStyleChanged) - Q_PROPERTY(bool applyIcons READ applyIcons WRITE setApplyIcons NOTIFY applyIconsChanged) - Q_PROPERTY(bool applyPlasmaTheme READ applyPlasmaTheme WRITE setApplyPlasmaTheme NOTIFY applyPlasmaThemeChanged) - Q_PROPERTY(bool applyWindowSwitcher READ applyWindowSwitcher WRITE setApplyWindowSwitcher NOTIFY applyWindowSwitcherChanged) - Q_PROPERTY(bool applyDesktopSwitcher READ applyDesktopSwitcher WRITE setApplyDesktopSwitcher NOTIFY applyDesktopSwitcherChanged) Q_PROPERTY(bool resetDefaultLayout READ resetDefaultLayout WRITE setResetDefaultLayout NOTIFY resetDefaultLayoutChanged) public: enum Roles { PluginNameRole = Qt::UserRole +1, - ScreenhotRole, + ScreenshotRole, FullScreenPreviewRole, DescriptionRole, HasSplashRole, @@ -66,19 +58,23 @@ HasWindowSwitcherRole, HasDesktopSwitcherRole }; + KCMLookandFeel(QObject* parent, const QVariantList& args); ~KCMLookandFeel() override; //List only packages which provide at least one of the components QList availablePackages(const QStringList &components); - QStandardItemModel *lookAndFeelModel(); + QStandardItemModel *lookAndFeelModel() const; QString selectedPlugin() const; void setSelectedPlugin(const QString &plugin); int selectedPluginIndex() const; + bool resetDefaultLayout() const; + void setResetDefaultLayout(bool reset); + //Setters of the various theme pieces void setWidgetStyle(const QString &style); void setColors(const QString &scheme, const QString &colorFile); @@ -91,23 +87,6 @@ void setDesktopSwitcher(const QString &theme); void setWindowDecoration(const QString &library, const QString &theme); - void setApplyColors(bool apply); - bool applyColors() const; - void setApplyWidgetStyle(bool apply); - bool applyWidgetStyle() const; - void setApplyIcons(bool apply); - bool applyIcons() const; - void setApplyPlasmaTheme(bool apply); - bool applyPlasmaTheme() const; - void setApplyWindowSwitcher(bool apply); - bool applyWindowSwitcher() const; - void setApplyDesktopSwitcher(bool apply); - bool applyDesktopSwitcher() const; - bool resetDefaultLayout() const; - void setResetDefaultLayout(bool reset); - - void loadModel(); - Q_INVOKABLE void getNewStuff(QQuickItem *ctx); public Q_SLOTS: @@ -117,17 +96,11 @@ Q_SIGNALS: void selectedPluginChanged(); - - void applyColorsChanged(); - void applyWidgetStyleChanged(); - void applyIconsChanged(); - void applyPlasmaThemeChanged(); - void applyWindowSwitcherChanged(); - void applyDesktopSwitcherChanged(); - void resetDefaultLayoutChanged(); void selectedPluginIndexChanged(); + void resetDefaultLayoutChanged(); private: + void loadModel(); QDir cursorThemeDir(const QString &theme, const int depth); const QStringList cursorSearchPaths(); QStandardItemModel *m_model; diff --git a/kcms/lookandfeel/kcm.cpp b/kcms/lookandfeel/kcm.cpp --- a/kcms/lookandfeel/kcm.cpp +++ b/kcms/lookandfeel/kcm.cpp @@ -26,20 +26,16 @@ #include #include -#include -#include -#include -#include -#include #include #include #include #include -#include -#include +#include #include #include +#include +#include #include #include @@ -79,7 +75,7 @@ QHash roles = m_model->roleNames(); roles[PluginNameRole] = "pluginName"; roles[DescriptionRole] = "description"; - roles[ScreenhotRole] = "screenshot"; + roles[ScreenshotRole] = "screenshot"; roles[FullScreenPreviewRole] = "fullScreenPreview"; roles[HasSplashRole] = "hasSplash"; roles[HasLockScreenRole] = "hasLockScreen"; @@ -118,7 +114,7 @@ m_newStuffDialog.data()->show(); } -QStandardItemModel *KCMLookandFeel::lookAndFeelModel() +QStandardItemModel *KCMLookandFeel::lookAndFeelModel() const { return m_model; } @@ -197,7 +193,7 @@ QStandardItem* row = new QStandardItem(pkg.metadata().name()); row->setData(pkg.metadata().pluginName(), PluginNameRole); row->setData(pkg.metadata().comment(), DescriptionRole); - row->setData(pkg.filePath("preview"), ScreenhotRole); + row->setData(pkg.filePath("preview"), ScreenshotRole); row->setData(pkg.filePath("fullscreenpreview"), FullScreenPreviewRole); //What the package provides @@ -724,94 +720,6 @@ QDBusConnection::sessionBus().send(message); } -void KCMLookandFeel::setApplyColors(bool apply) -{ - if (m_applyColors == apply) { - return; - } - - m_applyColors = apply; - emit applyColorsChanged(); -} - -bool KCMLookandFeel::applyColors() const -{ - return m_applyColors; -} - -void KCMLookandFeel::setApplyWidgetStyle(bool apply) -{ - if (m_applyWidgetStyle == apply) { - return; - } - - m_applyWidgetStyle = apply; - emit applyWidgetStyleChanged(); -} - -bool KCMLookandFeel::applyWidgetStyle() const -{ - return m_applyWidgetStyle; -} - -void KCMLookandFeel::setApplyIcons(bool apply) -{ - if (m_applyIcons == apply) { - return; - } - - m_applyIcons = apply; - emit applyIconsChanged(); -} - -bool KCMLookandFeel::applyIcons() const -{ - return m_applyIcons; -} - -void KCMLookandFeel::setApplyPlasmaTheme(bool apply) -{ - if (m_applyPlasmaTheme == apply) { - return; - } - - m_applyPlasmaTheme = apply; - emit applyPlasmaThemeChanged(); -} - -bool KCMLookandFeel::applyPlasmaTheme() const -{ - return m_applyPlasmaTheme; -} - -void KCMLookandFeel::setApplyWindowSwitcher(bool apply) -{ - if (m_applyWindowSwitcher == apply) { - return; - } - m_applyWindowSwitcher = apply; - emit applyWindowSwitcherChanged(); -} - -bool KCMLookandFeel::applyWindowSwitcher() const -{ - return m_applyWindowSwitcher; -} - -void KCMLookandFeel::setApplyDesktopSwitcher(bool apply) -{ - if (m_applyDesktopSwitcher == apply) { - return; - } - m_applyDesktopSwitcher = apply; - emit applyDesktopSwitcherChanged(); -} - -bool KCMLookandFeel::applyDesktopSwitcher() const -{ - return m_applyDesktopSwitcher; -} - void KCMLookandFeel::setResetDefaultLayout(bool reset) { if (m_resetDefaultLayout == reset) {