add SMAF codec (.mmf extension)(FS#10432)
[kugel-rb.git] / rbutil / rbutilqt / main.cpp
blobcf4cc03d4c1306759950ceb19d603c6758e23c90
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Riebeling
10 * $Id$
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
21 #include <QtGui>
22 #include "rbutilqt.h"
23 #include "systrace.h"
25 #ifdef STATIC
26 #include <QtPlugin>
27 Q_IMPORT_PLUGIN(qtaccessiblewidgets)
28 #endif
32 int main( int argc, char ** argv ) {
33 qInstallMsgHandler(SysTrace::debug);
34 QApplication app( argc, argv );
35 #if defined(Q_OS_MAC)
36 QDir dir(QApplication::applicationDirPath());
37 dir.cdUp();
38 dir.cd("plugins");
39 QApplication::addLibraryPath(dir.absolutePath());
40 #endif
41 QString absolutePath = QCoreApplication::instance()->applicationDirPath();
42 // portable installation:
43 // check for a configuration file in the program folder.
44 QSettings *user;
45 if(QFileInfo(absolutePath + "/RockboxUtility.ini").isFile())
46 user = new QSettings(absolutePath + "/RockboxUtility.ini", QSettings::IniFormat, 0);
47 else user = new QSettings(QSettings::IniFormat, QSettings::UserScope, "rockbox.org", "RockboxUtility");
49 QString applang = QLocale::system().name();
50 QTranslator translator;
51 QTranslator qttrans;
52 // install translator
53 if(!user->value("lang", "").toString().isEmpty()) {
54 applang = user->value("lang", "").toString();
56 if(!applang.isEmpty()) {
57 if(!translator.load("rbutil_" + applang, absolutePath))
58 translator.load("rbutil_" + applang, ":/lang");
59 if(!qttrans.load("qt_" + applang,
60 QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
61 qttrans.load("qt_" + applang, ":/lang");
63 QLocale::setDefault(applang);
65 delete user;
66 app.installTranslator(&translator);
67 app.installTranslator(&qttrans);
68 if(applang == "he")
69 app.setLayoutDirection(Qt::RightToLeft);
71 RbUtilQt window(0);
72 window.show();
74 // app.connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );
75 return app.exec();