Ref T203, renamings and improved messages in setup reader

This commit is contained in:
Klaus Basan
2017-12-11 04:13:34 +01:00
parent 4c0c28a4a4
commit 7cf5dcdd8a
3 changed files with 18 additions and 18 deletions

View File

@@ -446,7 +446,7 @@ namespace BlackCore
}
if (m_setupReader->hasCmdLineBootstrapUrl())
{
msgs.push_back(CStatusMessage(this).info("Check cmd line argument '%1'") << m_setupReader->getCmdLineBootstrapUrl());
msgs.push_back(CStatusMessage(this).info("Bootstrap URL cmd line argument '%1'") << m_setupReader->getCmdLineBootstrapUrl());
}
return msgs;
}
@@ -1420,7 +1420,7 @@ namespace BlackCore
QString CApplication::getLastSuccesfulDistributionUrl() const
{
if (!this->hasSetupReader()) { return ""; }
return m_setupReader->getLastSuccessfulDistributionUrl();
return m_setupReader->getLastSuccessfulUpdateInfoUrl();
}
CStatusMessageList CApplication::synchronizeSetup(int timeoutMs)

View File

@@ -241,7 +241,7 @@ namespace BlackCore
return msgs;
}
const CStatusMessage m(this, CStatusMessage::SeverityInfo, "Start reading URL: " + url.toQString());
sApp->getFromNetwork(url.toNetworkRequest(), { this, &CSetupReader::parseSetupFile });
sApp->getFromNetwork(url.toNetworkRequest(), { this, &CSetupReader::parseBootstrapFile });
this->setLastSetupReadErrorMessages(m); // clear errors
return m;
}
@@ -310,7 +310,7 @@ namespace BlackCore
}
}
void CSetupReader::parseSetupFile(QNetworkReply *nwReplyPtr)
void CSetupReader::parseBootstrapFile(QNetworkReply *nwReplyPtr)
{
// wrap pointer, make sure any exit cleans up reply
// required to use delete later as object is created in a different thread
@@ -426,7 +426,7 @@ namespace BlackCore
nwReplyPtr->close();
if (updateInfoJsonString.isEmpty())
{
CLogMessage(this).info("No distribution file content");
CLogMessage(this).info("No update info file content");
// try next URL
}
else
@@ -451,7 +451,7 @@ namespace BlackCore
else
{
{
QWriteLocker l(&m_lockDistribution);
QWriteLocker l(&m_lockUpdateInfo);
m_lastSuccessfulUpdateInfoUrl = urlString;
}
CLogMessage(this).info("Update info loaded from '%1") << urlString;
@@ -465,7 +465,7 @@ namespace BlackCore
{
// we downloaded an unparsable JSON file.
// as we control those files something is wrong
const QString errorMsg = QString("Distribution file loaded from '%1' cannot be parsed").arg(urlString);
const QString errorMsg = QString("Update info file loaded from '%1' cannot be parsed").arg(urlString);
const CStatusMessage msg = ex.toStatusMessage(this, errorMsg);
CLogMessage::preformatted(msg);
@@ -569,14 +569,14 @@ namespace BlackCore
return !updateInfo.isEmpty();
}
QDateTime CSetupReader::getDistributionCacheTimestamp() const
QDateTime CSetupReader::getUpdateInfoCacheTimestamp() const
{
return m_updateInfo.getTimestamp();
}
QString CSetupReader::getLastSuccessfulDistributionUrl() const
QString CSetupReader::getLastSuccessfulUpdateInfoUrl() const
{
QReadLocker l(&m_lockDistribution);
QReadLocker l(&m_lockUpdateInfo);
return m_lastSuccessfulUpdateInfoUrl;
}

View File

@@ -33,10 +33,10 @@ namespace BlackMisc { class CLogCategoryList; }
namespace BlackCoreTest { class CTestConnectivity; }
namespace BlackCore
{
//! Read the central URLs / locations of our data / setup.
//! Read the central URLs / locations of our data, setup and versions.
//!
//! \details This class should be only used in BlackCore::CApplication. It will also trigger reading
//! update information.
//! \details This class should be only used in BlackCore::CApplication.
//! It will also trigger reading update information.
//!
//! \note This class is no(!) BlackCore::CThreadedReader as it will be loaded once during startup
//! and reading setup data is fast. The read file is also called "bootstrap" file as it tells
@@ -99,13 +99,13 @@ namespace BlackCore
//! \threadsafe
bool hasCachedUpdateInfo() const;
//! Distribution cache timestamp
//! Update info cache timestamp
//! \threadsafe
QDateTime getDistributionCacheTimestamp() const;
QDateTime getUpdateInfoCacheTimestamp() const;
//! Last distribution URL successfully read
//! Last update info URL successfully read
//! \threadsafe
QString getLastSuccessfulDistributionUrl() const;
QString getLastSuccessfulUpdateInfoUrl() const;
//! Last setup parsing error messages (if any)
BlackMisc::CStatusMessageList getLastSetupReadErrorMessages() const;
@@ -201,7 +201,7 @@ namespace BlackCore
//! \threadsafe
BlackMisc::CStatusMessageList manageSetupAvailability(bool webRead, bool localRead = false);
//! Emit the available signal
//! Emit the availability signal
//! \threadsafe
void manageUpdateInfoAvailability(bool webRead);