diff options
author | Ken Moore <ken@ixsystems.com> | 2017-07-05 13:30:10 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-07-05 13:30:10 -0400 |
commit | 9c0db82810e95763a34e703a2209fdda7d1ab883 (patch) | |
tree | 21c3d36c2e2815d447dc4fd840d4d44b5f986366 /src-qt5/core | |
parent | Add the ability to use a static "instance()" of the DesktopSettings class wit... (diff) | |
download | lumina-9c0db82810e95763a34e703a2209fdda7d1ab883.tar.gz lumina-9c0db82810e95763a34e703a2209fdda7d1ab883.tar.bz2 lumina-9c0db82810e95763a34e703a2209fdda7d1ab883.zip |
Move Lumina2 over to using the static instance of the DesktopSettings class rather than a global object (lets us use the DesktopSettings within the standalone classes in libLumina as well).
Diffstat (limited to 'src-qt5/core')
4 files changed, 18 insertions, 18 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp index 5aaf99c7..8b4d352f 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.cpp +++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp @@ -18,7 +18,7 @@ NativeWindowSystem* Lumina::NWS = 0; NativeEventFilter* Lumina::NEF = 0; LScreenSaver* Lumina::SS = 0; -DesktopSettings* Lumina::SETTINGS = 0; +//DesktopSettings* Lumina::SETTINGS = 0; //Lumina::WM = 0; QThread* Lumina::EVThread = 0; RootWindow* Lumina::ROOTWIN = 0; @@ -45,11 +45,11 @@ LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lu //Now initialize the global objects (but do not start them yet) Lumina::NEF = new NativeEventFilter(); Lumina::NWS = new NativeWindowSystem(); - Lumina::SETTINGS = new DesktopSettings(); + //Lumina::SETTINGS = new DesktopSettings(); Lumina::SS = new LScreenSaver(); - //Now put the Event Filter into it's own thread to keep things snappy + //Now put the Native Window System into it's own thread to keep things snappy Lumina::EVThread = new QThread(); - Lumina::NEF->moveToThread(Lumina::EVThread); + Lumina::NWS->moveToThread(Lumina::EVThread); Lumina::EVThread->start(); Lumina::ROOTWIN = new RootWindow(); Lumina::APPLIST = new XDGDesktopList(0, true); //keep this list up to date @@ -69,7 +69,7 @@ LSession::~LSession(){ if(Lumina::EVThread->isRunning()){ Lumina::EVThread->quit(); } Lumina::EVThread->deleteLater(); } - if(Lumina::SETTINGS!=0){ Lumina::SETTINGS->deleteLater(); } + if(DesktopSettings::instance()!=0){ DesktopSettings::instance()->deleteLater(); } if(Lumina::ROOTWIN!=0){ Lumina::ROOTWIN->deleteLater(); } if(Lumina::APPLIST!=0){ Lumina::APPLIST->deleteLater(); } } @@ -88,7 +88,7 @@ void LSession::setupSession(){ //Setup the QSettings default paths splash.showScreen("settings"); if(DEBUG){ qDebug() << " - Init QSettings:" << timer->elapsed();} - Lumina::SETTINGS->start(); + DesktopSettings::instance()->start(); /*sessionsettings = new QSettings("lumina-desktop", "sessionsettings"); DPlugSettings = new QSettings("lumina-desktop","pluginsettings/desktopsettings"); //Load the proper translation files @@ -201,7 +201,7 @@ 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 = Lumina::SETTINGS->value(DesktopSettings::Session,"PlayLogoutAudio",true).toBool(); + bool playaudio = DesktopSettings::instance()->value(DesktopSettings::Session,"PlayLogoutAudio",true).toBool(); if( playaudio ){ playAudioFile(LOS::LuminaShare()+"Logout.ogg"); } //Now perform any other cleanup //Lumina::NEF->stop(); @@ -329,7 +329,7 @@ void LSession::launchStartupApps(){ //Enable Numlock if(LUtils::isValidBinary("numlockx")){ //make sure numlockx is installed - if(Lumina::SETTINGS->value(DesktopSettings::System,"EnableNumlock",false).toBool()){ + if(DesktopSettings::instance()->value(DesktopSettings::System,"EnableNumlock",false).toBool()){ QProcess::startDetached("numlockx on"); }else{ QProcess::startDetached("numlockx off"); @@ -350,7 +350,7 @@ void LSession::launchStartupApps(){ qDebug() << " - - Audio Volume:" << QString::number(tmp)+"%"; */ //Now play the login music since we are finished - if(Lumina::SETTINGS->value(DesktopSettings::System,"PlayStartupAudio",true).toBool()){ + if(DesktopSettings::instance()->value(DesktopSettings::System,"PlayStartupAudio",true).toBool()){ //Make sure to re-set the system volume to the last-used value at outset /*int vol = LOS::audioVolume(); if(vol>=0){ LOS::setAudioVolume(vol); }*/ @@ -362,11 +362,11 @@ void LSession::launchStartupApps(){ void LSession::checkUserFiles(){ //internal version conversion examples: // [1.0.0 -> 1000000], [1.2.3 -> 1002003], [0.6.1 -> 6001] - QString OVS = Lumina::SETTINGS->value(DesktopSettings::System,"DesktopVersion","0").toString(); //Old Version String + QString OVS = DesktopSettings::instance()->value(DesktopSettings::System,"DesktopVersion","0").toString(); //Old Version String bool changed = LDesktopUtils::checkUserFiles(OVS); if(changed){ //Save the current version of the session to the settings file (for next time) - Lumina::SETTINGS->setValue(DesktopSettings::System,"DesktopVersion", this->applicationVersion()); + DesktopSettings::instance()->setValue(DesktopSettings::System,"DesktopVersion", this->applicationVersion()); } } diff --git a/src-qt5/core/lumina-desktop-unified/global-objects.h b/src-qt5/core/lumina-desktop-unified/global-objects.h index 8d76772e..474412eb 100644 --- a/src-qt5/core/lumina-desktop-unified/global-objects.h +++ b/src-qt5/core/lumina-desktop-unified/global-objects.h @@ -38,7 +38,7 @@ namespace Lumina{ //extern EventFilter *EFILTER; //Native Event Watcher extern LShortcutEvents *SHORTCUTS; //Keyboard/mouse shortcut events - extern DesktopSettings *SETTINGS; //All Settings files + //extern DesktopSettings *SETTINGS; //All Settings files //ScreenSaver extern LScreenSaver *SS; //Root Window diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.cpp index 0a78fb25..c3e9a1db 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.cpp @@ -19,7 +19,7 @@ void DesktopContextMenu::UpdateMenu(){ this->addAction(wkspaceact); this->addSeparator(); //Now load the user's menu setup and fill the menu - QStringList items = Lumina::SETTINGS->value(DesktopSettings::ContextMenu, "itemlist", QStringList()<< "terminal" << "filemanager" << "line" << "settings" <<"lockdesktop").toStringList(); + QStringList items = DesktopSettings::instance()->value(DesktopSettings::ContextMenu, "itemlist", QStringList()<< "terminal" << "filemanager" << "line" << "settings" <<"lockdesktop").toStringList(); //usewinmenu=false; for(int i=0; i<items.length(); i++){ if(items[i]=="terminal"){ this->addAction(LXDG::findIcon("utilities-terminal",""), tr("Terminal"))->setWhatsThis("lumina-open -terminal"); } @@ -76,7 +76,7 @@ DesktopContextMenu::~DesktopContextMenu(){ } void DesktopContextMenu::start(){ - connect(Lumina::SETTINGS, SIGNAL(FileModified(DesktopSettings::File)), this, SLOT(SettingsChanged(DesktopSettings::File)) ); + connect(DesktopSettings::instance(), SIGNAL(FileModified(DesktopSettings::File)), this, SLOT(SettingsChanged(DesktopSettings::File)) ); connect(this, SIGNAL(LockSession()), Lumina::SS, SLOT(LockScreenNow()) ); //Still need to connect to some "workspaceChanged(int)" signal diff --git a/src-qt5/core/lumina-desktop-unified/src-events/LShortcutEvents.cpp b/src-qt5/core/lumina-desktop-unified/src-events/LShortcutEvents.cpp index eb448f02..f8bb20d3 100644 --- a/src-qt5/core/lumina-desktop-unified/src-events/LShortcutEvents.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-events/LShortcutEvents.cpp @@ -37,11 +37,11 @@ void LShortcutEvents::CheckKeySequence(WId win){ QString shortcut = keylistToString(); //Now see if there is a match for this shortcut // "strict" actions (operate even if a non-desktop window is active/focused) - QString action = Lumina::SETTINGS->value(DesktopSettings::Keys, "strict/"+shortcut, "").toString(); + QString action = DesktopSettings::instance()->value(DesktopSettings::Keys, "strict/"+shortcut, "").toString(); qDebug() << "Strict Action:" << "strict/"+shortcut << action; if(action.isEmpty() && win==0){ //"loose" actions (operating on the desktop or root window itself) - action = Lumina::SETTINGS->value(DesktopSettings::Keys, "desktop/"+shortcut, "").toString(); + action = DesktopSettings::instance()->value(DesktopSettings::Keys, "desktop/"+shortcut, "").toString(); qDebug() << "Desktop Action:" << "desktop/"+shortcut << action; } if(!action.isEmpty()){ @@ -94,10 +94,10 @@ void LShortcutEvents::CheckMouseSequence(WId win, NativeWindowSystem::MouseButto if(shortcut.isEmpty()){ return; } //Now see if there is a match for this shortcut // "strict" actions (operate even if a non-desktop window is active/focused) - QString action = Lumina::SETTINGS->value(DesktopSettings::Keys, "strict/"+shortcut, "").toString(); + QString action = DesktopSettings::instance()->value(DesktopSettings::Keys, "strict/"+shortcut, "").toString(); if(action.isEmpty() && win==0){ //"loose" actions (operating on the desktop or root window itself) - action = Lumina::SETTINGS->value(DesktopSettings::Keys, "desktop/"+shortcut, "").toString(); + action = DesktopSettings::instance()->value(DesktopSettings::Keys, "desktop/"+shortcut, "").toString(); } if(!action.isEmpty()){ //Found a valid action - go ahead and evaluate it |