diff options
Diffstat (limited to 'logic/net')
-rw-r--r-- | logic/net/SkinDownload.cpp | 60 | ||||
-rw-r--r-- | logic/net/SkinDownload.h | 38 |
2 files changed, 0 insertions, 98 deletions
diff --git a/logic/net/SkinDownload.cpp b/logic/net/SkinDownload.cpp deleted file mode 100644 index fa7be2b5..00000000 --- a/logic/net/SkinDownload.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "MultiMC.h" -#include "SkinDownload.h" -#include "DownloadJob.h" -#include <pathutils.h> - -#include <QImage> -#include <QPainter> -#include <QCryptographicHash> -#include <QFileInfo> -#include <QDateTime> -#include <logger/QsLog.h> - -SkinDownload::SkinDownload(QString name) -{ - m_name = name; - m_entry = MMC->metacache()->resolveEntry("skins", name + ".png"); - m_entry->stale = true; - m_url = QUrl("http://skins.minecraft.net/MinecraftSkins/" + name + ".png"); -} - -void SkinDownload::start() -{ - auto job = new DownloadJob("Player skin: " + m_name); - - job->addCacheDownload(m_url, m_entry); - m_job.reset(job); - - connect(m_job.get(), SIGNAL(started()), SLOT(downloadStarted())); - connect(m_job.get(), SIGNAL(progress(qint64, qint64)), SLOT(downloadProgress(qint64, qint64))); - connect(m_job.get(), SIGNAL(succeeded()), SLOT(downloadSucceeded())); - connect(m_job.get(), SIGNAL(failed()), SLOT(downloadFailed())); - - m_job->start(); -} - -void SkinDownload::downloadStarted() -{ - //QLOG_INFO() << "Started skin download for " << m_name << "."; - - emit started(); -} - -void SkinDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) -{ - emit progress(bytesReceived, bytesTotal); -} - -void SkinDownload::downloadSucceeded() -{ - //QLOG_INFO() << "Got skin for " << m_name << ", cropping."; - - emit succeeded(); -} - -void SkinDownload::downloadFailed() -{ - //QLOG_ERROR() << "Failed to download skin for: " << m_name; - - emit failed(); -} diff --git a/logic/net/SkinDownload.h b/logic/net/SkinDownload.h deleted file mode 100644 index 56e5c01d..00000000 --- a/logic/net/SkinDownload.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include "Download.h" -#include "HttpMetaCache.h" -#include "DownloadJob.h" -#include <QFile> -#include <QTemporaryFile> - -class SkinDownload : public QObject -{ - Q_OBJECT - -public: - explicit SkinDownload(QString name); - QString m_name; - QUrl m_url; - MetaEntryPtr m_entry; - DownloadJobPtr m_job; - - void start(); - -protected slots: - void downloadStarted(); - void downloadProgress(qint64 bytesReceived, qint64 bytesTotal); - void downloadSucceeded(); - void downloadFailed(); - -signals: - void started(); - void progress(qint64 current, qint64 total); - void succeeded(); - void failed(); - -protected: - -}; - -typedef std::shared_ptr<SkinDownload> SkinDownloadPtr; |