NOISSUE fix build and change how NetJob is used

Feed it network upfront...
This commit is contained in:
Petr Mrázek
2021-12-31 05:27:59 +01:00
parent 9cc168c526
commit 9579231ccc
31 changed files with 103 additions and 113 deletions

View File

@ -98,12 +98,6 @@ void NetJob::partProgress(int index, qint64 bytesReceived, qint64 bytesTotal)
void NetJob::executeTask()
{
if(!m_network) {
qCritical() << "Attempted to start NetJob" << objectName() << "without the network set!";
emitFailed(tr("Internal error: NetJob '%1' has been started without a network pointer!").arg(objectName()));
return;
}
// hack that delays early failures so they can be caught easier
QMetaObject::invokeMethod(this, "startMoreParts", Qt::QueuedConnection);
}

View File

@ -29,17 +29,12 @@ class NetJob : public Task
public:
using Ptr = shared_qobject_ptr<NetJob>;
explicit NetJob(QString job_name) : Task()
explicit NetJob(QString job_name, shared_qobject_ptr<QNetworkAccessManager> network) : Task(), m_network(network)
{
setObjectName(job_name);
}
virtual ~NetJob();
void setNetwork(shared_qobject_ptr<QNetworkAccessManager> network)
{
m_network = network;
}
bool addNetAction(NetAction::Ptr action);
NetAction::Ptr operator[](int index)
@ -70,10 +65,6 @@ private slots:
public slots:
virtual void executeTask() override;
virtual bool abort() override;
virtual void start(shared_qobject_ptr<QNetworkAccessManager> network) {
m_network = network;
Task::start();
}
private slots:
void partProgress(int index, qint64 bytesReceived, qint64 bytesTotal);