aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Martin <[email protected]>2017-03-15 13:01:53 +0100
committerMarco Martin <[email protected]>2017-03-15 13:09:34 +0100
commit898bee614d5683e35baa22a8590ee1525170137e (patch)
treef07785e92dc54de8f6daa56876b63115aa84fced
parent063587db99f29cca78d50f7283719f5112e6c9f9 (diff)
add packagestructure for KWin/Decoration
Summary: use a KPackage/PackageStructure for aurorae themes as well Patch by Demitrius Belai Reviewers: #plasma, graesslin Reviewed By: #plasma, graesslin Subscribers: graesslin, plasma-devel, kwin, #kwin Tags: #plasma Differential Revision: https://phabricator.kde.org/D4974
-rw-r--r--packageplugins/CMakeLists.txt2
-rw-r--r--packageplugins/aurorae/CMakeLists.txt17
-rw-r--r--packageplugins/aurorae/aurorae.cpp85
-rw-r--r--packageplugins/aurorae/aurorae.h33
-rw-r--r--packageplugins/aurorae/kwin-packagestructure-aurorae.desktop10
-rw-r--r--packageplugins/decoration/CMakeLists.txt17
-rw-r--r--packageplugins/decoration/decoration.cpp62
-rw-r--r--packageplugins/decoration/decoration.h33
-rw-r--r--packageplugins/decoration/kwin-packagestructure-decoration.desktop10
9 files changed, 269 insertions, 0 deletions
diff --git a/packageplugins/CMakeLists.txt b/packageplugins/CMakeLists.txt
index 8c784b3..92d6d1b 100644
--- a/packageplugins/CMakeLists.txt
+++ b/packageplugins/CMakeLists.txt
@@ -1,2 +1,4 @@
+add_subdirectory(aurorae)
+add_subdirectory(decoration)
add_subdirectory(scripts)
add_subdirectory(windowswitcher)
diff --git a/packageplugins/aurorae/CMakeLists.txt b/packageplugins/aurorae/CMakeLists.txt
new file mode 100644
index 0000000..6b1ef2b
--- /dev/null
+++ b/packageplugins/aurorae/CMakeLists.txt
@@ -0,0 +1,17 @@
+add_definitions(-DTRANSLATION_DOMAIN=\"kwin_package_aurorae\")
+
+set(aurorae_SRCS
+ aurorae.cpp
+)
+
+add_library(kwin_packagestructure_aurorae MODULE ${aurorae_SRCS})
+
+target_link_libraries(kwin_packagestructure_aurorae
+ KF5::I18n
+ KF5::Package
+)
+
+kcoreaddons_desktop_to_json(kwin_packagestructure_aurorae kwin-packagestructure-aurorae.desktop)
+
+install(TARGETS kwin_packagestructure_aurorae DESTINATION ${KDE_INSTALL_PLUGINDIR}/kpackage/packagestructure)
+
diff --git a/packageplugins/aurorae/aurorae.cpp b/packageplugins/aurorae/aurorae.cpp
new file mode 100644
index 0000000..8628f79
--- /dev/null
+++ b/packageplugins/aurorae/aurorae.cpp
@@ -0,0 +1,85 @@
+/******************************************************************************
+* Copyright 2017 by Demitrius Belai <[email protected]> *
+* *
+* This library is free software; you can redistribute it and/or *
+* modify it under the terms of the GNU Library General Public *
+* License as published by the Free Software Foundation; either *
+* version 2 of the License, or (at your option) any later version. *
+* *
+* This library is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+* Library General Public License for more details. *
+* *
+* You should have received a copy of the GNU Library General Public License *
+* along with this library; see the file COPYING.LIB. If not, write to *
+* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+* Boston, MA 02110-1301, USA. *
+*******************************************************************************/
+
+#include "aurorae.h"
+
+#include <KLocalizedString>
+
+void AuroraePackage::initPackage(KPackage::Package *package)
+{
+ package->setContentsPrefixPaths(QStringList());
+ package->setDefaultPackageRoot(QStringLiteral("aurorae/themes/"));
+
+ package->addFileDefinition("decoration", QStringLiteral("decoration.svgz"),
+ i18n("Window Decoration"));
+ package->setRequired("decoration", true);
+
+ package->addFileDefinition("close", QStringLiteral("close.svgz"),
+ i18n("Close Button"));
+
+ package->addFileDefinition("minimize", QStringLiteral("minimize.svgz"),
+ i18n("Minimize Button"));
+
+ package->addFileDefinition("maximize", QStringLiteral("maximize.svgz"),
+ i18n("Maximize Button"));
+
+ package->addFileDefinition("restore", QStringLiteral("restore.svgz"),
+ i18n("Restore Button"));
+
+ package->addFileDefinition("alldesktops", QStringLiteral("alldesktops.svgz"),
+ i18n("Sticky Button"));
+
+ package->addFileDefinition("keepabove", QStringLiteral("keepabove.svgz"),
+ i18n("Keepabove Button"));
+
+ package->addFileDefinition("keepbelow", QStringLiteral("keepbelow.svgz"),
+ i18n("Keepbelow Button"));
+
+ package->addFileDefinition("shade", QStringLiteral("shade.svgz"),
+ i18n("Shade Button"));
+
+ package->addFileDefinition("help", QStringLiteral("help.svgz"),
+ i18n("Help Button"));
+
+ package->addFileDefinition("configrc", QStringLiteral("configrc"),
+ i18n("Configuration file"));
+
+ QStringList mimetypes;
+ mimetypes << QStringLiteral("image/svg+xml-compressed");
+ package->setDefaultMimeTypes(mimetypes);
+}
+
+void AuroraePackage::pathChanged(KPackage::Package *package)
+{
+ if (package->path().isEmpty()) {
+ return;
+ }
+
+ KPluginMetaData md(package->metadata().metaDataFileName());
+
+ if (!md.pluginId().isEmpty()) {
+ QString configrc = md.pluginId() + "rc";
+ package->addFileDefinition("configrc", configrc, i18n("Configuration file"));
+ }
+}
+
+K_EXPORT_KPACKAGE_PACKAGE_WITH_JSON(AuroraePackage, "kwin-packagestructure-aurorae.json")
+
+#include "aurorae.moc"
+
diff --git a/packageplugins/aurorae/aurorae.h b/packageplugins/aurorae/aurorae.h
new file mode 100644
index 0000000..c3005aa
--- /dev/null
+++ b/packageplugins/aurorae/aurorae.h
@@ -0,0 +1,33 @@
+/******************************************************************************
+* Copyright 2017 by Demitrius Belai <[email protected]> *
+* *
+* This library is free software; you can redistribute it and/or *
+* modify it under the terms of the GNU Library General Public *
+* License as published by the Free Software Foundation; either *
+* version 2 of the License, or (at your option) any later version. *
+* *
+* This library is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+* Library General Public License for more details. *
+* *
+* You should have received a copy of the GNU Library General Public License *
+* along with this library; see the file COPYING.LIB. If not, write to *
+* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+* Boston, MA 02110-1301, USA. *
+*******************************************************************************/
+
+#ifndef AURORAEPACKAGE_H
+#define AURORAEPACKAGE_H
+
+#include <KPackage/PackageStructure>
+
+class AuroraePackage : public KPackage::PackageStructure
+{
+public:
+ AuroraePackage(QObject*, const QVariantList &) {}
+ void initPackage(KPackage::Package *package) Q_DECL_OVERRIDE;
+ void pathChanged(KPackage::Package *package) Q_DECL_OVERRIDE;
+};
+
+#endif
diff --git a/packageplugins/aurorae/kwin-packagestructure-aurorae.desktop b/packageplugins/aurorae/kwin-packagestructure-aurorae.desktop
new file mode 100644
index 0000000..3f1065e
--- /dev/null
+++ b/packageplugins/aurorae/kwin-packagestructure-aurorae.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Name=KWin Aurorae
+Type=Service
+X-KDE-ServiceTypes=KPackage/PackageStructure
+X-KDE-Library=kwin_packagestructure_aurorae
+
+X-KDE-PluginInfo-Author=Demitrius Belai
+X-KDE-PluginInfo-Name=KWin/Aurorae
+X-KDE-PluginInfo-Version=1
diff --git a/packageplugins/decoration/CMakeLists.txt b/packageplugins/decoration/CMakeLists.txt
new file mode 100644
index 0000000..bfb6065
--- /dev/null
+++ b/packageplugins/decoration/CMakeLists.txt
@@ -0,0 +1,17 @@
+add_definitions(-DTRANSLATION_DOMAIN=\"kwin_package_decoration\")
+
+set(decoration_SRCS
+ decoration.cpp
+)
+
+add_library(kwin_packagestructure_decoration MODULE ${decoration_SRCS})
+
+target_link_libraries(kwin_packagestructure_decoration
+ KF5::I18n
+ KF5::Package
+)
+
+kcoreaddons_desktop_to_json(kwin_packagestructure_decoration kwin-packagestructure-decoration.desktop)
+
+install(TARGETS kwin_packagestructure_decoration DESTINATION ${KDE_INSTALL_PLUGINDIR}/kpackage/packagestructure)
+
diff --git a/packageplugins/decoration/decoration.cpp b/packageplugins/decoration/decoration.cpp
new file mode 100644
index 0000000..a8dc37d
--- /dev/null
+++ b/packageplugins/decoration/decoration.cpp
@@ -0,0 +1,62 @@
+/******************************************************************************
+* Copyright 2017 by Demitrius Belai <[email protected]> *
+* *
+* This library is free software; you can redistribute it and/or *
+* modify it under the terms of the GNU Library General Public *
+* License as published by the Free Software Foundation; either *
+* version 2 of the License, or (at your option) any later version. *
+* *
+* This library is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+* Library General Public License for more details. *
+* *
+* You should have received a copy of the GNU Library General Public License *
+* along with this library; see the file COPYING.LIB. If not, write to *
+* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+* Boston, MA 02110-1301, USA. *
+*******************************************************************************/
+
+#include "decoration.h"
+
+#include <KLocalizedString>
+
+void DecorationPackage::initPackage(KPackage::Package *package)
+{
+ package->setDefaultPackageRoot(QStringLiteral("kwin/decorations/"));
+
+ package->addDirectoryDefinition("config", QStringLiteral("config"), i18n("Configuration Definitions"));
+ QStringList mimetypes;
+ mimetypes << QStringLiteral("text/xml");
+ package->setMimeTypes("config", mimetypes);
+
+ package->addDirectoryDefinition("ui", QStringLiteral("ui"), i18n("User Interface"));
+
+ package->addDirectoryDefinition("code", QStringLiteral("code"), i18n("Executable Scripts"));
+
+ package->addFileDefinition("mainscript", QStringLiteral("code/main.qml"), i18n("Main Script File"));
+ package->setRequired("mainscript", true);
+
+ mimetypes.clear();
+ mimetypes << QStringLiteral("text/plain");
+ package->setMimeTypes("decoration", mimetypes);
+}
+
+void DecorationPackage::pathChanged(KPackage::Package *package)
+{
+ if (package->path().isEmpty()) {
+ return;
+ }
+
+ KPluginMetaData md(package->metadata().metaDataFileName());
+ QString mainScript = md.value("X-Plasma-MainScript");
+
+ if (!mainScript.isEmpty()) {
+ package->addFileDefinition("mainscript", mainScript, i18n("Main Script File"));
+ }
+}
+
+K_EXPORT_KPACKAGE_PACKAGE_WITH_JSON(DecorationPackage, "kwin-packagestructure-decoration.json")
+
+#include "decoration.moc"
+
diff --git a/packageplugins/decoration/decoration.h b/packageplugins/decoration/decoration.h
new file mode 100644
index 0000000..cf3897e
--- /dev/null
+++ b/packageplugins/decoration/decoration.h
@@ -0,0 +1,33 @@
+/******************************************************************************
+* Copyright 2017 by Demitrius Belai <[email protected]> *
+* *
+* This library is free software; you can redistribute it and/or *
+* modify it under the terms of the GNU Library General Public *
+* License as published by the Free Software Foundation; either *
+* version 2 of the License, or (at your option) any later version. *
+* *
+* This library is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+* Library General Public License for more details. *
+* *
+* You should have received a copy of the GNU Library General Public License *
+* along with this library; see the file COPYING.LIB. If not, write to *
+* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+* Boston, MA 02110-1301, USA. *
+*******************************************************************************/
+
+#ifndef DECORATIONPACKAGE_H
+#define DECORATIONPACKAGE_H
+
+#include <KPackage/PackageStructure>
+
+class DecorationPackage : public KPackage::PackageStructure
+{
+public:
+ DecorationPackage(QObject*, const QVariantList &) {}
+ void initPackage(KPackage::Package *package) Q_DECL_OVERRIDE;
+ void pathChanged(KPackage::Package *package) Q_DECL_OVERRIDE;
+};
+
+#endif
diff --git a/packageplugins/decoration/kwin-packagestructure-decoration.desktop b/packageplugins/decoration/kwin-packagestructure-decoration.desktop
new file mode 100644
index 0000000..2e362d4
--- /dev/null
+++ b/packageplugins/decoration/kwin-packagestructure-decoration.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Name=KWin Decoration
+Type=Service
+X-KDE-ServiceTypes=KPackage/PackageStructure
+X-KDE-Library=kwin_packagestructure_decoration
+
+X-KDE-PluginInfo-Author=Demitrius Belai
+X-KDE-PluginInfo-Name=KWin/Decoration
+X-KDE-PluginInfo-Version=1