aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified/src-screensaver
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-screensaver')
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.cpp13
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.cpp65
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.h14
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/screensaver.pri4
4 files changed, 37 insertions, 59 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.cpp b/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.cpp
index 0ff70142..b791ffd2 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.cpp
@@ -77,7 +77,18 @@ void LLockScreen::TryUnlock(){
this->setEnabled(false);
QString pass = ui->line_password->text();
ui->line_password->clear();
- bool ok = (LUtils::runCmd("lumina-checkpass", QStringList() << pass) == 0);
+ //Create a temporary file for the password, then pass that file descriptor to lumina-checkpass
+ QTemporaryFile *TF = new QTemporaryFile(".XXXXXXXXXX");
+ TF->setAutoRemove(true);
+ bool ok = false;
+ if( TF->open() ){
+ QTextStream in(TF);
+ in << pass;
+ in.flush(); //make sure we push it to the file **right now** since we need to keep the file open
+ ok = (LUtils::runCmd("lumina-checkpass", QStringList() << "-f" << TF->fileName() ) == 0);
+ TF->close();
+ }
+ delete TF;
if(ok){
emit ScreenUnlocked();
this->setEnabled(true);
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..122307b3 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/SSBaseWidget.cpp
@@ -12,19 +12,19 @@
// ========
// 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->setCursor(Qt::BlankCursor);
plugType="none";
restartTimer = new QTimer(this);
- restartTimer->setInterval( DesktopSettings::instance()->value(DesktopSettings::ScreenSaver, "globals/plugin_time_seconds", 60).toInt() * 1000);
+ restartTimer->setInterval( DesktopSettings::instance()->value(DesktopSettings::ScreenSaver, "globals/plugin_time_seconds", 120).toInt() * 1000);
restartTimer->setSingleShot(true);
connect(restartTimer, SIGNAL(timeout()), this, SLOT(startPainting()) );
}
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() );
+ if(plugType=="random"){ 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..72e02702 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,6 @@ protected:
ev->accept();
emit InputDetected();
}
- void paintEvent(QPaintEvent*){
- QStyleOption opt;
- opt.init(this);
- QPainter p(this);
- style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
- }
};
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/screensaver.pri b/src-qt5/core/lumina-desktop-unified/src-screensaver/screensaver.pri
index f95891c1..92cc7bd2 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/screensaver.pri
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/screensaver.pri
@@ -9,7 +9,7 @@ HEADERS *= $${PWD}/LLockScreen.h \
FORMS *= $${PWD}/LLockScreen.ui
#update the includepath so we can just (#include <LScreenSaver.h>) as needed without paths
-INCLUDEPATH *= ${PWD}
+INCLUDEPATH *= $${PWD}
#Now include all the screensaver animations/options
-include(animations/animations.pri)
+#include(animations/animations.pri)
bgstack15