1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 * Copyright (C) 2007 by Dominik Riebeling
11 * All files in this archive are subject to the GNU General Public License.
12 * See the file COPYING in the source tree root for full license agreement.
14 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
15 * KIND, either express or implied.
17 ****************************************************************************/
20 #include <QCoreApplication>
27 Q_IMPORT_PLUGIN(qtaccessiblewidgets
)
32 int main( int argc
, char ** argv
) {
33 #if QT_VERSION < 0x050000
34 qInstallMsgHandler(SysTrace::debug
);
36 qInstallMessageHandler(SysTrace::debug
);
38 QApplication
app( argc
, argv
);
40 QDir
dir(QApplication::applicationDirPath());
43 QApplication::addLibraryPath(dir
.absolutePath());
45 QString absolutePath
= QCoreApplication::instance()->applicationDirPath();
46 // portable installation:
47 // check for a configuration file in the program folder.
49 if(QFileInfo(absolutePath
+ "/RockboxUtility.ini").isFile())
50 user
= new QSettings(absolutePath
+ "/RockboxUtility.ini", QSettings::IniFormat
, 0);
51 else user
= new QSettings(QSettings::IniFormat
, QSettings::UserScope
, "rockbox.org", "RockboxUtility");
53 QString applang
= QLocale::system().name();
54 QTranslator translator
;
57 if(!user
->value("lang", "").toString().isEmpty()) {
58 applang
= user
->value("lang", "").toString();
60 if(!applang
.isEmpty()) {
61 if(!translator
.load("rbutil_" + applang
, absolutePath
))
62 translator
.load("rbutil_" + applang
, ":/lang");
63 if(!qttrans
.load("qt_" + applang
,
64 QLibraryInfo::location(QLibraryInfo::TranslationsPath
)))
65 qttrans
.load("qt_" + applang
, ":/lang");
67 QLocale::setDefault(applang
);
70 app
.installTranslator(&translator
);
71 app
.installTranslator(&qttrans
);
72 //: This string is used to indicate the writing direction. Translate it
73 //: to "RTL" (without quotes) for RTL languages. Anything else will get
74 //: treated as LTR language.
75 if(QObject::tr("LTR") == "RTL")
76 app
.setLayoutDirection(Qt::RightToLeft
);
78 // keep a list of installed translators. Needed to be able uninstalling them
79 // later again (in case of translation changes)
80 QList
<QTranslator
*> translators
;
81 translators
.append(&translator
);
82 translators
.append(&qttrans
);
84 RbUtilQt::translators
= translators
;
87 // app.connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );