NOISSUE more NetAction and NetJob cleanups
This commit is contained in:
parent
e1465f4848
commit
1be99b075a
@ -38,6 +38,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
unique_qobject_ptr<QNetworkReply> m_reply;
|
unique_qobject_ptr<QNetworkReply> m_reply;
|
||||||
QUrl m_url;
|
QUrl m_url;
|
||||||
|
// FIXME: pull this up into Task
|
||||||
Status m_status = Status::NotStarted;
|
Status m_status = Status::NotStarted;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -83,7 +83,6 @@ void NetJob::setPartProgress(int index, qint64 bytesReceived, qint64 bytesTotal)
|
|||||||
void NetJob::executeTask()
|
void NetJob::executeTask()
|
||||||
{
|
{
|
||||||
qDebug() << m_job_name.toLocal8Bit() << " started.";
|
qDebug() << m_job_name.toLocal8Bit() << " started.";
|
||||||
m_running = true;
|
|
||||||
for (int i = 0; i < m_parts.size(); i++)
|
for (int i = 0; i < m_parts.size(); i++)
|
||||||
{
|
{
|
||||||
m_todo.enqueue(i);
|
m_todo.enqueue(i);
|
||||||
|
@ -35,28 +35,10 @@ public:
|
|||||||
|
|
||||||
void addNetAction(NetActionPtr action);
|
void addNetAction(NetActionPtr action);
|
||||||
|
|
||||||
NetActionPtr operator[](int index)
|
|
||||||
{
|
|
||||||
return m_parts[index].download;
|
|
||||||
}
|
|
||||||
const NetActionPtr at(const int index)
|
|
||||||
{
|
|
||||||
return m_parts[index].download;
|
|
||||||
}
|
|
||||||
NetActionPtr first()
|
|
||||||
{
|
|
||||||
if (m_parts.size())
|
|
||||||
return m_parts[0].download;
|
|
||||||
return NetActionPtr();
|
|
||||||
}
|
|
||||||
int size() const
|
int size() const
|
||||||
{
|
{
|
||||||
return m_parts.size();
|
return m_parts.size();
|
||||||
}
|
}
|
||||||
virtual bool isRunning() const override
|
|
||||||
{
|
|
||||||
return m_running;
|
|
||||||
}
|
|
||||||
QStringList getFailedFiles();
|
QStringList getFailedFiles();
|
||||||
|
|
||||||
bool canAbort() const override;
|
bool canAbort() const override;
|
||||||
@ -88,7 +70,7 @@ private:
|
|||||||
bool connected = false;
|
bool connected = false;
|
||||||
};
|
};
|
||||||
QString m_job_name;
|
QString m_job_name;
|
||||||
QList<part_info> m_parts;
|
QVector<part_info> m_parts;
|
||||||
QMap<NetAction *, int> m_partsIndex;
|
QMap<NetAction *, int> m_partsIndex;
|
||||||
QQueue<int> m_todo;
|
QQueue<int> m_todo;
|
||||||
QSet<int> m_doing;
|
QSet<int> m_doing;
|
||||||
@ -96,6 +78,5 @@ private:
|
|||||||
QSet<int> m_failed;
|
QSet<int> m_failed;
|
||||||
qint64 current_progress = 0;
|
qint64 current_progress = 0;
|
||||||
qint64 total_progress = 0;
|
qint64 total_progress = 0;
|
||||||
bool m_running = false;
|
|
||||||
bool m_aborted = false;
|
bool m_aborted = false;
|
||||||
};
|
};
|
||||||
|
@ -100,6 +100,7 @@ public slots:
|
|||||||
void setProgress(qint64 current, qint64 total);
|
void setProgress(qint64 current, qint64 total);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
// FIXME: replace these with the m_status from NetAction
|
||||||
bool m_running = false;
|
bool m_running = false;
|
||||||
bool m_finished = false;
|
bool m_finished = false;
|
||||||
bool m_succeeded = false;
|
bool m_succeeded = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user