aboutsummaryrefslogtreecommitdiff
path: root/lumina-fm
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
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')
-rw-r--r--lumina-fm/MainUI.h4
-rw-r--r--lumina-fm/lumina-fm.pro2
-rw-r--r--lumina-fm/main.cpp41
3 files changed, 16 insertions, 31 deletions
diff --git a/lumina-fm/MainUI.h b/lumina-fm/MainUI.h
index 1cc26830..7efc9faa 100644
--- a/lumina-fm/MainUI.h
+++ b/lumina-fm/MainUI.h
@@ -116,10 +116,10 @@ private:
QFileInfoList getSelectedItems();
private slots:
- void slotSingleInstance(const QString &in){
+ void slotSingleInstance(QStringList in){
this->show();
this->raise();
- this->OpenDirs(in.split("\n"));
+ this->OpenDirs(in);
}
//General button check functions (started in a seperate thread!)
diff --git a/lumina-fm/lumina-fm.pro b/lumina-fm/lumina-fm.pro
index 1f092894..b7653274 100644
--- a/lumina-fm/lumina-fm.pro
+++ b/lumina-fm/lumina-fm.pro
@@ -1,6 +1,6 @@
QT += core gui
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets multimedia multimediawidgets
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets multimedia multimediawidgets network
TARGET = lumina-fm
isEmpty(PREFIX) {
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