diff options
author | Ken Moore <ken@pcbsd.org> | 2015-04-29 11:12:12 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2015-04-29 11:41:54 -0400 |
commit | a209ff054390f7f0b1f51d5358891e9a839b3888 (patch) | |
tree | 42122aab02ff913476bb188118e39eb3bb988070 /lumina-wm-INCOMPLETE/LScreenSaver.cpp | |
parent | Add the "file:" flag to the beginning of any local file in lumina-open if the... (diff) | |
download | lumina-a209ff054390f7f0b1f51d5358891e9a839b3888.tar.gz lumina-a209ff054390f7f0b1f51d5358891e9a839b3888.tar.bz2 lumina-a209ff054390f7f0b1f51d5358891e9a839b3888.zip |
Rename the lumina-wm directory to lumina-wm-INCOMPLETE so people know it is not ready yet. Also update the readme with the information about the new release.
Diffstat (limited to 'lumina-wm-INCOMPLETE/LScreenSaver.cpp')
-rw-r--r-- | lumina-wm-INCOMPLETE/LScreenSaver.cpp | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/lumina-wm-INCOMPLETE/LScreenSaver.cpp b/lumina-wm-INCOMPLETE/LScreenSaver.cpp new file mode 100644 index 00000000..7af3758f --- /dev/null +++ b/lumina-wm-INCOMPLETE/LScreenSaver.cpp @@ -0,0 +1,97 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2015, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "LScreenSaver.h" + +LScreenSaver::LScreenSaver(){ + starttimer = new QTimer(this); + starttimer->setSingleShot(true); + locktimer = new QTimer(this); + locktimer->setSingleShot(true); + hidetimer = new QTimer(this); + hidetimer->setSingleShot(true); + + settings = new QSettings("LuminaDE","lumina-screensaver",this); + SSRunning = SSLocked = false; + + connect(starttimer, SIGNAL(timeout()), this, SLOT(ShowScreenSaver()) ); +} + +LScreenSaver::~LScreenSaver(){ + +} + +// =========== +// PUBLIC SLOTS +// =========== +void LScreenSaver::start(){ + reloadSettings(); //setup all the initial time frames + +} + +void LScreenSaver::reloadSettings(){ + settings->sync(); + starttimer->setInterval( settings.value("timedelaymin",10).toInt() * 60000 ); + locktimer->setInterval( settings.value("lockdelaymin",1).toInt() * 60000 ); + hidetimer->setInterval( settings.value("hidesecs",15).toInt() * 1000 ); +} + +void LScreenSaver::newInputEvent(){ + //First stop any timers that are running + if(starttimer->isActive()){ starttimer->stop();} + if(locktimer->isActive()){ locktimer->stop(); } + if(hidetimer->isActive()){ hidetimer->stop(); } + + if(SSRunning && SSLocked){ + //Running and locked + // Hide the running setting, and display the lock screen + + //Start the timer for restarting the SS and hiding the lockscreen + hidetimer->start(); + + }else if(SSRunning){ + //Only running, not locked + //De-activate the screensaver and start the main timer + HideScreenSaver(); + starttimer->start(); + + }else if(SSLocked){ + //Only locked, not running + hidetimer->start(); //restart the time to hide the lock screen + + }else{ + //Neither running nor locked + if( settings.value("timedelaymin",10).toInt() > 0 ){ starttimer->start(); } + } + +} + +// =========== +// PRIVATE SLOTS +// =========== +void LScreenSaver::ShowScreenSaver(){ + + SSRunning = true; + //Start the lock timer if necessary + if(!SSLocked && (settings.value("lockdelaymin",10).toInt()>0) ){ locktimer->start(); } +} + +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; +} + +void LScreenSaver::HideLockScreen(){ + + //Leave the Locked flag set (still locked, just not visible) +} |