summaryrefslogtreecommitdiffstats
path: root/logic/net
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-01-31 16:59:03 +0100
committerPetr Mrázek <peterix@gmail.com>2015-04-02 11:30:24 +0200
commit6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f (patch)
tree28aaf76918d1ff0ffe2a437573bb1ab7a012c4ec /logic/net
parente508728246043fcaf8bee565e73b15e15eb2e531 (diff)
downloadMultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.tar
MultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.tar.gz
MultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.tar.lz
MultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.tar.xz
MultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.zip
NOISSUE Split MultiMC app object into MultiMC and Env
Diffstat (limited to 'logic/net')
-rw-r--r--logic/net/ByteArrayDownload.cpp4
-rw-r--r--logic/net/CacheDownload.cpp6
-rw-r--r--logic/net/HttpMetaCache.cpp5
-rw-r--r--logic/net/HttpMetaCache.h3
-rw-r--r--logic/net/MD5EtagDownload.cpp4
-rw-r--r--logic/net/PasteUpload.cpp4
6 files changed, 15 insertions, 11 deletions
diff --git a/logic/net/ByteArrayDownload.cpp b/logic/net/ByteArrayDownload.cpp
index 00254caa..e56ac9b6 100644
--- a/logic/net/ByteArrayDownload.cpp
+++ b/logic/net/ByteArrayDownload.cpp
@@ -14,7 +14,7 @@
*/
#include "ByteArrayDownload.h"
-#include "MultiMC.h"
+#include "logic/Env.h"
#include "logger/QsLog.h"
ByteArrayDownload::ByteArrayDownload(QUrl url) : NetAction()
@@ -28,7 +28,7 @@ void ByteArrayDownload::start()
QLOG_INFO() << "Downloading " << m_url.toString();
QNetworkRequest request(m_url);
request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)");
- auto worker = MMC->qnam();
+ auto worker = ENV.qnam();
QNetworkReply *rep = worker->get(request);
m_reply = std::shared_ptr<QNetworkReply>(rep);
diff --git a/logic/net/CacheDownload.cpp b/logic/net/CacheDownload.cpp
index 95278b0d..1bf59c60 100644
--- a/logic/net/CacheDownload.cpp
+++ b/logic/net/CacheDownload.cpp
@@ -13,7 +13,6 @@
* limitations under the License.
*/
-#include "MultiMC.h"
#include "CacheDownload.h"
#include <pathutils.h>
@@ -21,6 +20,7 @@
#include <QFileInfo>
#include <QDateTime>
#include "logger/QsLog.h"
+#include "logic/Env.h"
CacheDownload::CacheDownload(QUrl url, MetaEntryPtr entry)
: NetAction(), md5sum(QCryptographicHash::Md5)
@@ -74,7 +74,7 @@ void CacheDownload::start()
request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Cached)");
- auto worker = MMC->qnam();
+ auto worker = ENV.qnam();
QNetworkReply *rep = worker->get(request);
m_reply = std::shared_ptr<QNetworkReply>(rep);
@@ -168,7 +168,7 @@ void CacheDownload::downloadFinished()
m_entry->local_changed_timestamp =
output_file_info.lastModified().toUTC().toMSecsSinceEpoch();
m_entry->stale = false;
- MMC->metacache()->updateEntry(m_entry);
+ ENV.metacache()->updateEntry(m_entry);
m_reply.reset();
emit succeeded(m_index_within_job);
diff --git a/logic/net/HttpMetaCache.cpp b/logic/net/HttpMetaCache.cpp
index 4533a736..eb931b8a 100644
--- a/logic/net/HttpMetaCache.cpp
+++ b/logic/net/HttpMetaCache.cpp
@@ -13,7 +13,7 @@
* limitations under the License.
*/
-#include "MultiMC.h"
+#include "logic/Env.h"
#include "HttpMetaCache.h"
#include <pathutils.h>
@@ -32,7 +32,8 @@
QString MetaEntry::getFullPath()
{
- return PathCombine(MMC->metacache()->getBasePath(base), path);
+ // FIXME: make local?
+ return PathCombine(ENV.metacache()->getBasePath(base), path);
}
HttpMetaCache::HttpMetaCache(QString path) : QObject()
diff --git a/logic/net/HttpMetaCache.h b/logic/net/HttpMetaCache.h
index dd44623c..042f66bf 100644
--- a/logic/net/HttpMetaCache.h
+++ b/logic/net/HttpMetaCache.h
@@ -17,6 +17,9 @@
#include <QString>
#include <QMap>
#include <qtimer.h>
+#include <memory>
+
+class HttpMetaCache;
struct MetaEntry
{
diff --git a/logic/net/MD5EtagDownload.cpp b/logic/net/MD5EtagDownload.cpp
index c1d7f7a8..79038f36 100644
--- a/logic/net/MD5EtagDownload.cpp
+++ b/logic/net/MD5EtagDownload.cpp
@@ -13,7 +13,7 @@
* limitations under the License.
*/
-#include "MultiMC.h"
+#include "logic/Env.h"
#include "MD5EtagDownload.h"
#include <pathutils.h>
#include <QCryptographicHash>
@@ -83,7 +83,7 @@ void MD5EtagDownload::start()
return;
}
- auto worker = MMC->qnam();
+ auto worker = ENV.qnam();
QNetworkReply *rep = worker->get(request);
m_reply = std::shared_ptr<QNetworkReply>(rep);
diff --git a/logic/net/PasteUpload.cpp b/logic/net/PasteUpload.cpp
index c7bde06e..f68595c9 100644
--- a/logic/net/PasteUpload.cpp
+++ b/logic/net/PasteUpload.cpp
@@ -1,5 +1,5 @@
#include "PasteUpload.h"
-#include "MultiMC.h"
+#include "logic/Env.h"
#include "logger/QsLog.h"
#include <QJsonObject>
#include <QJsonDocument>
@@ -25,7 +25,7 @@ void PasteUpload::executeTask()
request.setRawHeader("Content-Type", "application/x-www-form-urlencoded");
request.setRawHeader("Content-Length", QByteArray::number(content.size()));
- auto worker = MMC->qnam();
+ auto worker = ENV.qnam();
QNetworkReply *rep = worker->post(request, content);
m_reply = std::shared_ptr<QNetworkReply>(rep);