diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-10-06 01:13:40 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-10-06 01:13:40 +0200 |
commit | f83119ce7ec3d11a903901b8eff762d2b0a9f635 (patch) | |
tree | 5c30d7b9fff0f9417e7f2cd79d8ad9ea56d7f056 /logic/net/ByteArrayDownload.cpp | |
parent | eba9b3d759dbf6e402e91ab897059f1d274aef90 (diff) | |
download | MultiMC-f83119ce7ec3d11a903901b8eff762d2b0a9f635.tar MultiMC-f83119ce7ec3d11a903901b8eff762d2b0a9f635.tar.gz MultiMC-f83119ce7ec3d11a903901b8eff762d2b0a9f635.tar.lz MultiMC-f83119ce7ec3d11a903901b8eff762d2b0a9f635.tar.xz MultiMC-f83119ce7ec3d11a903901b8eff762d2b0a9f635.zip |
Added file logger
Diffstat (limited to 'logic/net/ByteArrayDownload.cpp')
-rw-r--r-- | logic/net/ByteArrayDownload.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/logic/net/ByteArrayDownload.cpp b/logic/net/ByteArrayDownload.cpp index b7a68c60..ba771eef 100644 --- a/logic/net/ByteArrayDownload.cpp +++ b/logic/net/ByteArrayDownload.cpp @@ -1,6 +1,6 @@ #include "ByteArrayDownload.h" #include "MultiMC.h" -#include <QDebug> +#include <logger/QsLog.h> ByteArrayDownload::ByteArrayDownload(QUrl url) : Download() { @@ -10,13 +10,13 @@ ByteArrayDownload::ByteArrayDownload(QUrl url) : Download() void ByteArrayDownload::start() { - qDebug() << "Downloading " << m_url.toString(); + QLOG_INFO() << "Downloading " << m_url.toString(); QNetworkRequest request(m_url); request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)"); auto worker = MMC->qnam(); QNetworkReply *rep = worker->get(request); - m_reply = QSharedPointer<QNetworkReply>(rep, &QObject::deleteLater); + m_reply = std::shared_ptr<QNetworkReply>(rep); connect(rep, SIGNAL(downloadProgress(qint64, qint64)), SLOT(downloadProgress(qint64, qint64))); connect(rep, SIGNAL(finished()), SLOT(downloadFinished())); @@ -33,7 +33,8 @@ void ByteArrayDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal void ByteArrayDownload::downloadError(QNetworkReply::NetworkError error) { // error happened during download. - qDebug() << "URL:" << m_url.toString().toLocal8Bit() << "Network error: " << error; + QLOG_ERROR() << "Error getting URL:" << m_url.toString().toLocal8Bit() + << "Network error: " << error; m_status = Job_Failed; } @@ -45,14 +46,14 @@ void ByteArrayDownload::downloadFinished() // nothing went wrong... m_status = Job_Finished; m_data = m_reply->readAll(); - m_reply.clear(); + m_reply.reset(); emit succeeded(index_within_job); return; } // else the download failed else { - m_reply.clear(); + m_reply.reset(); emit failed(index_within_job); return; } |