From b3ee7109dd5c9cd21b219a758df45e0866936ffb Mon Sep 17 00:00:00 2001 From: Christopher Roy Bratusek Date: Sun, 5 Oct 2014 20:16:42 +0200 Subject: add global.h containing PREFIX and make use of it in all sub-modules, add PREFIX and LIBPREFIX to the qmake .pro files (allows to change prefix and libdir using or whatever) update debian packaging scripts accordingly --- lumina-open/lumina-open.pro | 11 +++++--- lumina-open/main.cpp | 61 +++++++++++++++++++++------------------------ 2 files changed, 36 insertions(+), 36 deletions(-) (limited to 'lumina-open') diff --git a/lumina-open/lumina-open.pro b/lumina-open/lumina-open.pro index 34e76d54..b70d6b27 100644 --- a/lumina-open/lumina-open.pro +++ b/lumina-open/lumina-open.pro @@ -2,7 +2,10 @@ QT += core gui TARGET = lumina-open -target.path = /usr/local/bin +isEmpty(PREFIX) { + PREFIX = /usr/local +} +target.path = $$PREFIX/bin TEMPLATE = app @@ -15,7 +18,7 @@ FORMS += LFileDialog.ui RESOURCES+= lumina-open.qrc -INCLUDEPATH += ../libLumina /usr/local/include +INCLUDEPATH += ../libLumina $$PREFIX/include LIBS += -L../libLumina -lLuminaUtils QMAKE_LIBDIR = ../libLumina DEPENDPATH += ../libLumina @@ -89,7 +92,7 @@ TRANSLATIONS = i18n/lumina-open_af.ts \ i18n/lumina-open_zh_TW.ts \ i18n/lumina-open_zu.ts -dotrans.path=/usr/local/share/Lumina-DE/i18n/ -dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)/usr/local/share/Lumina-DE/i18n/ +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-open/main.cpp b/lumina-open/main.cpp index 339446b9..427dbe04 100644 --- a/lumina-open/main.cpp +++ b/lumina-open/main.cpp @@ -25,24 +25,21 @@ #include #include "LFileDialog.h" +#include "../global.h" #include #include -#ifndef PREFIX -#define PREFIX QString("/usr/local") -#endif - void printUsageInfo(){ qDebug() << "lumina-open: Application launcher for the Lumina Desktop Environment"; - qDebug() << "Description: Given a file (with absolute path) or URL, this utility will try to find the appropriate application with which to open the file. If the file is a *.desktop application shortcut, it will just start the application appropriately. It can also perform a few specific system operations if given special flags."; + qDebug() << "Description: Given a file (with absolute path) or URL, this utility will try to find the appropriate application with which to open the file. If the file is a *.desktop application shortcut, it will just start the application appropriately. It can also perform a few specific system operations if given special flags."; qDebug() << "Usage: lumina-open [-select] "; qDebug() << " lumina-open [-volumeup, -volumedown, -brightnessup, -brightnessdown]"; qDebug() << " [-select] (optional) flag to bypass any default application settings and show the application selector window"; qDebug() << "Special Flags:"; qDebug() << " \"-volume[up/down]\" Flag to increase/decrease audio volume by 5%"; qDebug() << " \"-brightness[up/down]\" Flag to increase/decrease screen brightness by 5%"; - exit(1); + exit(1); } /*QApplication setupApplication(int argc, char **argv){ @@ -50,9 +47,9 @@ void printUsageInfo(){ QTranslator translator; QLocale mylocale; QString langCode = mylocale.name(); - - if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){ - langCode.truncate( langCode.indexOf("_") ); + + if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){ + langCode.truncate( langCode.indexOf("_") ); } translator.load( QString("lumina-open_") + langCode, PREFIX + "/share/Lumina-DE/i18n/" ); App.installTranslator( &translator ); @@ -69,9 +66,9 @@ void showOSD(int argc, char **argv, QString message){ QTranslator translator; QLocale mylocale; QString langCode = mylocale.name(); - - if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){ - langCode.truncate( langCode.indexOf("_") ); + + if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){ + langCode.truncate( langCode.indexOf("_") ); } translator.load( QString("lumina-open_") + langCode, PREFIX + "/share/Lumina-DE/i18n/" ); App.installTranslator( &translator ); @@ -106,7 +103,7 @@ QString cmdFromUser(int argc, char **argv, QString inFile, QString extension, QS if(ok){ QString exec = LXDG::getDesktopExec(DF); if(!exec.isEmpty()){ - qDebug() << "[lumina-open] Using default application:" << DF.name << "File:" << inFile; + qDebug() << "[lumina-open] Using default application:" << DF.name << "File:" << inFile; if(!DF.path.isEmpty()){ path = DF.path; } return exec; } @@ -120,18 +117,18 @@ QString cmdFromUser(int argc, char **argv, QString inFile, QString extension, QS QTranslator translator; QLocale mylocale; QString langCode = mylocale.name(); - - if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){ - langCode.truncate( langCode.indexOf("_") ); + + if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){ + langCode.truncate( langCode.indexOf("_") ); } translator.load( QString("lumina-open_") + langCode, PREFIX + "/share/Lumina-DE/i18n/" ); App.installTranslator( &translator ); qDebug() << "Locale:" << langCode; - + //Load current encoding for this locale QTextCodec::setCodecForTr( QTextCodec::codecForLocale() ); //make sure to use the same codec qDebug() << "Locale Encoding:" << QTextCodec::codecForLocale()->name(); - + LFileDialog w; if(inFile.startsWith(extension)){ //URL @@ -141,7 +138,7 @@ QString cmdFromUser(int argc, char **argv, QString inFile, QString extension, QS if(inFile.endsWith("/")){ inFile.chop(1); } w.setFileInfo(inFile.section("/",-1), extension, true); } - + w.show(); App.exec(); @@ -160,7 +157,7 @@ void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& pat //Get the input file QString inFile; bool showDLG = false; //flag to bypass any default application setting - if(argc > 1){ + if(argc > 1){ for(int i=1; iexitCode(); }else if(p->state() == QProcess::Running){ - //This just missed the "started" signal - continue + //This just missed the "started" signal - continue break; } } @@ -315,16 +312,16 @@ int main(int argc, char **argv){ if(p->state() != QProcess::Running){ break; } //somehow missed the finished signal } int retcode = p->exitCode();*/ - if(retcode!=0){ + if(retcode!=0){ qDebug() << "[lumina-open] Application Error:" << retcode; //Setup the application QApplication App(argc, argv); QTranslator translator; QLocale mylocale; QString langCode = mylocale.name(); - - if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){ - langCode.truncate( langCode.indexOf("_") ); + + if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){ + langCode.truncate( langCode.indexOf("_") ); } translator.load( QString("lumina-open_") + langCode, PREFIX + "/share/Lumina-DE/i18n/" ); App.installTranslator( &translator ); -- cgit