From 1f2968934cba3af2636cd26755560e7ad74fc6f4 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Fri, 6 Jul 2018 19:19:57 +0000 Subject: [PATCH] Remove unused functions in NetworkManager --- src/common/NetworkManager.hpp | 60 ----------------------------------- 1 file changed, 60 deletions(-) diff --git a/src/common/NetworkManager.hpp b/src/common/NetworkManager.hpp index 7e02caf4d..26de96d76 100644 --- a/src/common/NetworkManager.hpp +++ b/src/common/NetworkManager.hpp @@ -25,66 +25,6 @@ public: static void init(); static void deinit(); - template - static void urlFetch(QNetworkRequest request, FinishedCallback onFinished) - { - NetworkRequester requester; - NetworkWorker *worker = new NetworkWorker; - - worker->moveToThread(&NetworkManager::workerThread); - QObject::connect( - &requester, &NetworkRequester::requestUrl, worker, - [ worker, onFinished = std::move(onFinished), request = std::move(request) ]() { - QNetworkReply *reply = NetworkManager::NaM.get(request); - - reply->connect(reply, &QNetworkReply::finished, - [ worker, reply, onFinished = std::move(onFinished) ]() { - onFinished(reply); - delete worker; - }); - }); - - emit requester.requestUrl(); - } - - template - static void urlFetch(const QUrl &url, FinishedCallback onFinished) - { - urlFetch(QNetworkRequest(url), std::move(onFinished)); - } - - template - static void urlFetch(QNetworkRequest request, const QObject *caller, Callback callback, - ReplyCreatedCallback onReplyCreated = [](QNetworkReply *) { return; }) - { - NetworkRequester requester; - NetworkWorker *worker = new NetworkWorker; - - worker->moveToThread(&NetworkManager::workerThread); - - QObject::connect(&requester, &NetworkRequester::requestUrl, worker, [=]() { - QNetworkReply *reply = NetworkManager::NaM.get(request); - - onReplyCreated(reply); - - reply->connect(reply, &QNetworkReply::finished, worker, - [=]() { emit worker->doneUrl(reply); }); - }); - - QObject::connect(worker, &NetworkWorker::doneUrl, caller, [=](QNetworkReply *reply) { - callback(reply); - delete worker; - }); - emit requester.requestUrl(); - } - - template - static void urlFetch(const QUrl &url, const QObject *caller, Callback callback, - ReplyCreatedCallback onReplyCreated = [](QNetworkReply *) { return; }) - { - urlFetch(QNetworkRequest(url), caller, callback, onReplyCreated); - } - template static void urlPut(QNetworkRequest request, FinishedCallback onFinished, QByteArray *data) {