From 45ac1db17540f2ced6136b62b626d4d01ae3e8b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 1 May 2014 14:21:17 +0200 Subject: [PATCH] GUI: set data dir before translations are loaded, before data dir is set they will not be found. --- gui/main.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/gui/main.cpp b/gui/main.cpp index 7f5ce2219..283c28592 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -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; }