cancel downloads from updater (#2534)

* cancel downloads from updater - fix #2534

* fix double popup
This commit is contained in:
Zach H 2017-03-25 16:35:43 -04:00 committed by Gavin Bisesi
parent 6f30304271
commit 06c3edf4c6
4 changed files with 45 additions and 18 deletions

View file

@ -1,4 +1,5 @@
#include <QUrl>
#include <QDebug>
#include "update_downloader.h"
@ -14,10 +15,13 @@ void UpdateDownloader::beginDownload(QUrl downloadUrl) {
response = netMan->get(QNetworkRequest(downloadUrl));
connect(response, SIGNAL(finished()), this, SLOT(fileFinished()));
connect(response, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64, qint64)));
connect(response, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError)));
connect(this, SIGNAL(stopDownload()), response, SLOT(abort()));
}
void UpdateDownloader::downloadError(QNetworkReply::NetworkError) {
if (response == nullptr)
return;
emit error(response->errorString().toUtf8());
}