More clenup
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
385babb458
commit
45c39d078f
@ -28,7 +28,6 @@ namespace Net {
|
||||
auto ApiDownload::makeCached(QUrl url, MetaEntryPtr entry, Options options) -> Download::Ptr
|
||||
{
|
||||
auto dl = makeShared<ApiDownload>();
|
||||
dl->logCat = taskDownloadLogC;
|
||||
dl->m_url = url;
|
||||
dl->setObjectName(QString("CACHE:") + url.toString());
|
||||
dl->m_options = options;
|
||||
@ -41,7 +40,6 @@ auto ApiDownload::makeCached(QUrl url, MetaEntryPtr entry, Options options) -> D
|
||||
auto ApiDownload::makeByteArray(QUrl url, std::shared_ptr<QByteArray> output, Options options) -> Download::Ptr
|
||||
{
|
||||
auto dl = makeShared<ApiDownload>();
|
||||
dl->logCat = taskDownloadLogC;
|
||||
dl->m_url = url;
|
||||
dl->setObjectName(QString("BYTES:") + url.toString());
|
||||
dl->m_options = options;
|
||||
@ -52,7 +50,6 @@ auto ApiDownload::makeByteArray(QUrl url, std::shared_ptr<QByteArray> output, Op
|
||||
auto ApiDownload::makeFile(QUrl url, QString path, Options options) -> Download::Ptr
|
||||
{
|
||||
auto dl = makeShared<ApiDownload>();
|
||||
dl->logCat = taskDownloadLogC;
|
||||
dl->m_url = url;
|
||||
dl->setObjectName(QString("FILE:") + url.toString());
|
||||
dl->m_options = options;
|
||||
|
@ -28,7 +28,6 @@ namespace Net {
|
||||
Upload::Ptr ApiUpload::makeByteArray(QUrl url, std::shared_ptr<QByteArray> output, QByteArray m_post_data)
|
||||
{
|
||||
auto up = makeShared<ApiUpload>();
|
||||
up->logCat = taskUploadLogC;
|
||||
up->m_url = std::move(url);
|
||||
up->m_sink.reset(new ByteArraySink(output));
|
||||
up->m_post_data = std::move(m_post_data);
|
||||
|
@ -47,25 +47,14 @@
|
||||
#include "ChecksumValidator.h"
|
||||
#include "MetaCacheSink.h"
|
||||
|
||||
#if defined(LAUNCHER_APPLICATION)
|
||||
#include "Application.h"
|
||||
#endif
|
||||
|
||||
#include "BuildConfig.h"
|
||||
|
||||
#include "net/Logging.h"
|
||||
#include "net/NetAction.h"
|
||||
|
||||
#include "MMCTime.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
namespace Net {
|
||||
|
||||
#if defined(LAUNCHER_APPLICATION)
|
||||
auto Download::makeCached(QUrl url, MetaEntryPtr entry, Options options) -> Download::Ptr
|
||||
{
|
||||
auto dl = makeShared<Download>();
|
||||
dl->logCat = taskDownloadLogC;
|
||||
dl->m_url = url;
|
||||
dl->setObjectName(QString("CACHE:") + url.toString());
|
||||
dl->m_options = options;
|
||||
@ -79,7 +68,6 @@ auto Download::makeCached(QUrl url, MetaEntryPtr entry, Options options) -> Down
|
||||
auto Download::makeByteArray(QUrl url, std::shared_ptr<QByteArray> output, Options options) -> Download::Ptr
|
||||
{
|
||||
auto dl = makeShared<Download>();
|
||||
dl->logCat = taskDownloadLogC;
|
||||
dl->m_url = url;
|
||||
dl->setObjectName(QString("BYTES:") + url.toString());
|
||||
dl->m_options = options;
|
||||
@ -90,7 +78,6 @@ auto Download::makeByteArray(QUrl url, std::shared_ptr<QByteArray> output, Optio
|
||||
auto Download::makeFile(QUrl url, QString path, Options options) -> Download::Ptr
|
||||
{
|
||||
auto dl = makeShared<Download>();
|
||||
dl->logCat = taskDownloadLogC;
|
||||
dl->m_url = url;
|
||||
dl->setObjectName(QString("FILE:") + url.toString());
|
||||
dl->m_options = options;
|
||||
|
@ -38,12 +38,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#include "HttpMetaCache.h"
|
||||
#include "NetAction.h"
|
||||
#include "Sink.h"
|
||||
#include "Validator.h"
|
||||
|
||||
#include "QObjectPtr.h"
|
||||
#include "net/NetRequest.h"
|
||||
@ -51,12 +46,9 @@
|
||||
namespace Net {
|
||||
class Download : public NetRequest {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
using Ptr = shared_qobject_ptr<class Download>;
|
||||
|
||||
public:
|
||||
~Download() override = default;
|
||||
explicit Download() : NetRequest() { logCat = taskDownloadLogC; };
|
||||
|
||||
#if defined(LAUNCHER_APPLICATION)
|
||||
static auto makeCached(QUrl url, MetaEntryPtr entry, Options options = Option::NoOptions) -> Download::Ptr;
|
||||
@ -65,8 +57,6 @@ class Download : public NetRequest {
|
||||
static auto makeByteArray(QUrl url, std::shared_ptr<QByteArray> output, Options options = Option::NoOptions) -> Download::Ptr;
|
||||
static auto makeFile(QUrl url, QString path, Options options = Option::NoOptions) -> Download::Ptr;
|
||||
|
||||
void init() override{};
|
||||
|
||||
protected:
|
||||
virtual QNetworkReply* getReply(QNetworkRequest&) override;
|
||||
};
|
||||
|
@ -43,17 +43,10 @@
|
||||
#include <QFileInfo>
|
||||
#include <memory>
|
||||
|
||||
#include "ByteArraySink.h"
|
||||
#include "ChecksumValidator.h"
|
||||
#include "MetaCacheSink.h"
|
||||
|
||||
#if defined(LAUNCHER_APPLICATION)
|
||||
#include "Application.h"
|
||||
#endif
|
||||
|
||||
#include "BuildConfig.h"
|
||||
|
||||
#include "net/Logging.h"
|
||||
#include "net/NetAction.h"
|
||||
|
||||
#include "MMCTime.h"
|
||||
@ -70,7 +63,7 @@ void NetRequest::executeTask()
|
||||
{
|
||||
init();
|
||||
|
||||
setStatus(tr("Downloading %1").arg(StringUtils::truncateUrlHumanFriendly(m_url, 80)));
|
||||
setStatus(tr("Requesting %1").arg(StringUtils::truncateUrlHumanFriendly(m_url, 80)));
|
||||
|
||||
if (getState() == Task::State::AbortedByUser) {
|
||||
qCWarning(logCat) << getUid().toString() << "Attempt to start an aborted Request:" << m_url.toString();
|
||||
@ -314,9 +307,7 @@ void NetRequest::downloadReadyRead()
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Net
|
||||
|
||||
auto Net::NetRequest::abort() -> bool
|
||||
auto NetRequest::abort() -> bool
|
||||
{
|
||||
if (m_reply) {
|
||||
m_reply->abort();
|
||||
@ -325,3 +316,5 @@ auto Net::NetRequest::abort() -> bool
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Net
|
||||
|
@ -51,6 +51,8 @@
|
||||
namespace Net {
|
||||
class NetRequest : public NetAction {
|
||||
Q_OBJECT
|
||||
protected:
|
||||
explicit NetRequest() : NetAction(){};
|
||||
|
||||
public:
|
||||
using Ptr = shared_qobject_ptr<class NetRequest>;
|
||||
|
@ -42,8 +42,6 @@
|
||||
#include <utility>
|
||||
#include "ByteArraySink.h"
|
||||
|
||||
#include "net/Logging.h"
|
||||
|
||||
namespace Net {
|
||||
|
||||
QNetworkReply* Upload::getReply(QNetworkRequest& request)
|
||||
@ -55,7 +53,6 @@ QNetworkReply* Upload::getReply(QNetworkRequest& request)
|
||||
Upload::Ptr Upload::makeByteArray(QUrl url, std::shared_ptr<QByteArray> output, QByteArray m_post_data)
|
||||
{
|
||||
auto up = makeShared<Upload>();
|
||||
up->logCat = taskUploadLogC;
|
||||
up->m_url = std::move(url);
|
||||
up->m_sink.reset(new ByteArraySink(output));
|
||||
up->m_post_data = std::move(m_post_data);
|
||||
|
@ -43,9 +43,9 @@ namespace Net {
|
||||
|
||||
class Upload : public NetRequest {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
using Ptr = shared_qobject_ptr<Upload>;
|
||||
explicit Upload() : NetRequest() { logCat = taskUploadLogC; };
|
||||
|
||||
static Upload::Ptr makeByteArray(QUrl url, std::shared_ptr<QByteArray> output, QByteArray m_post_data);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user