diff options
author | Kris Moore <kris@pcbsd.org> | 2014-09-04 11:42:13 -0400 |
---|---|---|
committer | Kris Moore <kris@pcbsd.org> | 2014-09-04 11:42:13 -0400 |
commit | 71737f70949bd25f9aa8bc4e7d03039ba83c6cb1 (patch) | |
tree | ab29e864d1ae59d10cc6875af9541e3ad306b2fb /lumina-config/main.cpp | |
parent | Initial commit (diff) | |
download | lumina-71737f70949bd25f9aa8bc4e7d03039ba83c6cb1.tar.gz lumina-71737f70949bd25f9aa8bc4e7d03039ba83c6cb1.tar.bz2 lumina-71737f70949bd25f9aa8bc4e7d03039ba83c6cb1.zip |
Initial import of the lumina code from pcbsd git repo
Diffstat (limited to 'lumina-config/main.cpp')
-rw-r--r-- | lumina-config/main.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/lumina-config/main.cpp b/lumina-config/main.cpp new file mode 100644 index 00000000..c6525014 --- /dev/null +++ b/lumina-config/main.cpp @@ -0,0 +1,42 @@ +#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) +{ + #ifdef __linux + QApplication a(argc, argv); + #else + QtSingleApplication a(argc, argv); + if( a.isRunning() ) + return !(a.sendMessage("show")); + #endif + QTranslator translator; + 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/" ); + a.installTranslator( &translator ); + qDebug() << "Locale:" << langCode; + + + MainUI w; + QObject::connect(&a, SIGNAL(messageReceived(const QString&)), &w, SLOT(slotSingleInstance()) ); + w.show(); + + int retCode = a.exec(); + return retCode; +} |