From fe99eb261b5ee0312967253f77e5f593cfde98b2 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sat, 13 Oct 2018 01:12:39 +0200 Subject: [PATCH] Ref T367, Ref T400 signal and read handling * connect this->setupHandlingCompleted directly with reader + renaming * do not waitForSetup if request already failed --- src/blackcore/application.cpp | 10 ++++++---- src/blackcore/application.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/blackcore/application.cpp b/src/blackcore/application.cpp index e3ae331ee..cc99b2184 100644 --- a/src/blackcore/application.cpp +++ b/src/blackcore/application.cpp @@ -166,7 +166,8 @@ namespace BlackCore // global setup m_setupReader.reset(new CSetupReader(this)); - connect(m_setupReader.data(), &CSetupReader::setupHandlingCompleted, this, &CApplication::setupHandlingIsCompleted, Qt::QueuedConnection); + connect(m_setupReader.data(), &CSetupReader::setupHandlingCompleted, this, &CApplication::onSetupHandlingCompleted, Qt::QueuedConnection); + connect(m_setupReader.data(), &CSetupReader::setupHandlingCompleted, this, &CApplication::setupHandlingCompleted, Qt::QueuedConnection); // hand thru connect(m_setupReader.data(), &CSetupReader::updateInfoAvailable, this, &CApplication::updateInfoAvailable, Qt::QueuedConnection); connect(m_setupReader.data(), &CSetupReader::successfullyReadSharedUrl, m_networkWatchDog, &CNetworkWatchdog::setWorkingSharedUrl, Qt::QueuedConnection); @@ -408,6 +409,7 @@ namespace BlackCore if (!m_setupReader) { return CStatusMessage(this).error("No setup reader"); } CEventLoop::processEventsUntil(this, &CApplication::setupHandlingCompleted, timeoutMs, [this] { + // init, if this is true event queue is not started return m_setupReader->isSetupAvailable(); }); @@ -1031,7 +1033,7 @@ namespace BlackCore m_fileLogger->close(); } - void CApplication::setupHandlingIsCompleted(bool available) + void CApplication::onSetupHandlingCompleted(bool available) { if (available) { @@ -1040,7 +1042,6 @@ namespace BlackCore m_started = msgs.isSuccess(); } - emit this->setupHandlingCompleted(available); if (m_signalStartup) { emit this->startUpCompleted(m_started); } } @@ -1543,7 +1544,8 @@ namespace BlackCore CStatusMessageList CApplication::synchronizeSetup(int timeoutMs) { - this->requestReloadOfSetupAndVersion(); + const CStatusMessageList requestMsgs = this->requestReloadOfSetupAndVersion(); + if (requestMsgs.isFailure()) { return requestMsgs; } // request already failed return this->waitForSetup(timeoutMs); } diff --git a/src/blackcore/application.h b/src/blackcore/application.h index 45e3ff053..fb461c1d3 100644 --- a/src/blackcore/application.h +++ b/src/blackcore/application.h @@ -509,7 +509,7 @@ namespace BlackCore protected: //! Setup read/synchronized - void setupHandlingIsCompleted(bool available); + void onSetupHandlingCompleted(bool available); //! Wait for setup data by calling the event loop and waiting until everything is ready //! \remark requires parsing upfront