Let qmake generate an install Makefile target to install the binary. Doesn't handle...
[Rockbox.git] / rbutil / rbutilqt / main.cpp
blobb8419c00a3ee677544ae006a0a01de9ac28401f8
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 );
32 QString absolutePath = QCoreApplication::instance()->applicationDirPath();
33 // portable installation:
34 // check for a configuration file in the program folder.
35 QSettings *user;
36 if(QFileInfo(absolutePath + "/RockboxUtility.ini").isFile())
37 user = new QSettings(absolutePath + "/RockboxUtility.ini", QSettings::IniFormat, 0);
38 else user = new QSettings(QSettings::IniFormat, QSettings::UserScope, "rockbox.org", "RockboxUtility");
40 QTranslator translator;
41 // install translator
42 if(!user->value("lang", "").toString().isEmpty()) {
43 if(!translator.load("rbutil_" + user->value("lang").toString(), absolutePath))
44 translator.load("rbutil_" + user->value("lang").toString(), ":/lang");
45 QLocale::setDefault(user->value("lang").toString());
47 delete user;
48 app.installTranslator(&translator);
50 RbUtilQt window(0);
51 window.show();
53 // app.connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );
54 return app.exec();