diff options
author | ZackaryWelch <welch.zackary@gmail.com> | 2018-01-02 18:02:40 -0500 |
---|---|---|
committer | ZackaryWelch <welch.zackary@gmail.com> | 2018-01-02 18:02:40 -0500 |
commit | f8babd8b5c1ad3136d83e45b0304614620aff30e (patch) | |
tree | 243955cd253e1088c7af03dcf5b7dd6d47c2e03f /src-qt5 | |
parent | Updated project files for plugin system (diff) | |
download | lumina-f8babd8b5c1ad3136d83e45b0304614620aff30e.tar.gz lumina-f8babd8b5c1ad3136d83e45b0304614620aff30e.tar.bz2 lumina-f8babd8b5c1ad3136d83e45b0304614620aff30e.zip |
Added some specific data for desktop plugins into the JSON reader
Diffstat (limited to 'src-qt5')
-rw-r--r-- | src-qt5/src-cpp/plugins-desktop.cpp | 32 | ||||
-rw-r--r-- | src-qt5/src-cpp/plugins-desktop.h | 9 |
2 files changed, 39 insertions, 2 deletions
diff --git a/src-qt5/src-cpp/plugins-desktop.cpp b/src-qt5/src-cpp/plugins-desktop.cpp index fdbd676d..edad2723 100644 --- a/src-qt5/src-cpp/plugins-desktop.cpp +++ b/src-qt5/src-cpp/plugins-desktop.cpp @@ -6,11 +6,15 @@ //=========================================== #include "plugins-desktop.h" +#include <LuminaXDG.h> + // ============ // DT PLUGIN // ============ DTPlugin::DTPlugin(){ - + pluginIcon = QIcon(); + gridSize = QSize(1,1); + panelPossible = false; } DTPlugin::~DTPlugin(){ @@ -22,8 +26,32 @@ bool DTPlugin::isValid(){ bool ok = data.contains("name") && data.contains("qml") && data.contains("description"); ok &= containsDefault("name"); ok &= containsDefault("description"); + ok &= containsDefault("data"); if(ok) { - QJsonObject tmp = data.value("qml").toObject(); + QJsonObject tmp = data.value("data").toObject(); + + QString possibleS = tmp.value("panel_possible").toString(); + if(!possibleS.isEmpty() and (possibleS == "yes" or possibleS == "true")) + panelPossible = true; + + QString gridS = tmp.value("grid_size").toString(); + if(!gridS.isEmpty()) { + QStringList gridList = gridS.split("x"); + if(gridList.size() == 2) { + int width = gridList[0].toInt(); + int height = gridList[1].toInt(); + if(width != 0 and height != 0) + gridSize = QSize(width, height); + } + } + + QString iconS = tmp.value("plugin_icon").toString(); + if(!iconS.isEmpty()) { + pluginIcon = LXDG::findIcon(iconS,""); + } + + tmp = data.value("qml").toObject(); + QStringList mustexist; QString exec = tmp.value("exec").toString(); if(exec.isEmpty() || !exec.endsWith(".qml")){ return false; } diff --git a/src-qt5/src-cpp/plugins-desktop.h b/src-qt5/src-cpp/plugins-desktop.h index ed576db1..4d34f188 100644 --- a/src-qt5/src-cpp/plugins-desktop.h +++ b/src-qt5/src-cpp/plugins-desktop.h @@ -17,13 +17,22 @@ #include <QFile> #include <QDir> #include <QDebug> +#include <QIcon> class DTPlugin : public BasePlugin{ +private: + QSize gridSize; + bool panelPossible; + QIcon pluginIcon; public: DTPlugin(); ~DTPlugin(); virtual bool isValid() Q_DECL_OVERRIDE; + + QSize getSize { return gridSize; } + bool getPanelable { return panelPossible; } + QIcon getIcon { return pluginIcon; } }; #endif |