From 3d3ada014be625d78ac56eed3ff28506f25fe3e8 Mon Sep 17 00:00:00 2001 From: Wescoeur Date: Sat, 22 Jul 2017 20:18:56 +0200 Subject: [PATCH] fix(app): execute command at startup correctly (not when core is restarted) --- src/app/App.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/app/App.cpp b/src/app/App.cpp index 09e43ba7a..3739b64bd 100644 --- a/src/app/App.cpp +++ b/src/app/App.cpp @@ -173,6 +173,13 @@ void App::initContentApp () { // Init core. CoreManager::init(this, mParser->value("config")); + // Execute command argument if needed. + if (!mEngine) { + const QString commandArgument = getCommandArgument(); + if (!commandArgument.isEmpty()) + mCli->executeCommand(commandArgument); + } + // Init engine content. mEngine = new QQmlApplicationEngine(); @@ -215,13 +222,6 @@ void App::initContentApp () { if (mEngine->rootObjects().isEmpty()) qFatal("Unable to open main window."); - // Execute command argument if needed. - { - const QString commandArgument = getCommandArgument(); - if (!commandArgument.isEmpty()) - mCli->executeCommand(commandArgument); - } - QObject::connect( CoreManager::getInstance()->getHandlers().get(), &CoreHandlers::coreStarted, @@ -551,13 +551,6 @@ void App::openAppAfterInit () { } } - // Execute command argument if needed. - { - const QString commandArgument = getCommandArgument(); - if (!commandArgument.isEmpty()) - mCli->executeCommand(commandArgument); - } - #ifdef ENABLE_UPDATE_CHECK QTimer *timer = new QTimer(mEngine); timer->setInterval(VERSION_UPDATE_CHECK_INTERVAL);