summaryrefslogtreecommitdiffstats
path: root/logic/net/ByteArrayDownload.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'logic/net/ByteArrayDownload.cpp')
-rw-r--r--logic/net/ByteArrayDownload.cpp13
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;
}