diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-12-15 15:00:09 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-12-15 15:00:09 +0100 |
commit | 5a3043398e45cbe39455609a42463f2e6e5d3fd2 (patch) | |
tree | ded26672e798e3d4da9c53cb962d39c58d0e3fa9 /logic/net/MD5EtagDownload.cpp | |
parent | ae169abd74571df2ab002c6ebf2962fed937391a (diff) | |
download | MultiMC-5a3043398e45cbe39455609a42463f2e6e5d3fd2.tar MultiMC-5a3043398e45cbe39455609a42463f2e6e5d3fd2.tar.gz MultiMC-5a3043398e45cbe39455609a42463f2e6e5d3fd2.tar.lz MultiMC-5a3043398e45cbe39455609a42463f2e6e5d3fd2.tar.xz MultiMC-5a3043398e45cbe39455609a42463f2e6e5d3fd2.zip |
Use asset sizes from the index to make the progress bar better
Diffstat (limited to 'logic/net/MD5EtagDownload.cpp')
-rw-r--r-- | logic/net/MD5EtagDownload.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/logic/net/MD5EtagDownload.cpp b/logic/net/MD5EtagDownload.cpp index 4b9f52af..435e854e 100644 --- a/logic/net/MD5EtagDownload.cpp +++ b/logic/net/MD5EtagDownload.cpp @@ -44,7 +44,7 @@ void MD5EtagDownload::start() if (m_check_md5 && hash == m_expected_md5) { QLOG_INFO() << "Skipping " << m_url.toString() << ": md5 match."; - emit succeeded(index_within_job); + emit succeeded(m_index_within_job); return; } else @@ -54,7 +54,7 @@ void MD5EtagDownload::start() } if (!ensureFilePathExists(filename)) { - emit failed(index_within_job); + emit failed(m_index_within_job); return; } @@ -68,7 +68,7 @@ void MD5EtagDownload::start() // Plus, this way, we don't end up starting a download for a file we can't open. if (!m_output_file.open(QIODevice::WriteOnly)) { - emit failed(index_within_job); + emit failed(m_index_within_job); return; } @@ -86,7 +86,9 @@ void MD5EtagDownload::start() void MD5EtagDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) { - emit progress(index_within_job, bytesReceived, bytesTotal); + m_total_progress = bytesTotal; + m_progress = bytesReceived; + emit progress(m_index_within_job, bytesReceived, bytesTotal); } void MD5EtagDownload::downloadError(QNetworkReply::NetworkError error) @@ -107,7 +109,7 @@ void MD5EtagDownload::downloadFinished() QLOG_INFO() << "Finished " << m_url.toString() << " got " << m_reply->rawHeader("ETag").constData(); m_reply.reset(); - emit succeeded(index_within_job); + emit succeeded(m_index_within_job); return; } // else the download failed @@ -115,7 +117,7 @@ void MD5EtagDownload::downloadFinished() { m_output_file.close(); m_reply.reset(); - emit failed(index_within_job); + emit failed(m_index_within_job); return; } } @@ -130,7 +132,7 @@ void MD5EtagDownload::downloadReadyRead() * Can't open the file... the job failed */ m_reply->abort(); - emit failed(index_within_job); + emit failed(m_index_within_job); return; } } |