diff options
Diffstat (limited to 'lumina-fm/main.cpp')
-rw-r--r-- | lumina-fm/main.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/lumina-fm/main.cpp b/lumina-fm/main.cpp new file mode 100644 index 00000000..1315ff79 --- /dev/null +++ b/lumina-fm/main.cpp @@ -0,0 +1,49 @@ +#include <QTranslator> +#ifdef __linux + // #include <QtSolutions/qtsingleapplication.h> +#else + #include <qtsingleapplication.h> +#endif // #ifdef __linux +#include <QtGui/QApplication> +#include <QDebug> +#include <QFile> + +#include "MainUI.h" + +#ifndef PREFIX +#define PREFIX QString("/usr/local") +#endif + +int main(int argc, char ** argv) +{ + QStringList in; + for(int i=1; i<argc; i++){ //skip the first arg (app binary) + in << QString(argv[i]); + } + if(in.isEmpty()){ in << QDir::homePath(); } + #ifdef __linux + QApplication a(argc, argv); + #else + QtSingleApplication a(argc, argv); + if( a.isRunning() ){ + return !(a.sendMessage(in.join("\n"))); + } + #endif + a.setApplicationName("Insight File Manager"); + QTranslator translator; + QLocale mylocale; + QString langCode = mylocale.name(); + + if ( ! QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-fm_" + langCode + ".qm" ) ) langCode.truncate(langCode.indexOf("_")); + translator.load( QString("lumina-fm_") + langCode, PREFIX + "/share/i18n/Lumina-DE/" ); + a.installTranslator( &translator ); + qDebug() << "Locale:" << langCode; + + MainUI w; + QObject::connect(&a, SIGNAL(messageReceived(const QString&)), &w, SLOT(slotSingleInstance(const QString&)) ); + w.OpenDirs(in); + w.show(); + + int retCode = a.exec(); + return retCode; +} |