Fix case in the constant
[maemo-rb.git] / rbutil / rbutilqt / main.cpp
blob0b720d60f6590862e5c0648c83971677c3f8be6a
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"
24 #ifdef STATIC
25 #include <QtPlugin>
26 Q_IMPORT_PLUGIN(qtaccessiblewidgets)
27 #endif
29 int main( int argc, char ** argv ) {
30 QApplication app( argc, argv );
31 #if defined(Q_OS_MAC)
32 QDir dir(QApplication::applicationDirPath());
33 dir.cdUp();
34 dir.cd("plugins");
35 QApplication::addLibraryPath(dir.absolutePath());
36 #endif
37 QString absolutePath = QCoreApplication::instance()->applicationDirPath();
38 // portable installation:
39 // check for a configuration file in the program folder.
40 QSettings *user;
41 if(QFileInfo(absolutePath + "/RockboxUtility.ini").isFile())
42 user = new QSettings(absolutePath + "/RockboxUtility.ini", QSettings::IniFormat, 0);
43 else user = new QSettings(QSettings::IniFormat, QSettings::UserScope, "rockbox.org", "RockboxUtility");
45 QString applang = QLocale::system().name();
46 QTranslator translator;
47 QTranslator qttrans;
48 // install translator
49 if(!user->value("lang", "").toString().isEmpty()) {
50 applang = user->value("lang", "").toString();
52 if(!applang.isEmpty()) {
53 if(!translator.load("rbutil_" + applang, absolutePath))
54 translator.load("rbutil_" + applang, ":/lang");
55 if(!qttrans.load("qt_" + applang,
56 QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
57 qttrans.load("qt_" + applang, ":/lang");
59 QLocale::setDefault(applang);
61 delete user;
62 app.installTranslator(&translator);
63 app.installTranslator(&qttrans);
65 RbUtilQt window(0);
66 window.show();
68 // app.connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );
69 return app.exec();