From d0371bef82a055b52a71706c13c3fab196510354 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 6 Oct 2014 09:55:02 -0400 Subject: 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. --- lumina-config/main.cpp | 6 +++--- lumina-config/mainUI.cpp | 9 ++++----- lumina-config/mainUI.h | 4 +--- 3 files changed, 8 insertions(+), 11 deletions(-) (limited to 'lumina-config') diff --git a/lumina-config/main.cpp b/lumina-config/main.cpp index 65f2bf08..415a3c85 100644 --- a/lumina-config/main.cpp +++ b/lumina-config/main.cpp @@ -8,7 +8,7 @@ #include #include "mainUI.h" -#include "../global.h" +#include int main(int argc, char ** argv) { @@ -23,8 +23,8 @@ int main(int argc, char ** argv) QLocale mylocale; QString langCode = mylocale.name(); - if ( ! QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-config_" + langCode + ".qm" ) ) langCode.truncate(langCode.indexOf("_")); - translator.load( QString("lumina-config_") + langCode, PREFIX + "/share/i18n/Lumina-DE/" ); + if ( ! QFile::exists(LOS::LuminaShare()+"i18n/lumina-config_" + langCode + ".qm" ) ) langCode.truncate(langCode.indexOf("_")); + translator.load( QString("lumina-config_") + langCode, LOS::LuminaShare()+"i18n/" ); a.installTranslator( &translator ); qDebug() << "Locale:" << langCode; diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp index cd3ae0a9..eb29ee8f 100644 --- a/lumina-config/mainUI.cpp +++ b/lumina-config/mainUI.cpp @@ -8,13 +8,12 @@ #include "ui_mainUI.h" //the designer *.ui file #include -#include "../global.h" MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ ui->setupUi(this); //load the designer file this->setWindowIcon( LXDG::findIcon("preferences-desktop-display","") ); PINFO = new LPlugins(); //load the info class - + DEFAULTBG = LOS::LuminaShare()+"desktop-background.jpg"; //Be careful about the QSettings setup, it must match the lumina-desktop setup QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina"); settings = new QSettings( QSettings::UserScope, "LuminaDE", "desktopsettings", this); @@ -712,7 +711,7 @@ void MainUI::deskbgremoved(){ void MainUI::deskbgadded(){ //Prompt the user to find an image file to use for a background - QString dir = PREFIX + "/share/wallpapers/Lumina-DE"; + QString dir = LOS::LuminaShare()+"wallpapers/Lumina-DE"; if( !QFile::exists(dir) ){ dir = QDir::homePath(); } QStringList bgs = QFileDialog::getOpenFileNames(this, tr("Find Background Image(s)"), dir, "Images (*.png *.xpm *.jpg)"); if(bgs.isEmpty()){ return; } @@ -993,7 +992,7 @@ void MainUI::downmenuplugin(){ } void MainUI::findmenuterminal(){ - QString chkpath = PREFIX + "/bin"; + QString chkpath = LOS::AppPrefix() + "bin"; if(!QFile::exists(chkpath)){ chkpath = QDir::homePath(); } QString bin = QFileDialog::getOpenFileName(this, tr("Set Default Terminal Application"), chkpath, tr("Application Binaries (*)") ); if( bin.isEmpty() || !QFile::exists(bin) ){ return; } //cancelled @@ -1407,7 +1406,7 @@ void MainUI::addsessionstartapp(){ } void MainUI::addsessionstartbin(){ - QString chkpath = PREFIX + "/bin"; + QString chkpath = LOS::AppPrefix() + "bin"; if(!QFile::exists(chkpath)){ chkpath = QDir::homePath(); } QString bin = QFileDialog::getOpenFileName(this, tr("Select Binary"), chkpath, tr("Application Binaries (*)") ); if( bin.isEmpty() || !QFile::exists(bin) ){ return; } //cancelled diff --git a/lumina-config/mainUI.h b/lumina-config/mainUI.h index 28e38984..565a3c61 100644 --- a/lumina-config/mainUI.h +++ b/lumina-config/mainUI.h @@ -26,9 +26,6 @@ #include "LPlugins.h" #include "KeyCatch.h" #include "AppDialog.h" -#include "../global.h" - -#define DEFAULTBG QString(PREFIX + "/share/Lumina-DE/desktop-background.jpg") //namespace for using the *.ui file namespace Ui{ @@ -48,6 +45,7 @@ private: LPlugins *PINFO; QMenu *ppmenu, *mpmenu; QString panelcolor; + QString DEFAULTBG; QList sysApps; bool loading; bool moddesk, modpan, modmenu, modshort, moddef, modses; //page modified flags -- cgit