diff options
author | Ken Moore <ken@pcbsd.org> | 2014-10-06 09:55:02 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2014-10-06 09:55:02 -0400 |
commit | d0371bef82a055b52a71706c13c3fab196510354 (patch) | |
tree | 228da7d2fb8c15ffcfb09e3499661d3471ad2d26 /lumina-desktop | |
parent | Merge pull request #14 from Nanolx/master (diff) | |
download | lumina-d0371bef82a055b52a71706c13c3fab196510354.tar.gz lumina-d0371bef82a055b52a71706c13c3fab196510354.tar.bz2 lumina-d0371bef82a055b52a71706c13c3fab196510354.zip |
Clean up the new global.h usage in all the Lumina subprojects.
1) Move the global.h file usage into libLumina exclusively
2) Define a new "LuminaOS::LuminaShare()" function for retrieving the install directory for Lumina (based on the PREFIX/global.h)
3) Change all the other lumina sub directories/projects to use the new LuminaShare() function when necessary.
4) This also fixes up the loading of translations in many of the subprojects (found a bug in the path used in a number of them).
Reason:
Previous implementation *only* worked if you built lumina from the base directory, causing problems with rebuilding individual pieces of Lumina. This also cleans up the general lumina projects as they only need the LuminaOS class loaded instead of knowing about this other possible OS implementation.
Diffstat (limited to 'lumina-desktop')
-rw-r--r-- | lumina-desktop/AppMenu.cpp | 6 | ||||
-rw-r--r-- | lumina-desktop/AppMenu.h | 2 | ||||
-rw-r--r-- | lumina-desktop/Globals.h | 4 | ||||
-rw-r--r-- | lumina-desktop/LDesktop.cpp | 6 | ||||
-rw-r--r-- | lumina-desktop/LSession.cpp | 20 | ||||
-rw-r--r-- | lumina-desktop/SystemWindow.cpp | 4 | ||||
-rw-r--r-- | lumina-desktop/main.cpp | 19 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/userbutton/UserWidget.h | 4 |
8 files changed, 22 insertions, 43 deletions
diff --git a/lumina-desktop/AppMenu.cpp b/lumina-desktop/AppMenu.cpp index 8893c629..496d0932 100644 --- a/lumina-desktop/AppMenu.cpp +++ b/lumina-desktop/AppMenu.cpp @@ -6,11 +6,11 @@ //=========================================== #include "AppMenu.h" #include "LSession.h" -#include "../global.h" +#include <LuminaOS.h> AppMenu::AppMenu(QWidget* parent) : QMenu(parent){ - appstorelink = PREFIX + "/share/applications/softmanager.desktop"; //Default application "store" to display (AppCafe in PC-BSD) - controlpanellink = PREFIX + "/share/applications/pccontrol.desktop"; //Default control panel + appstorelink = LOS::AppStoreShortcut(); //Default application "store" to display (AppCafe in PC-BSD) + controlpanellink = LOS::ControlPanelShortcut(); //Default control panel APPS.clear(); watcher = new QFileSystemWatcher(this); connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(watcherUpdate()) ); diff --git a/lumina-desktop/AppMenu.h b/lumina-desktop/AppMenu.h index 66457f69..1657d9e2 100644 --- a/lumina-desktop/AppMenu.h +++ b/lumina-desktop/AppMenu.h @@ -35,7 +35,7 @@ public: private: QFileSystemWatcher *watcher; - QString appstorelink, controlpanellink; //default *.desktop file to use as the "store" + QString appstorelink, controlpanellink; QList<QMenu> MLIST; QHash<QString, QList<XDGDesktop> > APPS; diff --git a/lumina-desktop/Globals.h b/lumina-desktop/Globals.h index b2cac1eb..479fe4ad 100644 --- a/lumina-desktop/Globals.h +++ b/lumina-desktop/Globals.h @@ -8,7 +8,7 @@ #define _LUMINA_DESKTOP_GLOBALS_H #include <LuminaUtils.h> -#include "../global.h" +//#include "../global.h" #include <unistd.h> #include <stdio.h> @@ -27,7 +27,7 @@ public: class SYSTEM{ public: //Installation location for finding default files - static QString installDir(){ return PREFIX + "/share/Lumina-DE/"; } + //static QString installDir(){ return PREFIX + "/share/Lumina-DE/"; } //Current Username static QString user(){ return QString::fromLocal8Bit(getlogin()); } //Current Hostname diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp index e555fac2..22606cf4 100644 --- a/lumina-desktop/LDesktop.cpp +++ b/lumina-desktop/LDesktop.cpp @@ -6,7 +6,9 @@ //=========================================== #include "LDesktop.h" #include "LSession.h" -#include "../global.h" + +#include <LuminaOS.h> +//#include "../global.h" LDesktop::LDesktop(int deskNum) : QObject(){ @@ -401,7 +403,7 @@ void LDesktop::UpdateBackground(){ //Save this file as the current background CBG = bgFile; //qDebug() << " - Set Background to:" << CBG << index << bgL; - if( (bgFile.toLower()=="default")){ bgFile = PREFIX + "/share/Lumina-DE/desktop-background.jpg"; } + if( (bgFile.toLower()=="default")){ bgFile = LOS::LuminaShare()+"desktop-background.jpg"; } //Now set this file as the current background QString style = "QWidget#bgWindow{ border-image:url(%1) stretch;}"; style = style.arg(bgFile); diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp index f58b83fe..95272954 100644 --- a/lumina-desktop/LSession.cpp +++ b/lumina-desktop/LSession.cpp @@ -5,7 +5,7 @@ // See the LICENSE file for full details //=========================================== #include "LSession.h" -#include "../global.h" +#include <LuminaOS.h> #include <Phonon/MediaObject> #include <Phonon/AudioOutput> @@ -110,8 +110,8 @@ void LSession::setupSession(){ bool LSession::LoadLocale(QString langCode){ QTranslator translator; - if ( ! QFile::exists(SYSTEM::installDir()+"i18n/lumina-desktop_" + langCode + ".qm" ) ) langCode.truncate(langCode.indexOf("_")); - bool ok = translator.load( QString("lumina-desktop_") + langCode, SYSTEM::installDir()+"i18n/" ); + if ( ! QFile::exists(LOS::LuminaShare()+"i18n/lumina-desktop_" + langCode + ".qm" ) ) langCode.truncate(langCode.indexOf("_")); + bool ok = translator.load( QString("lumina-desktop_") + langCode, LOS::LuminaShare()+"i18n/" ); if(ok){ //Remove any old translator if(currTranslator != 0){ this->removeTranslator(currTranslator); } @@ -131,7 +131,7 @@ void LSession::launchStartupApps(){ qDebug() << "Launching startup applications"; for(int i=0; i<2; i++){ QString startfile; - if(i==0){startfile = PREFIX + "/share/Lumina-DE/startapps"; } + if(i==0){startfile = LOS::LuminaShare()+"startapps"; } else{ startfile = QDir::homePath()+"/.lumina/startapps"; } if(!QFile::exists(startfile)){ continue; } //go to the next @@ -150,7 +150,7 @@ void LSession::launchStartupApps(){ } //Now play the login music if(sessionsettings->value("PlayStartupAudio",true).toBool()){ - LSession::playAudioFile(PREFIX + "/share/Lumina-DE/Login.ogg"); + LSession::playAudioFile(LOS::LuminaShare()+"Login.ogg"); } if(sessionsettings->value("EnableNumlock",true).toBool()){ QProcess::startDetached("numlockx on"); @@ -175,8 +175,8 @@ void LSession::checkUserFiles(){ if(!QFile::exists(dset) || oldversion < 50){ if( oldversion < 50 ){ QFile::remove(dset); qDebug() << "Current desktop settings obsolete: Re-implementing defaults"; } else{ firstrun = true; } - if(QFile::exists(SYSTEM::installDir()+"desktopsettings.conf")){ - if( QFile::copy(SYSTEM::installDir()+"desktopsettings.conf", dset) ){ + if(QFile::exists(LOS::LuminaShare()+"desktopsettings.conf")){ + if( QFile::copy(LOS::LuminaShare()+"desktopsettings.conf", dset) ){ QFile::setPermissions(dset, QFile::ReadUser | QFile::WriteUser | QFile::ReadOwner | QFile::WriteOwner); } } @@ -185,8 +185,8 @@ void LSession::checkUserFiles(){ dset = QDir::homePath()+"/.lumina/LuminaDE/lumina-open.conf"; if(!QFile::exists(dset)){ firstrun = true; - if(QFile::exists(SYSTEM::installDir()+"defaultapps.conf")){ - if( QFile::copy(SYSTEM::installDir()+"defaultapps.conf", dset) ){ + if(QFile::exists(LOS::LuminaShare()+"defaultapps.conf")){ + if( QFile::copy(LOS::LuminaShare()+"defaultapps.conf", dset) ){ QFile::setPermissions(dset, QFile::ReadUser | QFile::WriteUser | QFile::ReadOwner | QFile::WriteOwner); } } @@ -219,7 +219,7 @@ void LSession::checkUserFiles(){ void LSession::loadStyleSheet(){ QString ss = QDir::homePath()+"/.lumina/stylesheet.qss"; - if(!QFile::exists(ss)){ ss = SYSTEM::installDir()+"stylesheet.qss"; } + if(!QFile::exists(ss)){ ss = LOS::LuminaShare()+"stylesheet.qss"; } if(!QFile::exists(ss)){ return; } //no default stylesheet on the system //Now read/apply the custom stylesheet QFile file(ss); diff --git a/lumina-desktop/SystemWindow.cpp b/lumina-desktop/SystemWindow.cpp index 55f1e4a4..3e723a36 100644 --- a/lumina-desktop/SystemWindow.cpp +++ b/lumina-desktop/SystemWindow.cpp @@ -2,7 +2,7 @@ #include "ui_SystemWindow.h" #include "LSession.h" -#include "../global.h" +#include <LuminaOS.h> #include <unistd.h> //for usleep() usage SystemWindow::SystemWindow() : QDialog(), ui(new Ui::SystemWindow){ @@ -38,7 +38,7 @@ SystemWindow::~SystemWindow(){ void SystemWindow::closeAllWindows(){ if( LSession::sessionSettings()->value("PlayLogoutAudio",true).toBool() ){ - LSession::playAudioFile(PREFIX + "/share/Lumina-DE/Logout.ogg"); + LSession::playAudioFile(LOS::LuminaShare()+"Logout.ogg"); } QList<WId> WL = LX11::WindowList(); for(int i=0; i<WL.length(); i++){ diff --git a/lumina-desktop/main.cpp b/lumina-desktop/main.cpp index 3339e9ed..690ae80d 100644 --- a/lumina-desktop/main.cpp +++ b/lumina-desktop/main.cpp @@ -16,11 +16,8 @@ #include <QUrl> -//#include "WMProcess.h" -//#include "LDesktop.h" #include "LSession.h" #include "Globals.h" -#include "../global.h" #include <LuminaXDG.h> //from libLuminaUtils @@ -68,29 +65,13 @@ int main(int argc, char ** argv) //Setup Log File qInstallMsgHandler(MessageOutput); a.setupSession(); - //Start up the Window Manager - //qDebug() << " - Start Window Manager"; - //WMProcess WM; - //WM.startWM(); - //QObject::connect(&WM, SIGNAL(WMShutdown()), &a, SLOT(exit()) ); - //Load the initial translations - //QTranslator translator; a.LoadLocale(QLocale().name()); - //Now start the desktop - /*QDesktopWidget DW; - QList<LDesktop*> screens; - for(int i=0; i<DW.screenCount(); i++){ - qDebug() << " - Start Desktop " << i; - screens << new LDesktop(i); - a.processEvents(); - }*/ //Start launching external applications QTimer::singleShot(1000, &a, SLOT(launchStartupApps()) ); //wait a second first //QTimer::singleShot(1000, &a, SLOT(playStartupAudio()) ); int retCode = a.exec(); //a.playLogoutAudio(); //qDebug() << "Stopping the window manager"; - //WM.stopWM(); qDebug() << "Finished Closing Down Lumina"; logfile.close(); return retCode; diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.h b/lumina-desktop/panel-plugins/userbutton/UserWidget.h index 1b1405b3..06ad22e8 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserWidget.h +++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.h @@ -23,11 +23,7 @@ #include <LuminaXDG.h> #include <LuminaOS.h> #include "UserItemWidget.h" -#include "../../../global.h" -//#define APPSTORE QString(PREFIX + "/share/applications/softmanager.desktop") -//#define CONTROLPANEL QString(PREFIX + "/share/applications/pccontrol.desktop") -//#define QTCONFIG QString(PREFIX + "/bin/qtconfig-qt4") #define SSAVER QString("xscreensaver-demo") namespace Ui{ |