From d8caab515aa641ec901592d40b5d30c6dfd282f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 26 Jul 2015 17:55:29 +0200 Subject: GH-1053 add back update progress dialog --- logic/net/ByteArrayDownload.cpp | 2 +- logic/net/CacheDownload.cpp | 2 +- logic/net/MD5EtagDownload.cpp | 2 +- logic/net/NetAction.h | 2 +- logic/net/NetJob.cpp | 4 ++-- logic/net/NetJob.h | 4 ++-- logic/net/PasteUpload.cpp | 6 ++---- 7 files changed, 10 insertions(+), 12 deletions(-) (limited to 'logic/net') diff --git a/logic/net/ByteArrayDownload.cpp b/logic/net/ByteArrayDownload.cpp index 151487f0..21990eeb 100644 --- a/logic/net/ByteArrayDownload.cpp +++ b/logic/net/ByteArrayDownload.cpp @@ -44,7 +44,7 @@ void ByteArrayDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal { m_total_progress = bytesTotal; m_progress = bytesReceived; - emit progress(m_index_within_job, bytesReceived, bytesTotal); + emit netActionProgress(m_index_within_job, bytesReceived, bytesTotal); } void ByteArrayDownload::downloadError(QNetworkReply::NetworkError error) diff --git a/logic/net/CacheDownload.cpp b/logic/net/CacheDownload.cpp index a4fac6ef..b125a3d9 100644 --- a/logic/net/CacheDownload.cpp +++ b/logic/net/CacheDownload.cpp @@ -90,7 +90,7 @@ void CacheDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) { m_total_progress = bytesTotal; m_progress = bytesReceived; - emit progress(m_index_within_job, bytesReceived, bytesTotal); + emit netActionProgress(m_index_within_job, bytesReceived, bytesTotal); } void CacheDownload::downloadError(QNetworkReply::NetworkError error) diff --git a/logic/net/MD5EtagDownload.cpp b/logic/net/MD5EtagDownload.cpp index 651ab602..7593c87e 100644 --- a/logic/net/MD5EtagDownload.cpp +++ b/logic/net/MD5EtagDownload.cpp @@ -99,7 +99,7 @@ void MD5EtagDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) { m_total_progress = bytesTotal; m_progress = bytesReceived; - emit progress(m_index_within_job, bytesReceived, bytesTotal); + emit netActionProgress(m_index_within_job, bytesReceived, bytesTotal); } void MD5EtagDownload::downloadError(QNetworkReply::NetworkError error) diff --git a/logic/net/NetAction.h b/logic/net/NetAction.h index 7c5bd5de..85eac8e3 100644 --- a/logic/net/NetAction.h +++ b/logic/net/NetAction.h @@ -81,7 +81,7 @@ public: signals: void started(int index); - void progress(int index, qint64 current, qint64 total); + void netActionProgress(int index, qint64 current, qint64 total); void succeeded(int index); void failed(int index); diff --git a/logic/net/NetJob.cpp b/logic/net/NetJob.cpp index 40d2d1c9..52307e2a 100644 --- a/logic/net/NetJob.cpp +++ b/logic/net/NetJob.cpp @@ -61,7 +61,7 @@ void NetJob::partProgress(int index, qint64 bytesReceived, qint64 bytesTotal) total_progress -= slot.total_progress; slot.total_progress = bytesTotal; total_progress += slot.total_progress; - emit progress(current_progress, total_progress); + setProgress(current_progress, total_progress); } void NetJob::executeTask() @@ -107,7 +107,7 @@ void NetJob::startMoreParts() // connect signals :D connect(part.get(), SIGNAL(succeeded(int)), SLOT(partSucceeded(int))); connect(part.get(), SIGNAL(failed(int)), SLOT(partFailed(int))); - connect(part.get(), SIGNAL(progress(int, qint64, qint64)), + connect(part.get(), SIGNAL(netActionProgress(int, qint64, qint64)), SLOT(partProgress(int, qint64, qint64))); part->start(); } diff --git a/logic/net/NetJob.h b/logic/net/NetJob.h index 4ac6d769..9e4656c7 100644 --- a/logic/net/NetJob.h +++ b/logic/net/NetJob.h @@ -49,10 +49,10 @@ public: // if this is already running, the action needs to be started right away! if (isRunning()) { - emit progress(current_progress, total_progress); + setProgress(current_progress, total_progress); connect(base.get(), SIGNAL(succeeded(int)), SLOT(partSucceeded(int))); connect(base.get(), SIGNAL(failed(int)), SLOT(partFailed(int))); - connect(base.get(), SIGNAL(progress(int, qint64, qint64)), + connect(base.get(), SIGNAL(netActionProgress(int, qint64, qint64)), SLOT(partProgress(int, qint64, qint64))); base->start(); } diff --git a/logic/net/PasteUpload.cpp b/logic/net/PasteUpload.cpp index b780194f..cfbc561d 100644 --- a/logic/net/PasteUpload.cpp +++ b/logic/net/PasteUpload.cpp @@ -30,10 +30,8 @@ void PasteUpload::executeTask() m_reply = std::shared_ptr(rep); setStatus(tr("Uploading to paste.ee")); - connect(rep, &QNetworkReply::downloadProgress, [&](qint64 value, qint64 max) - { setProgress(value / qMax((qint64)1, max) * 100); }); - connect(rep, SIGNAL(error(QNetworkReply::NetworkError)), this, - SLOT(downloadError(QNetworkReply::NetworkError))); + connect(rep, &QNetworkReply::downloadProgress, this, &Task::setProgress); + connect(rep, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError))); connect(rep, SIGNAL(finished()), this, SLOT(downloadFinished())); } -- cgit v1.2.3