GUI: set data dir before translations are loaded, before data dir is set they will not be found.

This commit is contained in:
Daniel Marjamäki 2014-05-01 14:21:17 +02:00
parent f6aaf6cc0d
commit 45ac1db175
1 changed files with 10 additions and 7 deletions

View File

@ -54,8 +54,17 @@ int main(int argc, char *argv[])
QCoreApplication::setOrganizationName("Cppcheck");
QCoreApplication::setApplicationName("Cppcheck-GUI");
TranslationHandler* th = new TranslationHandler(&app);
QSettings* settings = new QSettings("Cppcheck", "Cppcheck-GUI", &app);
// Set data dir..
foreach(const QString arg, app.arguments()) {
if (arg.startsWith("--data-dir=")) {
settings->setValue("DATADIR", arg.mid(11));
return 0;
}
}
TranslationHandler* th = new TranslationHandler(&app);
th->SetLanguage(settings->value(SETTINGS_LANGUAGE, th->SuggestLanguage()).toString());
if (!CheckArgs(app.arguments(), settings))
@ -83,12 +92,6 @@ bool CheckArgs(const QStringList &args, QSettings * const settings)
ShowVersion();
return false;
}
foreach(const QString arg, args) {
if (arg.startsWith("--data-dir=")) {
settings->setValue("DATADIR", arg.mid(11));
return false;
}
}
return true;
}