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

@ -47,7 +47,7 @@ void DownloadTask::loadVersionInfo()
{
setStatus(tr("Loading version information..."));
NetJob *netJob = new NetJob("Version Info");
NetJob *netJob = new NetJob("Version Info", m_network);
// Find the index URL.
QUrl newIndexUrl = QUrl(m_status.newRepoUrl).resolved(QString::number(m_status.newVersionId) + ".json");
@ -67,7 +67,7 @@ void DownloadTask::loadVersionInfo()
connect(netJob, &NetJob::succeeded, this, &DownloadTask::processDownloadedVersionInfo);
connect(netJob, &NetJob::failed, this, &DownloadTask::vinfoDownloadFailed);
m_vinfoNetJob.reset(netJob);
netJob->start(m_network);
netJob->start();
}
void DownloadTask::vinfoDownloadFailed()
@ -121,7 +121,7 @@ void DownloadTask::processDownloadedVersionInfo()
setStatus(tr("Processing file lists - figuring out how to install the update..."));
// make a new netjob for the actual update files
NetJob::Ptr netJob (new NetJob("Update Files"));
NetJob::Ptr netJob = new NetJob("Update Files", m_network);
// fill netJob and operationList
if (!processFileLists(m_currentVersionFileList, m_newVersionFileList, m_status.rootPath, m_updateFilesDir.path(), netJob, m_operations))
@ -145,7 +145,7 @@ void DownloadTask::processDownloadedVersionInfo()
}
qDebug() << "Begin downloading update files to" << m_updateFilesDir.path();
m_filesNetJob = netJob;
m_filesNetJob->start(m_network);
m_filesNetJob->start();
}
void DownloadTask::fileDownloadFinished()

View File

@ -179,7 +179,8 @@ slots:
OperationList operations;
processFileLists(currentVersion, newVersion, QDir::currentPath(), tempFolder, new NetJob("Dummy"), operations);
shared_qobject_ptr<QNetworkAccessManager> network = new QNetworkAccessManager();
processFileLists(currentVersion, newVersion, QDir::currentPath(), tempFolder, new NetJob("Dummy", network), operations);
qDebug() << (operations == expectedOperations);
qDebug() << operations;
qDebug() << expectedOperations;

View File

@ -104,11 +104,11 @@ void UpdateChecker::checkForUpdate(QString updateChannel, bool notifyNoUpdate)
QUrl indexUrl = QUrl(m_newRepoUrl).resolved(QUrl("index.json"));
indexJob = new NetJob("GoUpdate Repository Index");
indexJob = new NetJob("GoUpdate Repository Index", m_network);
indexJob->addNetAction(Net::Download::makeByteArray(indexUrl, &indexData));
connect(indexJob.get(), &NetJob::succeeded, [this, notifyNoUpdate](){ updateCheckFinished(notifyNoUpdate); });
connect(indexJob.get(), &NetJob::failed, this, &UpdateChecker::updateCheckFailed);
indexJob->start(m_network);
indexJob->start();
}
void UpdateChecker::updateCheckFinished(bool notifyNoUpdate)
@ -191,11 +191,11 @@ void UpdateChecker::updateChanList(bool notifyNoUpdate)
}
m_chanListLoading = true;
chanListJob = new NetJob("Update System Channel List");
chanListJob = new NetJob("Update System Channel List", m_network);
chanListJob->addNetAction(Net::Download::makeByteArray(QUrl(m_channelUrl), &chanlistData));
connect(chanListJob.get(), &NetJob::succeeded, [this, notifyNoUpdate]() { chanListDownloadFinished(notifyNoUpdate); });
connect(chanListJob.get(), &NetJob::failed, this, &UpdateChecker::chanListDownloadFailed);
chanListJob->start(m_network);
chanListJob->start();
}
void UpdateChecker::chanListDownloadFinished(bool notifyNoUpdate)