LeechCraft 0.6.70-14794-g33744ae6ce
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
idownload.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <QUrl>
12#include <QtPlugin>
13#include <util/sll/eitherfwd.h>
14#include "structures.h"
15
16template<typename>
17class QFuture;
18
20
42class Q_DECL_EXPORT IDownload
43{
44public:
45 struct Error
46 {
47 enum class Type
48 {
49 Unknown,
50 NoError,
51 NotFound,
52 Gone,
53 AccessDenied,
54 AuthRequired,
55 ProtocolError,
56 NetworkError,
57 ContentError,
58 ProxyError,
59 ServerError,
60 LocalError,
61 UserCanceled
62 } Type_;
63
64 QString Message_;
65
66 bool operator== (const Error& other) const
67 {
68 return Type_ == other.Type_ && Message_ == other.Message_;
69 }
70 };
71
72 struct Success {};
73
75
86 virtual qint64 GetDownloadSpeed () const = 0;
97 virtual qint64 GetUploadSpeed () const = 0;
98
114 virtual EntityTestHandleResult CouldDownload (const LC::Entity& entity) const = 0;
115
126 virtual QFuture<Result> AddJob (LC::Entity entity) = 0;
127
130 virtual ~IDownload () {}
131};
132
133Q_DECLARE_INTERFACE (IDownload, "org.Deviant.LeechCraft.IDownload/1.0")
134
Common interface for all the downloaders.
Definition: idownload.h:43
virtual QFuture< Result > AddJob(LC::Entity entity)=0
Adds the job with given parameters.
virtual ~IDownload()
Virtual destructor.
Definition: idownload.h:130
virtual qint64 GetUploadSpeed() const =0
Returns upload speed.
virtual EntityTestHandleResult CouldDownload(const LC::Entity &entity) const =0
Returns whether plugin can handle given entity.
virtual qint64 GetDownloadSpeed() const =0
Returns download speed.
auto operator==(const T &left, const T &right)
Definition: common.h:38
The result of testing whether an entity could be handled by a plugin.
enum IDownload::Error::Type Type_
QString Message_
Definition: idownload.h:64
A message used for inter-plugin communication.
Definition: structures.h:96
Q_DECLARE_METATYPE(QVariantList *)