aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-10-11 10:34:53 -0400
committerKen Moore <ken@ixsystems.com>2017-10-11 10:34:53 -0400
commitdfac324cb6b02d19857f0e5dcced099d31ce957d (patch)
treeb1b389b458c425fd67cbc624841f8bb22b5af13b /src-qt5/core/lumina-desktop-unified
parentWrite up the new ScreenSaver plugins management class (untested) (diff)
downloadlumina-dfac324cb6b02d19857f0e5dcced099d31ce957d.tar.gz
lumina-dfac324cb6b02d19857f0e5dcced099d31ce957d.tar.bz2
lumina-dfac324cb6b02d19857f0e5dcced099d31ce957d.zip
Get the Lumina2 screensaver system converted over to the new QML-backed plugin system.
Still need to clean up some old files within the source tree, but it all works right now.
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified')
-rw-r--r--src-qt5/core/lumina-desktop-unified/LSession.cpp4
-rw-r--r--src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Fireflies.json2
-rw-r--r--src-qt5/core/lumina-desktop-unified/global-includes.h1
-rw-r--r--src-qt5/core/lumina-desktop-unified/lumina-desktop.pro13
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.cpp63
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.h12
6 files changed, 39 insertions, 56 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp
index d70ff973..bace2dbe 100644
--- a/src-qt5/core/lumina-desktop-unified/LSession.cpp
+++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp
@@ -356,12 +356,12 @@ void LSession::launchStartupApps(){
void LSession::checkUserFiles(){
//internal version conversion examples:
// [1.0.0 -> 1000000], [1.2.3 -> 1002003], [0.6.1 -> 6001]
- QString OVS = DesktopSettings::instance()->value(DesktopSettings::System,"DesktopVersion","0").toString(); //Old Version String
+ /*QString OVS = DesktopSettings::instance()->value(DesktopSettings::System,"DesktopVersion","0").toString(); //Old Version String
bool changed = LDesktopUtils::checkUserFiles(OVS);
if(changed){
//Save the current version of the session to the settings file (for next time)
DesktopSettings::instance()->setValue(DesktopSettings::System,"DesktopVersion", this->applicationVersion());
- }
+ }*/
}
diff --git a/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Fireflies.json b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Fireflies.json
index 8d0d25c4..c09de308 100644
--- a/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Fireflies.json
+++ b/src-qt5/core/lumina-desktop-unified/extrafiles/screensavers/Fireflies.json
@@ -20,7 +20,7 @@
"version" : "1.0"
},
"qml" : {
- "qml_file" : "qml_scripts/Fireflies.qml",
+ "exec" : "qml_scripts/Fireflies.qml",
"additional_files" : ["qml_scripts/Firefly.qml"]
}
}
diff --git a/src-qt5/core/lumina-desktop-unified/global-includes.h b/src-qt5/core/lumina-desktop-unified/global-includes.h
index 184f5b8d..ba1beb06 100644
--- a/src-qt5/core/lumina-desktop-unified/global-includes.h
+++ b/src-qt5/core/lumina-desktop-unified/global-includes.h
@@ -53,6 +53,7 @@
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonDocument>
+#include <QQuickView>
// libLumina includes
diff --git a/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro b/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro
index 9b0c2fb3..6b9ee876 100644
--- a/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro
+++ b/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro
@@ -1,8 +1,15 @@
include($${PWD}/../../OS-detect.pri)
-QT += core gui network
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets x11extras multimedia multimediawidgets concurrent svg
+lessThan(QT_MAJOR_VERSION, 5) {
+ message("[ERROR] Qt 5.4+ is required to use the Lumina Desktop!")
+ exit
+}
+lessThan(QT_MINOR_VERSION, 4){
+ message("[ERROR] Qt 5.4+ is required to use the Lumina Desktop!")
+ exit
+}
+QT *= core gui network widgets x11extras multimedia multimediawidgets concurrent svg quick qml
TARGET = lumina-desktop-unified
@@ -22,6 +29,8 @@ include(../libLumina/NativeWindow.pri)
include(../libLumina/XDGMime.pri)
include(../libLumina/LIconCache.pri)
+include(../../src-cpp/plugins-screensaver.pri)
+
#include all the main individual source groups
include(src-screensaver/screensaver.pri)
include(src-events/events.pri)
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.cpp b/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.cpp
index a6d5be60..227e51ac 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.cpp
@@ -12,10 +12,11 @@
// ========
// PUBLIC
// ========
-SSBaseWidget::SSBaseWidget(QWidget *parent) : QWidget(parent){
+SSBaseWidget::SSBaseWidget(QWidget *parent) : QQuickView(parent->windowHandle()){
this->setObjectName("LuminaBaseSSWidget");
- ANIM = 0;
- this->setMouseTracking(true);
+ this->setResizeMode(QQuickView::SizeRootObjectToView);
+ this->setColor(QColor("black")); //default color for the view
+ //this->setMouseTracking(true);
plugType="none";
restartTimer = new QTimer(this);
restartTimer->setInterval( DesktopSettings::instance()->value(DesktopSettings::ScreenSaver, "globals/plugin_time_seconds", 60).toInt() * 1000);
@@ -24,7 +25,6 @@ SSBaseWidget::SSBaseWidget(QWidget *parent) : QWidget(parent){
}
SSBaseWidget::~SSBaseWidget(){
- if(ANIM!=0){ this->stopPainting(); }
}
void SSBaseWidget::setPlugin(QString plug){
@@ -35,54 +35,27 @@ void SSBaseWidget::setPlugin(QString plug){
// PUBLIC SLOTS
// =============
void SSBaseWidget::startPainting(){
- cplug = plugType;
//free up any old animation instance
- if(ANIM!=0){
- stopPainting();
- }
+ stopPainting();
//If a random plugin - grab one of the known plugins
- if(cplug=="random"){
- QStringList valid = BaseAnimGroup::KnownAnimations();
- valid.removeAll("none"); //they want a screensaver - remove the "none" option from the valid list
- if(valid.isEmpty()){ cplug = "none"; } //no known plugins
- else{ cplug = valid[ qrand()%valid.length() ]; } //grab a random plugin
- }
- if(DEBUG){ qDebug() << " - Screen Saver:" << plugType << cplug; }
- //Now list all the various plugins and start them appropriately
- QString style;
- if(cplug=="none"){
- style = "background: black;"; //show the underlying black parent widget
- }else{
- style = "background: black;";
+ if(plugType=="random"){
+ QList<SSPlugin> valid = SSPluginSystem::findAllPlugins();
+ if(!valid.isEmpty()){ cplug = valid[ qrand()%valid.length() ]; } //grab a random plugin
+ }else if(plugType!="none"){
+ cplug = SSPluginSystem::findPlugin(plugType);
}
- this->setStyleSheet("QWidget#LuminaBaseSSWidget{ "+style+"}");
- this->repaint();
- //If not a stylesheet-based plugin - set it here
- if(cplug!="none"){
- ANIM = BaseAnimGroup::NewAnimation(cplug, this);
- connect(ANIM, SIGNAL(finished()), this, SLOT(startPainting()) ); //repeat the plugin as needed
- ANIM->LoadAnimations();
+ if(DEBUG){ qDebug() << " - Screen Saver:" << plugType << cplug.scriptURL() << cplug.isValid(); }
+ if(cplug.isValid()){
+ this->setSource( cplug.scriptURL() );
+ restartTimer->start();
}
- //Now start the animation(s)
- if(ANIM!=0){
- if(ANIM->animationCount()>0){
- if(DEBUG){ qDebug() << " - Starting SS Plugin:" << cplug << ANIM->animationCount() << ANIM->duration() << ANIM->loopCount(); }
- ANIM->start();
- }
- }
- restartTimer->start();
+
}
void SSBaseWidget::stopPainting(){
- if(ANIM!=0){
- if(DEBUG){ qDebug() << "Stopping Animation!!"; }
- ANIM->stop();
- //ANIM->clear();
- ANIM->deleteLater();
- ANIM = 0;
- //Delete any child widgets of the canvas
- QList<QWidget*> widgets = this->findChildren<QWidget*>("",Qt::FindDirectChildrenOnly);
- for(int i=0; i<widgets.length(); i++){ widgets[i]->deleteLater(); }
+ if(!this->source().isEmpty()){
+ this->setSource(QUrl());
+ cplug = SSPlugin(); //empty structure
}
if(restartTimer->isActive()){ restartTimer->stop(); }
}
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.h b/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.h
index af809127..fdb23e66 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.h
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.h
@@ -10,9 +10,9 @@
#define _LUMINA_DESKTOP_SCREEN_SAVER_BASE_WIDGET_H
#include "global-includes.h"
-#include "animations/BaseAnimGroup.h"
+#include <plugins-screensaver.h>
-class SSBaseWidget : public QWidget{
+class SSBaseWidget : public QQuickView{
Q_OBJECT
public:
SSBaseWidget(QWidget *parent);
@@ -25,8 +25,8 @@ public slots:
void stopPainting();
private:
- QString plugType, cplug; //type of custom painting to do
- BaseAnimGroup *ANIM;
+ QString plugType;
+ SSPlugin cplug;
QTimer *restartTimer;
private slots:
@@ -43,12 +43,12 @@ protected:
ev->accept();
emit InputDetected();
}
- void paintEvent(QPaintEvent*){
+ /*void paintEvent(QPaintEvent*){
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
- }
+ }*/
};
bgstack15