plugins/kpackage: Make plugin cpp file only, add missing Q_Object macro
The macro is not strictly needed, but it simplifies debugging due to us having the classname from the staticMetaObject available
This commit is contained in:
parent
017da14444
commit
f88b80e90e
10 changed files with 139 additions and 210 deletions
|
@ -4,38 +4,44 @@
|
|||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "aurorae.h"
|
||||
#include <KPackage/PackageStructure>
|
||||
|
||||
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")
|
||||
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2017 Demitrius Belai <demitriusbelai@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <KPackage/PackageStructure>
|
||||
|
||||
class AuroraePackage : public KPackage::PackageStructure
|
||||
{
|
||||
public:
|
||||
AuroraePackage(QObject *, const QVariantList &)
|
||||
{
|
||||
}
|
||||
void initPackage(KPackage::Package *package) override;
|
||||
void pathChanged(KPackage::Package *package) override;
|
||||
};
|
|
@ -4,36 +4,42 @@
|
|||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "decoration.h"
|
||||
#include <KPackage/PackageStructure>
|
||||
|
||||
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")
|
||||
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2017 Demitrius Belai <demitriusbelai@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <KPackage/PackageStructure>
|
||||
|
||||
class DecorationPackage : public KPackage::PackageStructure
|
||||
{
|
||||
public:
|
||||
DecorationPackage(QObject *, const QVariantList &)
|
||||
{
|
||||
}
|
||||
void initPackage(KPackage::Package *package) override;
|
||||
void pathChanged(KPackage::Package *package) override;
|
||||
};
|
|
@ -4,43 +4,44 @@
|
|||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "effect.h"
|
||||
#include <KPackage/PackageStructure>
|
||||
|
||||
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")
|
||||
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2018 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <KPackage/PackageStructure>
|
||||
|
||||
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;
|
||||
};
|
|
@ -4,36 +4,42 @@
|
|||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "scripts.h"
|
||||
#include <KPackage/PackageStructure>
|
||||
|
||||
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")
|
||||
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2017 Marco Martin <mart@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <KPackage/PackageStructure>
|
||||
|
||||
class ScriptsPackage : public KPackage::PackageStructure
|
||||
{
|
||||
public:
|
||||
ScriptsPackage(QObject *, const QVariantList &)
|
||||
{
|
||||
}
|
||||
void initPackage(KPackage::Package *package) override;
|
||||
void pathChanged(KPackage::Package *package) override;
|
||||
};
|
|
@ -4,36 +4,42 @@
|
|||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "windowswitcher.h"
|
||||
#include <KPackage/PackageStructure>
|
||||
|
||||
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")
|
||||
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2017 Marco Martin <mart@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <KPackage/PackageStructure>
|
||||
|
||||
class SwitcherPackage : public KPackage::PackageStructure
|
||||
{
|
||||
public:
|
||||
SwitcherPackage(QObject *, const QVariantList &)
|
||||
{
|
||||
}
|
||||
void initPackage(KPackage::Package *package) override;
|
||||
void pathChanged(KPackage::Package *package) override;
|
||||
};
|
Loading…
Reference in a new issue