diff options
4 files changed, 138 insertions, 2 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Matrix.json b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Matrix.json new file mode 100644 index 00000000..52cd16ee --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Matrix.json @@ -0,0 +1,25 @@ +{ + "name" : { + "default" : "Matrix" + }, + "description" : { + "default" : "Erratic falling columns of various characters with a set color" + }, + "author" : { + "name" : "Zackary Welch", + "email" : "zwelch@ixsystems.com", + "website" : "https://github.com/ZackaryWelch", + "company" : "iXsystems", + "company_website" : "http://ixsystems.com" + }, + "meta" : { + "license" : "3-clause BSD", + "license_url" : "https://github.com/trueos/lumina/blob/master/LICENSE", + "copyright" : "Copyright (c) 2017, Ken Moore (ken@ixsystems.com)", + "date_created" : "20180103", + "version" : "1.0" + }, + "qml" : { + "exec" : "qml_scripts/Matrix.qml" + } +} diff --git a/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/qml_scripts/Matrix.qml b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/qml_scripts/Matrix.qml new file mode 100644 index 00000000..1ab4b96c --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/qml_scripts/Matrix.qml @@ -0,0 +1,74 @@ +// vi: ft=qml +import QtQuick 2.0 +import QtMultimedia 5.7 +import QtQuick.Window 2.2 + +Rectangle { + width: Window.width + height: Window.height + color: "black" + + Row{ + id: masterRow + anchors.left: parent.left + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width + spacing: 5 + Repeater { + id: cR + model: Window.width / 15 + 1 + Column { + id: masterColumn + width: 10 + Text { + id: column + color: "red" + font.pixelSize: 10 + transform: Rotation { origin.x: 0; origin.y: 0; angle: 90 } + Timer { + //interval: Math.random() * ((cR.index % 2) ? 50 : 20) + ((cR.index % 2) ? 90 : 70) + interval: 50 + repeat: true + running: true + onTriggered: { + if(Math.random() < 0.95) { + var bottom = column.text.charAt(column.text.length-1) + var newString = bottom+column.text.substring(0, column.text.length-1) + column.text = newString + //interval = Math.random() * ((cR.index % 2) ? 50 : 20) + ((cR.index % 2) ? 90 : 70) + interval = 50 + }else{ + interval = 1000 + } + } + } + Component.onCompleted: { + var str = " " + var numberChar = Math.random() * 100 + (Window.height * 0.1); + if(Math.random() < 0.80) { + while(str.length < numberChar) { + if(Math.random() < 0.5) { + var charCount = Math.random() * 8 + 10 + var segStr = "" + while(segStr.length < charCount) { + var randChar = String.fromCharCode(0x30A0 + Math.random() * (0x30FF-0x30A0+1)); + segStr += randChar + } + str += segStr + }else{ + var charCount = Math.random() * 6 + 14 + var segStr = "" + while(segStr.length < charCount) { + segStr += " " + } + str += segStr + } + } + } + column.text = str + } + } + } + } + } +} 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 |