mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +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
@@ -23,6 +23,7 @@
|
||||
#include <QReadWriteLock>
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
#include <QPair>
|
||||
#include <atomic>
|
||||
|
||||
class QNetworkReply;
|
||||
@@ -93,8 +94,18 @@ namespace BlackCore
|
||||
//! \threadsafe
|
||||
BlackMisc::Network::CUrlLogList getUrlLogList() const;
|
||||
|
||||
//! Progress 0..100
|
||||
//! \threadsafe
|
||||
int getNetworkReplyProgress() const { return m_networkReplyProgress; }
|
||||
|
||||
//! Max./current bytes
|
||||
QPair<qint64, qint64> getNetworkReplyBytes() const;
|
||||
|
||||
protected:
|
||||
mutable QReadWriteLock m_lock { QReadWriteLock::Recursive }; //!< lock which can be used from the derived classes
|
||||
std::atomic_int m_networkReplyProgress; //!< Progress percentage 0...100
|
||||
std::atomic_llong m_networkReplyCurrent; //!< current bytes
|
||||
std::atomic_llong m_networkReplyNax; //!< max bytes
|
||||
|
||||
//! Constructor
|
||||
CThreadedReader(QObject *owner, const QString &name);
|
||||
@@ -123,6 +134,9 @@ namespace BlackCore
|
||||
//! \threadsafe read log access is thread safe
|
||||
QNetworkReply *getFromNetworkAndLog(const BlackMisc::Network::CUrl &url, const BlackMisc::CSlot<void(QNetworkReply *)> &callback);
|
||||
|
||||
//! Network request progress
|
||||
virtual void networkReplyProgress(int logId, qint64 current, qint64 max, const QUrl &url);
|
||||
|
||||
//! Network reply received, mark in m_urlReadLog
|
||||
//! \threadsafe
|
||||
void logNetworkReplyReceived(QNetworkReply *reply);
|
||||
|
||||
Reference in New Issue
Block a user