GH-1053 add back update progress dialog

This commit is contained in:
Petr Mrázek
2015-07-26 17:55:29 +02:00
parent 6310f6569c
commit d8caab515a
35 changed files with 151 additions and 63 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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);

View File

@ -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();
}

View File

@ -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();
}

View File

@ -30,10 +30,8 @@ void PasteUpload::executeTask()
m_reply = std::shared_ptr<QNetworkReply>(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()));
}