mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 17:14:52 -07:00
cancel downloads from updater (#2534)
* cancel downloads from updater - fix #2534 * fix double popup
This commit is contained in:
parent
6f30304271
commit
06c3edf4c6
4 changed files with 45 additions and 18 deletions
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue