From 125c5cc3c0cee38819271efdc712d32765dd1e2f Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 10 Jan 2017 11:57:33 -0500 Subject: A few more code changes for Lumina2. --- src-qt5/core/lumina-desktop-unified/LSession.cpp | 37 ++++++++-------------- src-qt5/core/lumina-desktop-unified/LSession.h | 2 ++ .../core/lumina-desktop-unified/global-includes.h | 3 ++ .../core/lumina-desktop-unified/global-objects.h | 1 + 4 files changed, 19 insertions(+), 24 deletions(-) (limited to 'src-qt5/core') diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp index 2f6e371a..82fb4a4b 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.cpp +++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp @@ -8,7 +8,6 @@ #include "global-objects.h" #include "BootSplash.h" - #ifndef DEBUG #define DEBUG 0 #endif @@ -18,6 +17,7 @@ LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lu mediaObj = 0; //private object used for playing login/logout chimes Lumina::EFILTER = 0; Lumina::SS = 0; + Lumina::SETTINGS = 0; //Lumina::WM = 0; Lumina::EVThread = 0; @@ -36,20 +36,26 @@ LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lu //Now initialize the global objects (but do not start them yet) Lumina::EFILTER = new EventFilter(); //Need the XCB Event filter + Lumina::SETTINGS = new DesktopSettings(); Lumina::SS = new LScreenSaver(); //Lumina::WM = new LWindowManager(); //Now put the Event Filter into it's own thread to keep things snappy Lumina::EVThread = new QThread(); Lumina::EFILTER->moveToThread(Lumina::EVThread); - + Lumina::EVThread->start(); } //end check for primary process } LSession::~LSession(){ //Clean up the global objects as needed - - + if(Lumina::EFILTER!=0){ Lumina::EFILTER->deleteLater(); } + if(Lumina::SS!=0){ Lumina::SS->deleteLater(); } + if(Lumina::EVThread!=0){ + if(Lumina::EVThread->isRunning()){ Lumina::EVThread->quit(); } + Lumina::EVThread->deleteLater(); + } + if(Lumina::SETTINGS!=0){ Lumina::SETTINGS->deleteLater(); } } void LSession::setupSession(){ @@ -66,6 +72,7 @@ void LSession::setupSession(){ //Setup the QSettings default paths splash.showScreen("settings"); if(DEBUG){ qDebug() << " - Init QSettings:" << timer->elapsed();} + Lumina::SETTINGS->start(); /*sessionsettings = new QSettings("lumina-desktop", "sessionsettings"); DPlugSettings = new QSettings("lumina-desktop","pluginsettings/desktopsettings"); //Load the proper translation files @@ -154,30 +161,12 @@ void LSession::CleanupSession(){ LUtils::writeFile("/tmp/.luminastopping",QStringList() << "yes", true); //Start the logout chimes (if necessary) LOS::setAudioVolume( LOS::audioVolume() ); //make sure the audio volume is saved in the backend for the next login - bool playaudio = sessionsettings->value("PlayLogoutAudio",true).toBool(); + bool playaudio = Lumina::SETTINGS->value(DesktopSettings::Session,"PlayLogoutAudio",true).toBool(); if( playaudio ){ playAudioFile(LOS::LuminaShare()+"Logout.ogg"); } //Stop the background system tray (detaching/closing apps as necessary) //stopSystemTray(!cleansession); //Now perform any other cleanup - if(cleansession){ - //Close any open windows - //qDebug() << " - Closing any open windows"; - /*QList WL = XCB->WindowList(true); - for(int i=0; iWindowClass(WL[i]) << WL[i]; - XCB->CloseWindow(WL[i]); - LSession::processEvents(); - } - //Now wait a moment for things to close down before quitting - for(int i=0; i<20; i++){ LSession::processEvents(); usleep(25); } //1/2 second pause - //Kill any remaining windows - WL = XCB->WindowList(true); //all workspaces - for(int i=0; iWindowClass(WL[i]) << WL[i]; - XCB->KillClient(WL[i]); - LSession::processEvents(); - }*/ - } + Lumina::EFILTER->stop(); //evFilter->StopEventHandling(); //Now wait a moment for things to close down before quitting if(playaudio){ diff --git a/src-qt5/core/lumina-desktop-unified/LSession.h b/src-qt5/core/lumina-desktop-unified/LSession.h index c89bc66d..d9c652c6 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.h +++ b/src-qt5/core/lumina-desktop-unified/LSession.h @@ -25,6 +25,8 @@ private: QMediaObject *mediaObj; void playAudioFile(QString filepath); + QTranslator *currTranslator; + public slots: void StartLogout(); void StartShutdown(bool skipupdates = false); diff --git a/src-qt5/core/lumina-desktop-unified/global-includes.h b/src-qt5/core/lumina-desktop-unified/global-includes.h index 006ecedf..c7433155 100644 --- a/src-qt5/core/lumina-desktop-unified/global-includes.h +++ b/src-qt5/core/lumina-desktop-unified/global-includes.h @@ -56,6 +56,9 @@ #include #include +// Standard C includes +#include + //Setup any global defines (no classes or global objects: use "global-objects.h" for that) namespace Lumina{ //Flags/enumerations diff --git a/src-qt5/core/lumina-desktop-unified/global-objects.h b/src-qt5/core/lumina-desktop-unified/global-objects.h index 8485ffe6..579807c7 100644 --- a/src-qt5/core/lumina-desktop-unified/global-objects.h +++ b/src-qt5/core/lumina-desktop-unified/global-objects.h @@ -32,6 +32,7 @@ namespace Lumina{ //Data structures and objects extern EventFilter *EFILTER; //Native Event Watcher + extern DesktopSettings *SETTINGS; //All Settings files //ScreenSaver extern LScreenSaver *SS; //Window Manager -- cgit