Follow up of T156, improved setup loading dialog

* allow to load the delivered setup file if there are no other data
* display setup cache information
This commit is contained in:
Klaus Basan
2017-09-23 02:40:33 +02:00
committed by Mathew Sutcliffe
parent bdbf2e75b4
commit 071f327fca
5 changed files with 158 additions and 39 deletions

View File

@@ -526,6 +526,18 @@ namespace BlackCore
return m_setup.get();
}
bool CSetupReader::hasCachedSetup() const
{
const CGlobalSetup cachedSetup = m_setup.get();
const bool cacheAvailable = cachedSetup.wasLoaded();
return cacheAvailable;
}
QDateTime CSetupReader::getSetupCacheTimestamp() const
{
return m_setup.getTimestamp();
}
bool CSetupReader::prefillCacheWithLocalResourceBootstrapFile()
{
if (m_shutdown) { return false; }
@@ -554,6 +566,17 @@ namespace BlackCore
return m_distributions.get();
}
bool CSetupReader::hasCachedDistributionInfo() const
{
const CDistributionList distributions = m_distributions.get();
return !distributions.isEmpty();
}
QDateTime CSetupReader::getDistributionCacheTimestamp() const
{
return m_distributions.getTimestamp();
}
QString CSetupReader::getLastSuccessfulDistributionUrl() const
{
QReadLocker l(&m_lockDistribution);

View File

@@ -74,6 +74,14 @@ namespace BlackCore
//! \threadsafe
BlackCore::Data::CGlobalSetup getSetup() const;
//! Has cached setup ("bootstrap") data?
//! \threadsafe
bool hasCachedSetup() const;
//! Get setup cache timestamp
//! \threadsafe
QDateTime getSetupCacheTimestamp() const;
//! Load the cache file local bootstrap file
//! \remark can be used during installation as failover
//! \threadsafe
@@ -87,6 +95,14 @@ namespace BlackCore
//! \threadsafe
BlackMisc::Db::CDistributionList getDistributionInfo() const;
//! Has cached distribution info?
//! \threadsafe
bool hasCachedDistributionInfo() const;
//! Distribution cache timestamp
//! \threadsafe
QDateTime getDistributionCacheTimestamp() const;
//! Last distribution URL successfully read
//! \threadsafe
QString getLastSuccessfulDistributionUrl() const;
@@ -176,8 +192,8 @@ namespace BlackCore
QString m_lastSuccessfulSetupUrl; //!< last successful read setup URL
QString m_lastSuccessfulDistributionUrl; //!< last successful read distribution URL
BlackMisc::CStatusMessageList m_setupReadErrorMsgs; //!< last parsing error messages
BlackMisc::CData<BlackCore::Data::TGlobalSetup> m_setup {this, &CSetupReader::ps_setupChanged}; //!< data cache setup
BlackMisc::CData<BlackMisc::Db::TDistributionsInfo> m_distributions {this}; //!< data cache distributions
BlackMisc::CData<BlackCore::Data::TGlobalSetup> m_setup { this, &CSetupReader::ps_setupChanged }; //!< data cache setup
BlackMisc::CData<BlackMisc::Db::TDistributionsInfo> m_distributions { this }; //!< data cache distributions
//! Read by local individual file and update cache from that
BlackMisc::CStatusMessageList readLocalBootstrapFile(const QString &fileName);