mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
Ref T489, support download progress in our readers
* signal for download progress per entity (DB reader) * ProgressSlot * changed signatures for ProgressSlot
This commit is contained in:
committed by
Mat Sutcliffe
parent
5c785643c7
commit
8c3faa4ca9
@@ -201,6 +201,7 @@ namespace BlackCore
|
||||
QTimer::singleShot(0, this, [ = ]
|
||||
{
|
||||
if (!myself) { return; }
|
||||
if (!sApp || sApp->isShuttingDown()) { return; }
|
||||
emit this->dataRead(validInCacheEntities, CEntityFlags::ReadFinished, 0);
|
||||
});
|
||||
}
|
||||
@@ -220,7 +221,8 @@ namespace BlackCore
|
||||
if (entities == CEntityFlags::NoEntity) { return; }
|
||||
if (!this->isInternetAccessible(QStringLiteral("No network/internet access, will not read %1").arg(CEntityFlags::flagToString(entities)))) { return; }
|
||||
|
||||
//! \todo MS 2018-12 Error: CDatabaseReader has no ps_read method
|
||||
//! \todo MS 2018-12 Error: CDatabaseReader has no ps_read method -> T490
|
||||
//! \todo KB 2018-12 https://dev.swift-project.org/T490
|
||||
const bool s = QMetaObject::invokeMethod(this, "ps_read",
|
||||
Q_ARG(BlackMisc::Network::CEntityFlags::Entity, entities),
|
||||
Q_ARG(BlackMisc::Db::CDbFlags::DataRetrievalModeFlag, mode),
|
||||
@@ -674,6 +676,17 @@ namespace BlackCore
|
||||
<< CThreadUtils::currentThreadInfo() << response.toQString();
|
||||
}
|
||||
|
||||
void CDatabaseReader::networkReplyProgress(int logId, qint64 current, qint64 max, const QUrl &url)
|
||||
{
|
||||
CThreadedReader::networkReplyProgress(logId, current, max, url);
|
||||
const QString fileName = url.fileName();
|
||||
const CEntityFlags::Entity entity = CEntityFlags::singleEntityByName(fileName);
|
||||
if (CEntityFlags::isSingleEntity(entity))
|
||||
{
|
||||
emit this->entityDownloadProgress(entity, logId, m_networkReplyProgress, m_networkReplyCurrent, m_networkReplyNax, url);
|
||||
}
|
||||
}
|
||||
|
||||
QString CDatabaseReader::fileNameForMode(CEntityFlags::Entity entity, CDbFlags::DataRetrievalModeFlag mode)
|
||||
{
|
||||
Q_ASSERT_X(CEntityFlags::isSingleEntity(entity), Q_FUNC_INFO, "needs single entity");
|
||||
|
||||
Reference in New Issue
Block a user