GUI: set data dir before translations are loaded, before data dir is set they will not be found.
This commit is contained in:
parent
f6aaf6cc0d
commit
45ac1db175
17
gui/main.cpp
17
gui/main.cpp
|
@ -54,8 +54,17 @@ int main(int argc, char *argv[])
|
||||||
QCoreApplication::setOrganizationName("Cppcheck");
|
QCoreApplication::setOrganizationName("Cppcheck");
|
||||||
QCoreApplication::setApplicationName("Cppcheck-GUI");
|
QCoreApplication::setApplicationName("Cppcheck-GUI");
|
||||||
|
|
||||||
TranslationHandler* th = new TranslationHandler(&app);
|
|
||||||
QSettings* settings = new QSettings("Cppcheck", "Cppcheck-GUI", &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());
|
th->SetLanguage(settings->value(SETTINGS_LANGUAGE, th->SuggestLanguage()).toString());
|
||||||
|
|
||||||
if (!CheckArgs(app.arguments(), settings))
|
if (!CheckArgs(app.arguments(), settings))
|
||||||
|
@ -83,12 +92,6 @@ bool CheckArgs(const QStringList &args, QSettings * const settings)
|
||||||
ShowVersion();
|
ShowVersion();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
foreach(const QString arg, args) {
|
|
||||||
if (arg.startsWith("--data-dir=")) {
|
|
||||||
settings->setValue("DATADIR", arg.mid(11));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue