aboutsummaryrefslogtreecommitdiff
path: root/lumina-open/main.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2014-10-06 09:55:02 -0400
committerKen Moore <ken@pcbsd.org>2014-10-06 09:55:02 -0400
commitd0371bef82a055b52a71706c13c3fab196510354 (patch)
tree228da7d2fb8c15ffcfb09e3499661d3471ad2d26 /lumina-open/main.cpp
parentMerge pull request #14 from Nanolx/master (diff)
downloadlumina-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-open/main.cpp')
-rw-r--r--lumina-open/main.cpp31
1 files changed, 6 insertions, 25 deletions
diff --git a/lumina-open/main.cpp b/lumina-open/main.cpp
index 427dbe04..c34a2c6a 100644
--- a/lumina-open/main.cpp
+++ b/lumina-open/main.cpp
@@ -25,7 +25,6 @@
#include <QTextCodec>
#include "LFileDialog.h"
-#include "../global.h"
#include <LuminaXDG.h>
#include <LuminaOS.h>
@@ -42,24 +41,6 @@ void printUsageInfo(){
exit(1);
}
-/*QApplication setupApplication(int argc, char **argv){
- 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("_") );
- }
- 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();
- return App;
-}*/
-
void showOSD(int argc, char **argv, QString message){
//Setup the application
QApplication App(argc, argv);
@@ -67,10 +48,10 @@ void showOSD(int argc, char **argv, QString message){
QLocale mylocale;
QString langCode = mylocale.name();
- if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){
+ if(!QFile::exists(LOS::LuminaShare()+"i18n/lumina-open_" + langCode + ".qm") ){
langCode.truncate( langCode.indexOf("_") );
}
- translator.load( QString("lumina-open_") + langCode, PREFIX + "/share/Lumina-DE/i18n/" );
+ translator.load( QString("lumina-open_") + langCode, LOS::LuminaShare()+"i18n/" );
App.installTranslator( &translator );
//Display the OSD
@@ -118,10 +99,10 @@ QString cmdFromUser(int argc, char **argv, QString inFile, QString extension, QS
QLocale mylocale;
QString langCode = mylocale.name();
- if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){
+ if(!QFile::exists(LOS::LuminaShare()+"i18n/lumina-open_" + langCode + ".qm") ){
langCode.truncate( langCode.indexOf("_") );
}
- translator.load( QString("lumina-open_") + langCode, PREFIX + "/share/Lumina-DE/i18n/" );
+ translator.load( QString("lumina-open_") + langCode, LOS::LuminaShare()+"i18n/" );
App.installTranslator( &translator );
qDebug() << "Locale:" << langCode;
@@ -320,10 +301,10 @@ int main(int argc, char **argv){
QLocale mylocale;
QString langCode = mylocale.name();
- if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){
+ if(!QFile::exists(LOS::LuminaShare()+"i18n/lumina-open_" + langCode + ".qm") ){
langCode.truncate( langCode.indexOf("_") );
}
- translator.load( QString("lumina-open_") + langCode, PREFIX + "/share/Lumina-DE/i18n/" );
+ translator.load( QString("lumina-open_") + langCode, LOS::LuminaShare()+"i18n/" );
App.installTranslator( &translator );
QMessageBox::critical(0,QObject::tr("Application Error"), QObject::tr("The following application experienced an error and needed to close:")+"\n\n"+cmd);
}
bgstack15