From b2c02af28049c4feed7a845505ef9a931237056a Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 2 Nov 2015 10:31:39 -0500 Subject: Add all the animations framework for the screensaver side of lumina-wm (with a quick "sample" plugin). --- lumina-wm-INCOMPLETE/LScreenSaver.cpp | 50 ++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 7 deletions(-) (limited to 'lumina-wm-INCOMPLETE/LScreenSaver.cpp') diff --git a/lumina-wm-INCOMPLETE/LScreenSaver.cpp b/lumina-wm-INCOMPLETE/LScreenSaver.cpp index a903701c..3b1d5e6a 100644 --- a/lumina-wm-INCOMPLETE/LScreenSaver.cpp +++ b/lumina-wm-INCOMPLETE/LScreenSaver.cpp @@ -5,8 +5,10 @@ // See the LICENSE file for full details //=========================================== #include "LScreenSaver.h" +#include +#include -LScreenSaver::LScreenSaver(){ +LScreenSaver::LScreenSaver() : QWidget(0,Qt::BypassWindowManagerHint | Qt::WindowStaysOnTopHint){ starttimer = new QTimer(this); starttimer->setSingleShot(true); locktimer = new QTimer(this); @@ -16,7 +18,8 @@ LScreenSaver::LScreenSaver(){ settings = new QSettings("LuminaDE","lumina-screensaver",this); SSRunning = SSLocked = false; - + this->setObjectName("LSCREENSAVERBASE"); + this->setStyleSheet("LScreenSaver#LSCREENSAVERBASE{ background: black; }"); connect(starttimer, SIGNAL(timeout()), this, SLOT(ShowScreenSaver()) ); } @@ -24,6 +27,10 @@ LScreenSaver::~LScreenSaver(){ } +bool LScreenSaver::isLocked(){ + return SSLocked; +} + // =========== // PUBLIC SLOTS // =========== @@ -48,7 +55,8 @@ void LScreenSaver::newInputEvent(){ if(SSRunning && SSLocked){ //Running and locked // Hide the running setting, and display the lock screen - + HideScreenSaver(); + ShowLockScreen(); //Start the timer for restarting the SS and hiding the lockscreen hidetimer->start(); @@ -73,25 +81,53 @@ void LScreenSaver::newInputEvent(){ // PRIVATE SLOTS // =========== void LScreenSaver::ShowScreenSaver(){ - SSRunning = true; //Start the lock timer if necessary if(!SSLocked && (settings->value("lockdelaymin",10).toInt()>0) ){ locktimer->start(); } + //Now go through and create/show all the various widgets + QList SCREENS = QApplication::screens(); + QRect bounds; + for(int i=0; igeometry()); + if( (BASES.length()-1) < i){ + //Nothing for this screen yet - go ahead and create one + BASES << new SSBaseWidget(this, settings); + } + //Setup the geometry of the base to match the screen + BASES[i]->setGeometry(SCREENS[i]->geometry()); //match this screen geometry + BASES[i]->setPlugin(settings->value("screenplugin"+QString::number(i+1), settings->value("defaultscreenplugin","random").toString() ).toString() ); + + } + //Now remove any extra Base widgets (in case a screen was removed) + for(int i=SCREENS.length(); isetGeometry(bounds); //overall background widget + this->raise(); + this->show(); + this->activateWindow(); + for(int i=0; ishow(); + QTimer::singleShot(100, BASES[i], SLOT(startPainting()) ); //start in 1/2 second + } } void LScreenSaver::ShowLockScreen(){ - SSLocked = true; //Start the timer for hiding the lock screen due to inactivity if(settings->value("hidesecs",15).toInt() > 0 ){ hidetimer->start(); } } void LScreenSaver::HideScreenSaver(){ - SSRunning = false; + if(!SSLocked){ + this->hide(); + emit ClosingScreenSaver(); + } + for(int i=0; i