diff options
author | Ken Moore <moorekou@gmail.com> | 2015-11-02 10:31:39 -0500 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-11-02 10:31:39 -0500 |
commit | b2c02af28049c4feed7a845505ef9a931237056a (patch) | |
tree | 535afc3e4aba5191a0604e70a78f7ca4a72f0762 /lumina-wm-INCOMPLETE/LScreenSaver.cpp | |
parent | Cleanup how auto-start apps are launched a bit (start them via a single lumin... (diff) | |
download | lumina-b2c02af28049c4feed7a845505ef9a931237056a.tar.gz lumina-b2c02af28049c4feed7a845505ef9a931237056a.tar.bz2 lumina-b2c02af28049c4feed7a845505ef9a931237056a.zip |
Add all the animations framework for the screensaver side of lumina-wm (with a quick "sample" plugin).
Diffstat (limited to 'lumina-wm-INCOMPLETE/LScreenSaver.cpp')
-rw-r--r-- | lumina-wm-INCOMPLETE/LScreenSaver.cpp | 50 |
1 files changed, 43 insertions, 7 deletions
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 <QScreen> +#include <QApplication> -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<QScreen*> SCREENS = QApplication::screens(); + QRect bounds; + for(int i=0; i<SCREENS.length(); i++){ + bounds = bounds.united(SCREENS[i]->geometry()); + 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(); i<BASES.length(); i++){ + delete BASES.takeAt(i); i--; + } + //Now set the overall parent widget geometry and show everything + this->setGeometry(bounds); //overall background widget + this->raise(); + this->show(); + this->activateWindow(); + for(int i=0; i<BASES.length(); i++){ + BASES[i]->show(); + 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<BASES.length(); i++){ QTimer::singleShot(0,BASES[i], SLOT(stopPainting())); } } void LScreenSaver::HideLockScreen(){ - //Leave the Locked flag set (still locked, just not visible) } |