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 ****************************************************************************/
26 Q_IMPORT_PLUGIN(qtaccessiblewidgets
)
31 int main( int argc
, char ** argv
) {
32 qInstallMsgHandler(SysTrace::debug
);
33 QApplication
app( argc
, argv
);
35 QDir
dir(QApplication::applicationDirPath());
38 QApplication::addLibraryPath(dir
.absolutePath());
40 QString absolutePath
= QCoreApplication::instance()->applicationDirPath();
41 // portable installation:
42 // check for a configuration file in the program folder.
44 if(QFileInfo(absolutePath
+ "/RockboxUtility.ini").isFile())
45 user
= new QSettings(absolutePath
+ "/RockboxUtility.ini", QSettings::IniFormat
, 0);
46 else user
= new QSettings(QSettings::IniFormat
, QSettings::UserScope
, "rockbox.org", "RockboxUtility");
48 QString applang
= QLocale::system().name();
49 QTranslator translator
;
52 if(!user
->value("lang", "").toString().isEmpty()) {
53 applang
= user
->value("lang", "").toString();
55 if(!applang
.isEmpty()) {
56 if(!translator
.load("rbutil_" + applang
, absolutePath
))
57 translator
.load("rbutil_" + applang
, ":/lang");
58 if(!qttrans
.load("qt_" + applang
,
59 QLibraryInfo::location(QLibraryInfo::TranslationsPath
)))
60 qttrans
.load("qt_" + applang
, ":/lang");
62 QLocale::setDefault(applang
);
65 app
.installTranslator(&translator
);
66 app
.installTranslator(&qttrans
);
67 //: This string is used to indicate the writing direction. Translate it
68 //: to "RTL" (without quotes) for RTL languages. Anything else will get
69 //: treated as LTR language.
70 if(QObject::tr("LTR") == "RTL")
71 app
.setLayoutDirection(Qt::RightToLeft
);
73 // keep a list of installed translators. Needed to be able uninstalling them
74 // later again (in case of translation changes)
75 QList
<QTranslator
*> translators
;
76 translators
.append(&translator
);
77 translators
.append(&qttrans
);
79 RbUtilQt::translators
= translators
;
82 // app.connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );