refs #507, changed setup reader and simplied global setup and setup reader

* a single base URL (shared), derived URLs by appended path
* simplified dir structure shared with sub directories
* renamed functions
* automatically synchronize setup with DB when initialized
* trigger download info loading when setup is completed
* allow to automatically read after setup data have been synchronized
* read DB data when setup has been loaded
* allow to reload from threaded reader
* improved handling (log messages, skip reading) when data are not available
This commit is contained in:
Klaus Basan
2015-11-13 03:03:03 +01:00
committed by Mathew Sutcliffe
parent 4d4d6fcdc9
commit d131cd2d33
25 changed files with 527 additions and 267 deletions

View File

@@ -19,6 +19,19 @@ namespace BlackMisc
m_updateTimer(new QTimer(this))
{ }
qint64 CThreadedReader::lastModifiedMsSinceEpoch(QNetworkReply *nwReply) const
{
if (nwReply)
{
QVariant lastModifiedQv = nwReply->header(QNetworkRequest::LastModifiedHeader);
if (lastModifiedQv.isValid() && lastModifiedQv.canConvert<QDateTime>())
{
return lastModifiedQv.value<QDateTime>().toMSecsSinceEpoch();
}
}
return -1;
}
bool CThreadedReader::isFinishedOrShutdown() const
{
return m_shutdown || isFinished();
@@ -38,14 +51,20 @@ namespace BlackMisc
void CThreadedReader::requestStop()
{
setFinished();
QMetaObject::invokeMethod(m_updateTimer, "stop");
}
void CThreadedReader::requestReload()
{
// default implementation, subclasses shall override as required
this->initialize();
}
void CThreadedReader::gracefulShutdown()
{
this->m_shutdown = true;
this->requestStop();
this->quit();
}
CThreadedReader::~CThreadedReader()