diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-12-10 07:12:52 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-12-10 07:12:52 +0100 |
commit | 3f5c46a1c4b27e82976e0067e4ec2d6abfffd9ba (patch) | |
tree | 9231f1304db15e966e1fe57c1b5b41ba26267b21 /logic/net | |
parent | 8db2e5db81c91cca9291ca35ed74e632278563e6 (diff) | |
download | MultiMC-3f5c46a1c4b27e82976e0067e4ec2d6abfffd9ba.tar MultiMC-3f5c46a1c4b27e82976e0067e4ec2d6abfffd9ba.tar.gz MultiMC-3f5c46a1c4b27e82976e0067e4ec2d6abfffd9ba.tar.lz MultiMC-3f5c46a1c4b27e82976e0067e4ec2d6abfffd9ba.tar.xz MultiMC-3f5c46a1c4b27e82976e0067e4ec2d6abfffd9ba.zip |
Finish assets update for 1.7.3
Diffstat (limited to 'logic/net')
-rw-r--r-- | logic/net/MD5EtagDownload.cpp (renamed from logic/net/FileDownload.cpp) | 17 | ||||
-rw-r--r-- | logic/net/MD5EtagDownload.h (renamed from logic/net/FileDownload.h) | 10 | ||||
-rw-r--r-- | logic/net/NetJob.cpp | 2 | ||||
-rw-r--r-- | logic/net/NetJob.h | 2 |
4 files changed, 16 insertions, 15 deletions
diff --git a/logic/net/FileDownload.cpp b/logic/net/MD5EtagDownload.cpp index 239af351..7b77bfbf 100644 --- a/logic/net/FileDownload.cpp +++ b/logic/net/MD5EtagDownload.cpp @@ -14,12 +14,12 @@ */ #include "MultiMC.h" -#include "FileDownload.h" +#include "MD5EtagDownload.h" #include <pathutils.h> #include <QCryptographicHash> #include "logger/QsLog.h" -FileDownload::FileDownload(QUrl url, QString target_path) : NetAction() +MD5EtagDownload::MD5EtagDownload(QUrl url, QString target_path) : NetAction() { m_url = url; m_target_path = target_path; @@ -27,7 +27,7 @@ FileDownload::FileDownload(QUrl url, QString target_path) : NetAction() m_status = Job_NotStarted; } -void FileDownload::start() +void MD5EtagDownload::start() { QString filename = m_target_path; m_output_file.setFileName(filename); @@ -58,7 +58,7 @@ void FileDownload::start() return; } - QLOG_INFO() << "Downloading " << m_url.toString(); + QLOG_INFO() << "Downloading " << m_url.toString() << " expecting " << m_expected_md5; QNetworkRequest request(m_url); request.setRawHeader(QString("If-None-Match").toLatin1(), m_expected_md5.toLatin1()); request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)"); @@ -75,19 +75,19 @@ void FileDownload::start() connect(rep, SIGNAL(readyRead()), SLOT(downloadReadyRead())); } -void FileDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) +void MD5EtagDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) { emit progress(index_within_job, bytesReceived, bytesTotal); } -void FileDownload::downloadError(QNetworkReply::NetworkError error) +void MD5EtagDownload::downloadError(QNetworkReply::NetworkError error) { // error happened during download. // TODO: log the reason why m_status = Job_Failed; } -void FileDownload::downloadFinished() +void MD5EtagDownload::downloadFinished() { // if the download succeeded if (m_status != Job_Failed) @@ -96,6 +96,7 @@ void FileDownload::downloadFinished() m_status = Job_Finished; m_output_file.close(); + QLOG_INFO() << "Finished " << m_url.toString() << " got " << m_reply->rawHeader("ETag").constData(); m_reply.reset(); emit succeeded(index_within_job); return; @@ -110,7 +111,7 @@ void FileDownload::downloadFinished() } } -void FileDownload::downloadReadyRead() +void MD5EtagDownload::downloadReadyRead() { if (!m_output_file.isOpen()) { diff --git a/logic/net/FileDownload.h b/logic/net/MD5EtagDownload.h index 58380e86..416ab9de 100644 --- a/logic/net/FileDownload.h +++ b/logic/net/MD5EtagDownload.h @@ -18,8 +18,8 @@ #include "NetAction.h" #include <QFile> -typedef std::shared_ptr<class FileDownload> FileDownloadPtr; -class FileDownload : public NetAction +typedef std::shared_ptr<class MD5EtagDownload> Md5EtagDownloadPtr; +class MD5EtagDownload : public NetAction { Q_OBJECT public: @@ -35,10 +35,10 @@ public: QFile m_output_file; public: - explicit FileDownload(QUrl url, QString target_path); - static FileDownloadPtr make(QUrl url, QString target_path) + explicit MD5EtagDownload(QUrl url, QString target_path); + static Md5EtagDownloadPtr make(QUrl url, QString target_path) { - return FileDownloadPtr(new FileDownload(url, target_path)); + return Md5EtagDownloadPtr(new MD5EtagDownload(url, target_path)); } protected slots: diff --git a/logic/net/NetJob.cpp b/logic/net/NetJob.cpp index 333cdcbf..8b79bc54 100644 --- a/logic/net/NetJob.cpp +++ b/logic/net/NetJob.cpp @@ -16,7 +16,7 @@ #include "NetJob.h" #include "pathutils.h" #include "MultiMC.h" -#include "FileDownload.h" +#include "MD5EtagDownload.h" #include "ByteArrayDownload.h" #include "CacheDownload.h" diff --git a/logic/net/NetJob.h b/logic/net/NetJob.h index a7027e10..6e2e7607 100644 --- a/logic/net/NetJob.h +++ b/logic/net/NetJob.h @@ -18,7 +18,7 @@ #include <QLabel> #include "NetAction.h" #include "ByteArrayDownload.h" -#include "FileDownload.h" +#include "MD5EtagDownload.h" #include "CacheDownload.h" #include "HttpMetaCache.h" #include "ForgeXzDownload.h" |