Ref T160, "private slots" to "private" in setup reader

This commit is contained in:
Klaus Basan
2017-09-25 03:36:44 +02:00
parent dabe50bcfe
commit d1898b26fc
2 changed files with 27 additions and 28 deletions

View File

@@ -208,7 +208,7 @@ namespace BlackCore
this->m_shutdown = true; this->m_shutdown = true;
} }
void CSetupReader::ps_readSetup() void CSetupReader::readSetup()
{ {
const CStatusMessageList msgs(this->triggerReadSetup()); const CStatusMessageList msgs(this->triggerReadSetup());
if (!msgs.isSuccess()) if (!msgs.isSuccess())
@@ -242,12 +242,12 @@ namespace BlackCore
return msgs; return msgs;
} }
const CStatusMessage m(this, CStatusMessage::SeverityInfo, "Start reading URL: " + url.toQString()); const CStatusMessage m(this, CStatusMessage::SeverityInfo, "Start reading URL: " + url.toQString());
sApp->getFromNetwork(url.toNetworkRequest(), { this, &CSetupReader::ps_parseSetupFile }); sApp->getFromNetwork(url.toNetworkRequest(), { this, &CSetupReader::parseSetupFile });
this->setLastSetupReadErrorMessages(m); // clear errors this->setLastSetupReadErrorMessages(m); // clear errors
return m; return m;
} }
void CSetupReader::ps_readDistributionInfo() void CSetupReader::readDistributionInfo()
{ {
const CUrl url(this->m_distributionUrls.obtainNextWorkingUrl()); const CUrl url(this->m_distributionUrls.obtainNextWorkingUrl());
if (url.isEmpty()) if (url.isEmpty())
@@ -258,10 +258,10 @@ namespace BlackCore
return; return;
} }
if (m_shutdown) { return; } if (m_shutdown) { return; }
sApp->getFromNetwork(url.toNetworkRequest(), { this, &CSetupReader::ps_parseDistributionsFile}); sApp->getFromNetwork(url.toNetworkRequest(), { this, &CSetupReader::parseDistributionsFile});
} }
void CSetupReader::ps_setupChanged() void CSetupReader::setupChanged()
{ {
// settings have changed on disk // settings have changed on disk
} }
@@ -316,7 +316,7 @@ namespace BlackCore
} }
} }
void CSetupReader::ps_parseSetupFile(QNetworkReply *nwReplyPtr) void CSetupReader::parseSetupFile(QNetworkReply *nwReplyPtr)
{ {
// wrap pointer, make sure any exit cleans up reply // wrap pointer, make sure any exit cleans up reply
// required to use delete later as object is created in a different thread // required to use delete later as object is created in a different thread
@@ -404,7 +404,7 @@ namespace BlackCore
if (this->m_bootstrapUrls.addFailedUrl(url)) if (this->m_bootstrapUrls.addFailedUrl(url))
{ {
m_distributionUrls.addFailedHost(url); // the same host will likely fail for distributions m_distributionUrls.addFailedHost(url); // the same host will likely fail for distributions
QTimer::singleShot(500, this, &CSetupReader::ps_readSetup); QTimer::singleShot(500, this, &CSetupReader::readSetup);
} }
else else
{ {
@@ -413,7 +413,7 @@ namespace BlackCore
} }
} }
void CSetupReader::ps_parseDistributionsFile(QNetworkReply *nwReplyPtr) void CSetupReader::parseDistributionsFile(QNetworkReply *nwReplyPtr)
{ {
// wrap pointer, make sure any exit cleans up reply // wrap pointer, make sure any exit cleans up reply
// required to use delete later as object is created in a different thread // required to use delete later as object is created in a different thread
@@ -489,7 +489,7 @@ namespace BlackCore
// try next one if any // try next one if any
if (this->m_distributionUrls.addFailedUrl(url)) if (this->m_distributionUrls.addFailedUrl(url))
{ {
QTimer::singleShot(500, this, &CSetupReader::ps_readDistributionInfo); QTimer::singleShot(500, this, &CSetupReader::readDistributionInfo);
} }
else else
{ {
@@ -620,12 +620,12 @@ namespace BlackCore
if (webRead) if (webRead)
{ {
msgs.push_back(CStatusMessage(this).info("Setup loaded from web, will trigger read of distribution information")); msgs.push_back(CStatusMessage(this).info("Setup loaded from web, will trigger read of distribution information"));
QTimer::singleShot(500, this, &CSetupReader::ps_readDistributionInfo); QTimer::singleShot(500, this, &CSetupReader::readDistributionInfo);
} }
if (localRead) if (localRead)
{ {
msgs.push_back(CStatusMessage(this).info("Setup loaded locally, will trigger read of distribution information")); msgs.push_back(CStatusMessage(this).info("Setup loaded locally, will trigger read of distribution information"));
QTimer::singleShot(500, this, &CSetupReader::ps_readDistributionInfo); QTimer::singleShot(500, this, &CSetupReader::readDistributionInfo);
} }
bool available = false; bool available = false;

View File

@@ -150,22 +150,6 @@ namespace BlackCore
//! \threadsafe //! \threadsafe
bool isUpdateInfoAvailable() const { return m_distributionInfoAvailable; } bool isUpdateInfoAvailable() const { return m_distributionInfoAvailable; }
private slots:
//! Setup has been read (aka bootstrap file)
void ps_parseSetupFile(QNetworkReply *nwReply);
//! Update info has been read
void ps_parseDistributionsFile(QNetworkReply *nwReplyPtr);
//! Do reading
void ps_readSetup();
//! Do reading of distributions
void ps_readDistributionInfo();
//! Setup has been changed
void ps_setupChanged();
private: private:
//! Bootstrap mode //! Bootstrap mode
enum BootstrapMode enum BootstrapMode
@@ -192,9 +176,24 @@ namespace BlackCore
QString m_lastSuccessfulSetupUrl; //!< last successful read setup URL QString m_lastSuccessfulSetupUrl; //!< last successful read setup URL
QString m_lastSuccessfulDistributionUrl; //!< last successful read distribution URL QString m_lastSuccessfulDistributionUrl; //!< last successful read distribution URL
BlackMisc::CStatusMessageList m_setupReadErrorMsgs; //!< last parsing error messages BlackMisc::CStatusMessageList m_setupReadErrorMsgs; //!< last parsing error messages
BlackMisc::CData<BlackCore::Data::TGlobalSetup> m_setup { this, &CSetupReader::ps_setupChanged }; //!< data cache setup BlackMisc::CData<BlackCore::Data::TGlobalSetup> m_setup { this, &CSetupReader::setupChanged }; //!< data cache setup
BlackMisc::CData<BlackMisc::Db::TDistributionsInfo> m_distributions { this }; //!< data cache distributions BlackMisc::CData<BlackMisc::Db::TDistributionsInfo> m_distributions { this }; //!< data cache distributions
//! Setup has been read (aka bootstrap file)
void parseSetupFile(QNetworkReply *nwReply);
//! Update info has been read
void parseDistributionsFile(QNetworkReply *nwReplyPtr);
//! Do reading
void readSetup();
//! Do reading of distributions
void readDistributionInfo();
//! Setup has been changed
void setupChanged();
//! Read by local individual file and update cache from that //! Read by local individual file and update cache from that
BlackMisc::CStatusMessageList readLocalBootstrapFile(const QString &fileName); BlackMisc::CStatusMessageList readLocalBootstrapFile(const QString &fileName);