diff --git a/src/plugins/kpackage/aurorae/aurorae.cpp b/src/plugins/kpackage/aurorae/aurorae.cpp index 209e75d4f3..300645f656 100644 --- a/src/plugins/kpackage/aurorae/aurorae.cpp +++ b/src/plugins/kpackage/aurorae/aurorae.cpp @@ -4,38 +4,44 @@ SPDX-License-Identifier: LGPL-2.0-or-later */ -#include "aurorae.h" +#include -void AuroraePackage::initPackage(KPackage::Package *package) +class AuroraePackage : public KPackage::PackageStructure { - package->setContentsPrefixPaths(QStringList()); - package->setDefaultPackageRoot(QStringLiteral("aurorae/themes/")); + Q_OBJECT +public: + using KPackage::PackageStructure::PackageStructure; + void initPackage(KPackage::Package *package) override + { + package->setContentsPrefixPaths(QStringList()); + package->setDefaultPackageRoot(QStringLiteral("aurorae/themes/")); - package->addFileDefinition("decoration", QStringLiteral("decoration.svgz")); - package->setRequired("decoration", true); + package->addFileDefinition("decoration", QStringLiteral("decoration.svgz")); + package->setRequired("decoration", true); - package->addFileDefinition("close", QStringLiteral("close.svgz")); - package->addFileDefinition("minimize", QStringLiteral("minimize.svgz")); - package->addFileDefinition("maximize", QStringLiteral("maximize.svgz")); - package->addFileDefinition("restore", QStringLiteral("restore.svgz")); - package->addFileDefinition("alldesktops", QStringLiteral("alldesktops.svgz")); - package->addFileDefinition("keepabove", QStringLiteral("keepabove.svgz")); - package->addFileDefinition("keepbelow", QStringLiteral("keepbelow.svgz")); - package->addFileDefinition("shade", QStringLiteral("shade.svgz")); - package->addFileDefinition("help", QStringLiteral("help.svgz")); - package->addFileDefinition("configrc", QStringLiteral("configrc")); - package->setDefaultMimeTypes(QStringList{QStringLiteral("image/svg+xml-compressed")}); -} - -void AuroraePackage::pathChanged(KPackage::Package *package) -{ - if (package->path().isEmpty()) { - return; + package->addFileDefinition("close", QStringLiteral("close.svgz")); + package->addFileDefinition("minimize", QStringLiteral("minimize.svgz")); + package->addFileDefinition("maximize", QStringLiteral("maximize.svgz")); + package->addFileDefinition("restore", QStringLiteral("restore.svgz")); + package->addFileDefinition("alldesktops", QStringLiteral("alldesktops.svgz")); + package->addFileDefinition("keepabove", QStringLiteral("keepabove.svgz")); + package->addFileDefinition("keepbelow", QStringLiteral("keepbelow.svgz")); + package->addFileDefinition("shade", QStringLiteral("shade.svgz")); + package->addFileDefinition("help", QStringLiteral("help.svgz")); + package->addFileDefinition("configrc", QStringLiteral("configrc")); + package->setDefaultMimeTypes(QStringList{QStringLiteral("image/svg+xml-compressed")}); } - const QString configrc = package->metadata().pluginId() + "rc"; - package->addFileDefinition("configrc", configrc); -} + void pathChanged(KPackage::Package *package) override + { + if (package->path().isEmpty()) { + return; + } + + const QString configrc = package->metadata().pluginId() + "rc"; + package->addFileDefinition("configrc", configrc); + } +}; K_PLUGIN_CLASS_WITH_JSON(AuroraePackage, "kwin-packagestructure-aurorae.json") diff --git a/src/plugins/kpackage/aurorae/aurorae.h b/src/plugins/kpackage/aurorae/aurorae.h deleted file mode 100644 index 273d2c1872..0000000000 --- a/src/plugins/kpackage/aurorae/aurorae.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - SPDX-FileCopyrightText: 2017 Demitrius Belai - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#pragma once - -#include - -class AuroraePackage : public KPackage::PackageStructure -{ -public: - AuroraePackage(QObject *, const QVariantList &) - { - } - void initPackage(KPackage::Package *package) override; - void pathChanged(KPackage::Package *package) override; -}; diff --git a/src/plugins/kpackage/decoration/decoration.cpp b/src/plugins/kpackage/decoration/decoration.cpp index 7d3ddf4062..e4757cc1dc 100644 --- a/src/plugins/kpackage/decoration/decoration.cpp +++ b/src/plugins/kpackage/decoration/decoration.cpp @@ -4,36 +4,42 @@ SPDX-License-Identifier: LGPL-2.0-or-later */ -#include "decoration.h" +#include -void DecorationPackage::initPackage(KPackage::Package *package) +class DecorationPackage : public KPackage::PackageStructure { - package->setDefaultPackageRoot(QStringLiteral("kwin/decorations/")); + Q_OBJECT +public: + using KPackage::PackageStructure::PackageStructure; + void initPackage(KPackage::Package *package) override + { + package->setDefaultPackageRoot(QStringLiteral("kwin/decorations/")); - package->addDirectoryDefinition("config", QStringLiteral("config")); - package->setMimeTypes("config", QStringList{QStringLiteral("text/xml")}); + package->addDirectoryDefinition("config", QStringLiteral("config")); + package->setMimeTypes("config", QStringList{QStringLiteral("text/xml")}); - package->addDirectoryDefinition("ui", QStringLiteral("ui")); + package->addDirectoryDefinition("ui", QStringLiteral("ui")); - package->addDirectoryDefinition("code", QStringLiteral("code")); + package->addDirectoryDefinition("code", QStringLiteral("code")); - package->addFileDefinition("mainscript", QStringLiteral("code/main.qml")); - package->setRequired("mainscript", true); + package->addFileDefinition("mainscript", QStringLiteral("code/main.qml")); + package->setRequired("mainscript", true); - package->setMimeTypes("decoration", QStringList{QStringLiteral("text/plain")}); -} - -void DecorationPackage::pathChanged(KPackage::Package *package) -{ - if (package->path().isEmpty()) { - return; + package->setMimeTypes("decoration", QStringList{QStringLiteral("text/plain")}); } - const QString mainScript = package->metadata().value("X-Plasma-MainScript"); - if (!mainScript.isEmpty()) { - package->addFileDefinition("mainscript", mainScript); + void pathChanged(KPackage::Package *package) override + { + if (package->path().isEmpty()) { + return; + } + + const QString mainScript = package->metadata().value("X-Plasma-MainScript"); + if (!mainScript.isEmpty()) { + package->addFileDefinition("mainscript", mainScript); + } } -} +}; K_PLUGIN_CLASS_WITH_JSON(DecorationPackage, "kwin-packagestructure-decoration.json") diff --git a/src/plugins/kpackage/decoration/decoration.h b/src/plugins/kpackage/decoration/decoration.h deleted file mode 100644 index 251e0604ab..0000000000 --- a/src/plugins/kpackage/decoration/decoration.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - SPDX-FileCopyrightText: 2017 Demitrius Belai - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#pragma once - -#include - -class DecorationPackage : public KPackage::PackageStructure -{ -public: - DecorationPackage(QObject *, const QVariantList &) - { - } - void initPackage(KPackage::Package *package) override; - void pathChanged(KPackage::Package *package) override; -}; diff --git a/src/plugins/kpackage/effect/effect.cpp b/src/plugins/kpackage/effect/effect.cpp index 797c6a6073..0a26dce538 100644 --- a/src/plugins/kpackage/effect/effect.cpp +++ b/src/plugins/kpackage/effect/effect.cpp @@ -4,43 +4,44 @@ SPDX-License-Identifier: LGPL-2.0-or-later */ -#include "effect.h" +#include -EffectPackageStructure::EffectPackageStructure(QObject *parent, const QVariantList &args) - : KPackage::PackageStructure(parent, args) +class EffectPackageStructure : public KPackage::PackageStructure { -} + Q_OBJECT +public: + using KPackage::PackageStructure::PackageStructure; + void initPackage(KPackage::Package *package) override + { + package->setDefaultPackageRoot(QStringLiteral("kwin/effects/")); -void EffectPackageStructure::initPackage(KPackage::Package *package) -{ - package->setDefaultPackageRoot(QStringLiteral("kwin/effects/")); + package->addDirectoryDefinition("code", QStringLiteral("code")); + package->setMimeTypes("code", QStringList{QStringLiteral("text/plain")}); - package->addDirectoryDefinition("code", QStringLiteral("code")); - package->setMimeTypes("code", QStringList{QStringLiteral("text/plain")}); + package->addFileDefinition("mainscript", QStringLiteral("code/main.js")); + package->setRequired("mainscript", true); - package->addFileDefinition("mainscript", QStringLiteral("code/main.js")); - package->setRequired("mainscript", true); + package->addFileDefinition("config", QStringLiteral("config/main.xml")); + package->setMimeTypes("config", QStringList{QStringLiteral("text/xml")}); - package->addFileDefinition("config", QStringLiteral("config/main.xml")); - package->setMimeTypes("config", QStringList{QStringLiteral("text/xml")}); - - package->addFileDefinition("configui", QStringLiteral("ui/config.ui")); - package->setMimeTypes("configui", QStringList{QStringLiteral("text/xml")}); -} - -void EffectPackageStructure::pathChanged(KPackage::Package *package) -{ - if (package->path().isEmpty()) { - return; + package->addFileDefinition("configui", QStringLiteral("ui/config.ui")); + package->setMimeTypes("configui", QStringList{QStringLiteral("text/xml")}); } - const QString mainScript = package->metadata().value("X-Plasma-MainScript"); - if (mainScript.isEmpty()) { - return; - } + void pathChanged(KPackage::Package *package) override + { + if (package->path().isEmpty()) { + return; + } - package->addFileDefinition("mainscript", mainScript); -} + const QString mainScript = package->metadata().value("X-Plasma-MainScript"); + if (mainScript.isEmpty()) { + return; + } + + package->addFileDefinition("mainscript", mainScript); + } +}; K_PLUGIN_CLASS_WITH_JSON(EffectPackageStructure, "kwin-packagestructure-effect.json") diff --git a/src/plugins/kpackage/effect/effect.h b/src/plugins/kpackage/effect/effect.h deleted file mode 100644 index 767398bd22..0000000000 --- a/src/plugins/kpackage/effect/effect.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - SPDX-FileCopyrightText: 2018 Vlad Zahorodnii - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#pragma once - -#include - -class EffectPackageStructure : public KPackage::PackageStructure -{ - Q_OBJECT - -public: - EffectPackageStructure(QObject *parent = nullptr, const QVariantList &args = {}); - - void initPackage(KPackage::Package *package) override; - void pathChanged(KPackage::Package *package) override; -}; diff --git a/src/plugins/kpackage/scripts/scripts.cpp b/src/plugins/kpackage/scripts/scripts.cpp index ba6821ee49..7c63b3deed 100644 --- a/src/plugins/kpackage/scripts/scripts.cpp +++ b/src/plugins/kpackage/scripts/scripts.cpp @@ -4,36 +4,42 @@ SPDX-License-Identifier: LGPL-2.0-or-later */ -#include "scripts.h" +#include -void ScriptsPackage::initPackage(KPackage::Package *package) +class ScriptsPackage : public KPackage::PackageStructure { - package->setDefaultPackageRoot(QStringLiteral("kwin/scripts/")); + Q_OBJECT +public: + using KPackage::PackageStructure::PackageStructure; + void initPackage(KPackage::Package *package) override + { + package->setDefaultPackageRoot(QStringLiteral("kwin/scripts/")); - package->addDirectoryDefinition("config", QStringLiteral("config")); - package->setMimeTypes("config", QStringList{QStringLiteral("text/xml")}); + package->addDirectoryDefinition("config", QStringLiteral("config")); + package->setMimeTypes("config", QStringList{QStringLiteral("text/xml")}); - package->addDirectoryDefinition("ui", QStringLiteral("ui")); + package->addDirectoryDefinition("ui", QStringLiteral("ui")); - package->addDirectoryDefinition("code", QStringLiteral("code")); + package->addDirectoryDefinition("code", QStringLiteral("code")); - package->addFileDefinition("mainscript", QStringLiteral("code/main.js")); - package->setRequired("mainscript", true); + package->addFileDefinition("mainscript", QStringLiteral("code/main.js")); + package->setRequired("mainscript", true); - package->setMimeTypes("scripts", QStringList{QStringLiteral("text/plain")}); -} - -void ScriptsPackage::pathChanged(KPackage::Package *package) -{ - if (package->path().isEmpty()) { - return; + package->setMimeTypes("scripts", QStringList{QStringLiteral("text/plain")}); } - const QString mainScript = package->metadata().value("X-Plasma-MainScript"); - if (!mainScript.isEmpty()) { - package->addFileDefinition("mainscript", mainScript); + void pathChanged(KPackage::Package *package) override + { + if (package->path().isEmpty()) { + return; + } + + const QString mainScript = package->metadata().value("X-Plasma-MainScript"); + if (!mainScript.isEmpty()) { + package->addFileDefinition("mainscript", mainScript); + } } -} +}; K_PLUGIN_CLASS_WITH_JSON(ScriptsPackage, "kwin-packagestructure-scripts.json") diff --git a/src/plugins/kpackage/scripts/scripts.h b/src/plugins/kpackage/scripts/scripts.h deleted file mode 100644 index 9b7e6f999d..0000000000 --- a/src/plugins/kpackage/scripts/scripts.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - SPDX-FileCopyrightText: 2017 Marco Martin - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#pragma once - -#include - -class ScriptsPackage : public KPackage::PackageStructure -{ -public: - ScriptsPackage(QObject *, const QVariantList &) - { - } - void initPackage(KPackage::Package *package) override; - void pathChanged(KPackage::Package *package) override; -}; diff --git a/src/plugins/kpackage/windowswitcher/windowswitcher.cpp b/src/plugins/kpackage/windowswitcher/windowswitcher.cpp index 210f0fa4ec..8e10066108 100644 --- a/src/plugins/kpackage/windowswitcher/windowswitcher.cpp +++ b/src/plugins/kpackage/windowswitcher/windowswitcher.cpp @@ -4,36 +4,42 @@ SPDX-License-Identifier: LGPL-2.0-or-later */ -#include "windowswitcher.h" +#include -void SwitcherPackage::initPackage(KPackage::Package *package) +class SwitcherPackage : public KPackage::PackageStructure { - package->setDefaultPackageRoot(QStringLiteral("kwin/tabbox/")); + Q_OBJECT +public: + using KPackage::PackageStructure::PackageStructure; + void initPackage(KPackage::Package *package) override + { + package->setDefaultPackageRoot(QStringLiteral("kwin/tabbox/")); - package->addDirectoryDefinition("config", QStringLiteral("config")); - package->setMimeTypes("config", QStringList{QStringLiteral("text/xml")}); + package->addDirectoryDefinition("config", QStringLiteral("config")); + package->setMimeTypes("config", QStringList{QStringLiteral("text/xml")}); - package->addDirectoryDefinition("ui", QStringLiteral("ui")); + package->addDirectoryDefinition("ui", QStringLiteral("ui")); - package->addDirectoryDefinition("code", QStringLiteral("code")); + package->addDirectoryDefinition("code", QStringLiteral("code")); - package->addFileDefinition("mainscript", QStringLiteral("ui/main.qml")); - package->setRequired("mainscript", true); + package->addFileDefinition("mainscript", QStringLiteral("ui/main.qml")); + package->setRequired("mainscript", true); - package->setMimeTypes("windowswitcher", QStringList(QStringLiteral("text/plain"))); -} - -void SwitcherPackage::pathChanged(KPackage::Package *package) -{ - if (package->path().isEmpty()) { - return; + package->setMimeTypes("windowswitcher", QStringList(QStringLiteral("text/plain"))); } - const QString mainScript = package->metadata().value("X-Plasma-MainScript"); - if (!mainScript.isEmpty()) { - package->addFileDefinition("mainscript", mainScript); + void pathChanged(KPackage::Package *package) override + { + if (package->path().isEmpty()) { + return; + } + + const QString mainScript = package->metadata().value("X-Plasma-MainScript"); + if (!mainScript.isEmpty()) { + package->addFileDefinition("mainscript", mainScript); + } } -} +}; K_PLUGIN_CLASS_WITH_JSON(SwitcherPackage, "kwin-packagestructure-windowswitcher.json") diff --git a/src/plugins/kpackage/windowswitcher/windowswitcher.h b/src/plugins/kpackage/windowswitcher/windowswitcher.h deleted file mode 100644 index 4ac839969b..0000000000 --- a/src/plugins/kpackage/windowswitcher/windowswitcher.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - SPDX-FileCopyrightText: 2017 Marco Martin - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#pragma once - -#include - -class SwitcherPackage : public KPackage::PackageStructure -{ -public: - SwitcherPackage(QObject *, const QVariantList &) - { - } - void initPackage(KPackage::Package *package) override; - void pathChanged(KPackage::Package *package) override; -};