refs #521, reading of setup and version

* fixed in launcher so reloading works (this also uses fixed URL list)
* signal for version synchronized
* removed setupreader.h where possible -> less compile dependencies
* removed redundant logging
* removed unused cleanup override
* connect &QCoreApplication::aboutToQuit in threaded reader
This commit is contained in:
Klaus Basan
2015-11-25 03:44:19 +01:00
parent 530ddb3d9f
commit 94a277ee8e
8 changed files with 56 additions and 25 deletions

View File

@@ -90,6 +90,7 @@ namespace BlackCore
if (url.isEmpty())
{
CLogMessage(this).warning("Cannot read update info, failed URLs: %1") << this->m_updateInfoUrls.read()->getFailedUrls();
emit versionSynchronized(false);
return;
}
QNetworkRequest request(url);
@@ -144,7 +145,6 @@ namespace BlackCore
if (this->isFinishedOrShutdown())
{
CLogMessage(this).debug() << Q_FUNC_INFO;
CLogMessage(this).info("Terminated loading bootstrap files");
nwReply->abort();
emit setupSynchronized(false);
@@ -234,9 +234,9 @@ namespace BlackCore
if (this->isFinishedOrShutdown())
{
CLogMessage(this).debug() << Q_FUNC_INFO;
CLogMessage(this).info("Terminated loading of update info");
nwReply->abort();
emit versionSynchronized(false);
return; // stop, terminate straight away, ending thread
}
@@ -263,6 +263,7 @@ namespace BlackCore
if (sameVersionLoaded)
{
CLogMessage(this).info("Same update info loaded from %1 as already in data cache %2") << urlString << m_updateInfo.getFilename();
emit versionSynchronized(true);
return; // success
}
@@ -279,11 +280,13 @@ namespace BlackCore
if (!m.isEmpty())
{
CLogMessage(this).preformatted(m);
emit versionSynchronized(false);
return; // issue with cache
}
else
{
CLogMessage(this).info("Update info: Updated data cache in %1") << m_updateInfo.getFilename();
emit versionSynchronized(true);
return; // success
} // cache
} // outdated?
@@ -302,6 +305,10 @@ namespace BlackCore
{
QTimer::singleShot(500, this, &CSetupReader::ps_readSetup);
}
else
{
emit versionSynchronized(false);
}
} // method
} // namespace

View File

@@ -37,6 +37,9 @@ namespace BlackCore
//! Setup has been read
void setupSynchronized(bool success);
//! Version bas been read
void versionSynchronized(bool success);
protected slots:
//! \copydoc CThreadedReader::initialize
virtual void initialize() override;

View File

@@ -35,8 +35,8 @@ using namespace BlackMisc::Weather;
namespace BlackCore
{
CWebDataServices::CWebDataServices(
CWebReaderFlags::WebReader readerFlags, int autoReadAfterSetupSynchronized, QObject *parent) :
QObject(parent), m_readerFlags(readerFlags), m_autoReadAfterSetupMs(autoReadAfterSetupSynchronized)
CWebReaderFlags::WebReader readerFlags, int autoReadAfterSetupSynchronizedMs, QObject *parent) :
QObject(parent), m_readerFlags(readerFlags), m_autoReadAfterSetupMs(autoReadAfterSetupSynchronizedMs)
{
this->setObjectName("CWebDataReader");
connect(&CSetupReader::instance(), &CSetupReader::setupSynchronized, this, &CWebDataServices::ps_setupRead);

View File

@@ -14,7 +14,6 @@
#include "blackcore/blackcoreexport.h"
#include "blackcore/webreaderflags.h"
#include "blackcore/setupreader.h"
#include "blackcore/data/globalsetup.h"
#include "blackmisc/aviation/atcstationlist.h"
#include "blackmisc/aviation/liverylist.h"
@@ -53,7 +52,7 @@ namespace BlackCore
public:
//! Constructor
CWebDataServices(CWebReaderFlags::WebReader readerFlags,
int autoReadAfterSetupSynchronized, QObject *parent = nullptr);
int autoReadAfterSetupSynchronizedMs, QObject *parent = nullptr);
//! Shutdown
void gracefulShutdown();