aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/src-cpp/plugins-desktop.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/src-cpp/plugins-desktop.cpp')
-rw-r--r--src-qt5/src-cpp/plugins-desktop.cpp58
1 files changed, 31 insertions, 27 deletions
diff --git a/src-qt5/src-cpp/plugins-desktop.cpp b/src-qt5/src-cpp/plugins-desktop.cpp
index edad2723..19c49942 100644
--- a/src-qt5/src-cpp/plugins-desktop.cpp
+++ b/src-qt5/src-cpp/plugins-desktop.cpp
@@ -12,13 +12,9 @@
// DT PLUGIN
// ============
DTPlugin::DTPlugin(){
- pluginIcon = QIcon();
- gridSize = QSize(1,1);
- panelPossible = false;
}
DTPlugin::~DTPlugin(){
-
}
bool DTPlugin::isValid(){
@@ -28,30 +24,8 @@ bool DTPlugin::isValid(){
ok &= containsDefault("description");
ok &= containsDefault("data");
if(ok) {
- 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);
- }
- }
+ QJsonObject tmp = data.value("qml").toObject();
- 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; }
@@ -66,3 +40,33 @@ bool DTPlugin::isValid(){
}
return ok;
}
+
+QSize DTPlugin::getSize(){
+ QString gridS = data.value("data").toObject().value("grid_size").toString();
+ QSize gridSize(0,0);
+ 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 && height > 0)
+ gridSize = QSize(width, height);
+ }
+ }
+ return gridSize;
+}
+
+bool DTPlugin::supportsPanel(){
+ QString possibleS = data.value("data").toObject().value("panel_possible").toString().toLower();
+ bool panelPossible = false;
+ if(!possibleS.isEmpty() && (possibleS == "yes" || possibleS == "true")){
+ panelPossible = true;
+ }
+ return panelPossible;
+}
+
+QString DTPlugin::getIcon(){
+ QString iconS = data.value("data").toObject().value("plugin_icon").toString();
+ if(iconS.isEmpty()){ iconS = "preferences-plugin"; }
+ return iconS;
+}
bgstack15