diff options
author | Ken Moore <ken@pcbsd.org> | 2015-03-25 12:45:49 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2015-03-25 12:45:49 -0400 |
commit | 2a43d04950e1c7c364b03fe5552e2d687b8845b0 (patch) | |
tree | 6abb976c9a43a67a9744833df2ea3fe79db9330b | |
parent | Add a new information file: DeveloperGuidelines.txt (diff) | |
download | lumina-2a43d04950e1c7c364b03fe5552e2d687b8845b0.tar.gz lumina-2a43d04950e1c7c364b03fe5552e2d687b8845b0.tar.bz2 lumina-2a43d04950e1c7c364b03fe5552e2d687b8845b0.zip |
Add my "work-in-progress" on lumina-wm (screensaver implementation so far) to GIt. This is *not* ready to be built, much less used yet.
-rw-r--r-- | lumina-wm/LScreenSaver.cpp | 97 | ||||
-rw-r--r-- | lumina-wm/LScreenSaver.h | 43 | ||||
-rw-r--r-- | lumina-wm/WMSession.h | 40 | ||||
-rw-r--r-- | lumina-wm/lumina-wm.pro | 106 | ||||
-rw-r--r-- | lumina-wm/main.cpp | 40 |
5 files changed, 326 insertions, 0 deletions
diff --git a/lumina-wm/LScreenSaver.cpp b/lumina-wm/LScreenSaver.cpp new file mode 100644 index 00000000..7af3758f --- /dev/null +++ b/lumina-wm/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) +} diff --git a/lumina-wm/LScreenSaver.h b/lumina-wm/LScreenSaver.h new file mode 100644 index 00000000..c2965ae6 --- /dev/null +++ b/lumina-wm/LScreenSaver.h @@ -0,0 +1,43 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2015, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_DESKTOP_SCREEN_SAVER_H +#define _LUMINA_DESKTOP_SCREEN_SAVER_H + +#include <QObject> +#include <QStringList> +#include <QTimer> +#include <QSettings> + +class LScreenSaver : public QObject{ + Q_OBJECT +public: + LScreenSaver(); + ~LScreenSaver(); + +private: + QTimer *starttimer, *locktimer, *hidetimer; + QSettings *settings; + bool SSRunning, SSLocked; + +public slots: + void start(); + void reloadSettings(); + void newInputEvent(); + +private slots: + void ShowScreenSaver(); + void ShowLockScreen(); + void HideScreenSaver(); + void HideLockScreen(); + +signals: + void StartingScreenSaver(); + void ClosingScreenSaver(); + +}; + +#endif
\ No newline at end of file diff --git a/lumina-wm/WMSession.h b/lumina-wm/WMSession.h new file mode 100644 index 00000000..a1212af5 --- /dev/null +++ b/lumina-wm/WMSession.h @@ -0,0 +1,40 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2015, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_DESKTOP_WINDOW_MANAGER_SESSION_H +#define _LUMINA_DESKTOP_WINDOW_MANAGER_SESSION_H + +#include <QObject> +#include <QStringList> + +#include "LScreenSaver.h" + +class WMSession : public QObject{ + Q_OBJECT +public: + WMSession(); + ~WMSession(); + + void start(); + +private: + //XCB Event Watcher + + //ScreenSaver + LScreenSaver *SS; + + //Window Manager + + +public slots: + void reloadIcons(); + void newInputsAvailable(QStringList); + +private slots: + +}; + +#endif
\ No newline at end of file diff --git a/lumina-wm/lumina-wm.pro b/lumina-wm/lumina-wm.pro new file mode 100644 index 00000000..34d8a9ac --- /dev/null +++ b/lumina-wm/lumina-wm.pro @@ -0,0 +1,106 @@ + +QT += core gui network +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets x11extras + +TARGET = lumina-wm +isEmpty(PREFIX) { + PREFIX = /usr/local +} +target.path = $$PREFIX/bin + +isEmpty(LIBPREFIX) { + LIBPREFIX = $$PREFIX/lib +} + +LIBS += -L../libLumina -L$$LIBPREFIX -lLuminaUtils -lXdamage -lX11 -lxcb -lxcb-damage +QMAKE_LIBDIR = ../libLumina +DEPENDPATH += ../libLumina + +TEMPLATE = app + +isEmpty(QT5LIBDIR) { + QT5LIBDIR = $$PREFIX/lib/qt5 +} + +LRELEASE = $$QT5LIBDIR/bin/lrelease + + +SOURCES += main.cpp \ + WMSession.cpp \ + LScreenSaver.cpp + + +HEADERS += WMSession.h \ + LScreenSaver.h + +FORMS += + +INCLUDEPATH += ../libLumina $$PREFIX/include + +TRANSLATIONS = i18n/lumina-wm_af.ts \ + i18n/lumina-wm_ar.ts \ + i18n/lumina-wm_az.ts \ + i18n/lumina-wm_bg.ts \ + i18n/lumina-wm_bn.ts \ + i18n/lumina-wm_bs.ts \ + i18n/lumina-wm_ca.ts \ + i18n/lumina-wm_cs.ts \ + i18n/lumina-wm_cy.ts \ + i18n/lumina-wm_da.ts \ + i18n/lumina-wm_de.ts \ + i18n/lumina-wm_el.ts \ + i18n/lumina-wm_en_GB.ts \ + i18n/lumina-wm_en_ZA.ts \ + i18n/lumina-wm_es.ts \ + i18n/lumina-wm_et.ts \ + i18n/lumina-wm_eu.ts \ + i18n/lumina-wm_fa.ts \ + i18n/lumina-wm_fi.ts \ + i18n/lumina-wm_fr.ts \ + i18n/lumina-wm_fr_CA.ts \ + i18n/lumina-wm_gl.ts \ + i18n/lumina-wm_he.ts \ + i18n/lumina-wm_hi.ts \ + i18n/lumina-wm_hr.ts \ + i18n/lumina-wm_hu.ts \ + i18n/lumina-wm_id.ts \ + i18n/lumina-wm_is.ts \ + i18n/lumina-wm_it.ts \ + i18n/lumina-wm_ja.ts \ + i18n/lumina-wm_ka.ts \ + i18n/lumina-wm_ko.ts \ + i18n/lumina-wm_lt.ts \ + i18n/lumina-wm_lv.ts \ + i18n/lumina-wm_mk.ts \ + i18n/lumina-wm_mn.ts \ + i18n/lumina-wm_ms.ts \ + i18n/lumina-wm_mt.ts \ + i18n/lumina-wm_nb.ts \ + i18n/lumina-wm_nl.ts \ + i18n/lumina-wm_pa.ts \ + i18n/lumina-wm_pl.ts \ + i18n/lumina-wm_pt.ts \ + i18n/lumina-wm_pt_BR.ts \ + i18n/lumina-wm_ro.ts \ + i18n/lumina-wm_ru.ts \ + i18n/lumina-wm_sk.ts \ + i18n/lumina-wm_sl.ts \ + i18n/lumina-wm_sr.ts \ + i18n/lumina-wm_sv.ts \ + i18n/lumina-wm_sw.ts \ + i18n/lumina-wm_ta.ts \ + i18n/lumina-wm_tg.ts \ + i18n/lumina-wm_th.ts \ + i18n/lumina-wm_tr.ts \ + i18n/lumina-wm_uk.ts \ + i18n/lumina-wm_uz.ts \ + i18n/lumina-wm_vi.ts \ + i18n/lumina-wm_zh_CN.ts \ + i18n/lumina-wm_zh_HK.ts \ + i18n/lumina-wm_zh_TW.ts \ + i18n/lumina-wm_zu.ts + +dotrans.path=$$PREFIX/share/Lumina-DE/i18n/ +dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)$$PREFIX/share/Lumina-DE/i18n/ + +INSTALLS += target dotrans diff --git a/lumina-wm/main.cpp b/lumina-wm/main.cpp new file mode 100644 index 00000000..b19b00e3 --- /dev/null +++ b/lumina-wm/main.cpp @@ -0,0 +1,40 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2015, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include <QDebug> + +#include <QFile> +#include <QDir> +#include <QString> +#include <QTextStream> +#include <QUrl> + + +#include "WMSession.h" + +#include <LuminaXDG.h> //from libLuminaUtils +#include <LuminaThemes.h> +#include <LuminaSingleApplication.h> + +//#define DEBUG 0 + +int main(int argc, char ** argv) +{ + LSingleApplication a(argc, argv, "lumina-wm"); + if(!a.isPrimaryProcess()){ return 0; } //Inputs forwarded on to the primary already + LuminaThemeEngine themes(&a); + + //Setup the special settings prefix location + QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina"); + + WMSession w; + w.start(); + QObject::connect(themes, SIGNAL(updateIcons()), &w, SLOT(reloadIcons()) ); + QObject::connect(a, SIGNAL(InputsAvailable(QStringList)), &w, SLOT(newInputsAvailable(QStringList)) ); + int retCode = a.exec(); + + return retCode; +} |