NOISSUE some safe refactors and changes of the task subsystem
Possibly also some bug fixes.
This commit is contained in:
@ -43,19 +43,27 @@ protected:
|
||||
public:
|
||||
virtual ~NetAction() {};
|
||||
|
||||
public:
|
||||
virtual qint64 totalProgress() const
|
||||
bool isRunning() const
|
||||
{
|
||||
return m_status == Job_InProgress;
|
||||
}
|
||||
bool isFinished() const
|
||||
{
|
||||
return m_status >= Job_Finished;
|
||||
}
|
||||
bool wasSuccessful() const
|
||||
{
|
||||
return m_status == Job_Finished || m_status == Job_Failed_Proceed;
|
||||
}
|
||||
|
||||
qint64 totalProgress() const
|
||||
{
|
||||
return m_total_progress;
|
||||
}
|
||||
virtual qint64 currentProgress() const
|
||||
qint64 currentProgress() const
|
||||
{
|
||||
return m_progress;
|
||||
}
|
||||
virtual qint64 numberOfFailures() const
|
||||
{
|
||||
return m_failures;
|
||||
}
|
||||
virtual bool abort()
|
||||
{
|
||||
return false;
|
||||
@ -64,25 +72,10 @@ public:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public:
|
||||
/// the network reply
|
||||
unique_qobject_ptr<QNetworkReply> m_reply;
|
||||
|
||||
/// source URL
|
||||
QUrl m_url;
|
||||
|
||||
/// The file's status
|
||||
JobStatus m_status = Job_NotStarted;
|
||||
|
||||
/// index within the parent job
|
||||
int m_index_within_job = 0;
|
||||
|
||||
qint64 m_progress = 0;
|
||||
qint64 m_total_progress = 1;
|
||||
|
||||
/// number of failures up to this point
|
||||
int m_failures = 0;
|
||||
QUrl url()
|
||||
{
|
||||
return m_url;
|
||||
}
|
||||
|
||||
signals:
|
||||
void started(int index);
|
||||
@ -91,14 +84,28 @@ signals:
|
||||
void failed(int index);
|
||||
void aborted(int index);
|
||||
|
||||
protected
|
||||
slots:
|
||||
protected slots:
|
||||
virtual void downloadProgress(qint64 bytesReceived, qint64 bytesTotal) = 0;
|
||||
virtual void downloadError(QNetworkReply::NetworkError error) = 0;
|
||||
virtual void downloadFinished() = 0;
|
||||
virtual void downloadReadyRead() = 0;
|
||||
|
||||
public
|
||||
slots:
|
||||
public slots:
|
||||
virtual void start() = 0;
|
||||
|
||||
public:
|
||||
/// index within the parent job, FIXME: nuke
|
||||
int m_index_within_job = 0;
|
||||
|
||||
/// the network reply
|
||||
unique_qobject_ptr<QNetworkReply> m_reply;
|
||||
|
||||
/// source URL
|
||||
QUrl m_url;
|
||||
|
||||
qint64 m_progress = 0;
|
||||
qint64 m_total_progress = 1;
|
||||
|
||||
protected:
|
||||
JobStatus m_status = Job_NotStarted;
|
||||
};
|
||||
|
Reference in New Issue
Block a user