aboutsummaryrefslogtreecommitdiff
path: root/lumina-fm/main.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2014-12-30 11:20:57 -0500
committerKen Moore <ken@pcbsd.org>2014-12-30 11:20:57 -0500
commit3cee91a627ecced62f7eefdc38850ea5499f761c (patch)
tree93f59249f318a34ad5d9789bac1d155596eb7ff5 /lumina-fm/main.cpp
parentCommit some more XLib->XCB conversions (everything for the task manager), and... (diff)
downloadlumina-3cee91a627ecced62f7eefdc38850ea5499f761c.tar.gz
lumina-3cee91a627ecced62f7eefdc38850ea5499f761c.tar.bz2
lumina-3cee91a627ecced62f7eefdc38850ea5499f761c.zip
Clean up how translations are loaded for all the Lumina utilities, and also apply the relative path fixes to all LSingleApplication's forwarded inputs.
Diffstat (limited to 'lumina-fm/main.cpp')
-rw-r--r--lumina-fm/main.cpp41
1 files changed, 13 insertions, 28 deletions
diff --git a/lumina-fm/main.cpp b/lumina-fm/main.cpp
index 760ca7ad..1682dbb3 100644
--- a/lumina-fm/main.cpp
+++ b/lumina-fm/main.cpp
@@ -1,20 +1,17 @@
-#include <QTranslator>
-/*#ifdef __FreeBSD__
- #include <qtsingleapplication.h>
-#endif*/
#include <QApplication>
#include <QDebug>
#include <QFile>
#include <QStringList>
-//#include <QTextCodec>
#include "MainUI.h"
#include <LuminaOS.h>
#include <LuminaThemes.h>
+#include <LuminaUtils.h>
+#include <LuminaSingleApplication.h>
int main(int argc, char ** argv)
{
- QStringList in;
+ /*QStringList in;
for(int i=1; i<argc; i++){ //skip the first arg (app binary)
QString path = argv[i];
if(path=="."){
@@ -25,33 +22,21 @@ int main(int argc, char ** argv)
in << path;
}
}
- if(in.isEmpty()){ in << QDir::homePath(); }
- /*#ifdef __FreeBSD__
- QtSingleApplication a(argc, argv);
- if( a.isRunning() ){
- return !(a.sendMessage(in.join("\n")));
- }
- #else*/
- QApplication a(argc, argv);
+ if(in.isEmpty()){ in << QDir::homePath(); }*/
+
+ LSingleApplication a(argc, argv);
+ if( !a.isPrimaryProcess()){ return 0; }
qDebug() << "Loaded QApplication";
- //#endif
a.setApplicationName("Insight File Manager");
LuminaThemeEngine themes(&a);
- //Load current Locale
- QTranslator translator;
- QLocale mylocale;
- QString langCode = mylocale.name();
- if ( ! QFile::exists(LOS::LuminaShare()+"i18n/lumina-fm_" + langCode + ".qm" ) ) langCode.truncate(langCode.indexOf("_"));
- translator.load( QString("lumina-fm_") + langCode, LOS::LuminaShare()+"i18n/" );
- a.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();
+ LUtils::LoadTranslation(&a, "lumina-fm");
+ //Get the list of inputs for the initial load
+ QStringList in = a.inputlist; //has fixes for relative paths and such
+ if(in.isEmpty()){ in << QDir::homePath(); }
+ //Start the UI
MainUI w;
- //QObject::connect(&a, SIGNAL(messageReceived(const QString&)), &w, SLOT(slotSingleInstance(const QString&)) );
+ QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), &w, SLOT(slotSingleInstance(QStringList)) );
QObject::connect(&themes, SIGNAL(updateIcons()), &w, SLOT(setupIcons()) );
w.OpenDirs(in);
w.show();
bgstack15