diff --git a/packageplugins/CMakeLists.txt b/packageplugins/CMakeLists.txt --- 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 --- /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.h b/packageplugins/aurorae/aurorae.h new file mode 100644 --- /dev/null +++ b/packageplugins/aurorae/aurorae.h @@ -0,0 +1,33 @@ +/****************************************************************************** +* Copyright 2017 by Demitrius Belai * +* * +* 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 + +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/aurorae.cpp b/packageplugins/aurorae/aurorae.cpp new file mode 100644 --- /dev/null +++ b/packageplugins/aurorae/aurorae.cpp @@ -0,0 +1,85 @@ +/****************************************************************************** +* Copyright 2017 by Demitrius Belai * +* * +* 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 + +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/kwin-packagestructure-aurorae.desktop b/packageplugins/aurorae/kwin-packagestructure-aurorae.desktop new file mode 100644 --- /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-Email=demitriusbelai@gmail.com +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 --- /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.h b/packageplugins/decoration/decoration.h new file mode 100644 --- /dev/null +++ b/packageplugins/decoration/decoration.h @@ -0,0 +1,33 @@ +/****************************************************************************** +* Copyright 2017 by Demitrius Belai * +* * +* 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 + +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/decoration.cpp b/packageplugins/decoration/decoration.cpp new file mode 100644 --- /dev/null +++ b/packageplugins/decoration/decoration.cpp @@ -0,0 +1,62 @@ +/****************************************************************************** +* Copyright 2017 by Demitrius Belai * +* * +* 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 + +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/kwin-packagestructure-decoration.desktop b/packageplugins/decoration/kwin-packagestructure-decoration.desktop new file mode 100644 --- /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-Email=demitriusbelai@gmail.com +X-KDE-PluginInfo-Name=KWin/Decoration +X-KDE-PluginInfo-Version=1