LeechCraft
0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Toggle main menu visibility
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
16
template
<
typename
>
17
class
QFuture
;
18
19
struct
EntityTestHandleResult
;
20
42
class
Q_DECL_EXPORT
IDownload
43
{
44
public
:
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
74
using
Result
=
LC::Util::Either<Error, Success>
;
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
133
Q_DECLARE_INTERFACE (
IDownload
,
"org.Deviant.LeechCraft.IDownload/1.0"
)
134
135
Q_DECLARE_METATYPE
(
QList
<QUrl>)
IDownload
Common interface for all the downloaders.
Definition
idownload.h:43
IDownload::Result
LC::Util::Either< Error, Success > Result
Definition
idownload.h:74
IDownload::AddJob
virtual QFuture< Result > AddJob(LC::Entity entity)=0
Adds the job with given parameters.
IDownload::~IDownload
virtual ~IDownload()
Virtual destructor.
Definition
idownload.h:130
IDownload::GetUploadSpeed
virtual qint64 GetUploadSpeed() const =0
Returns upload speed.
IDownload::CouldDownload
virtual EntityTestHandleResult CouldDownload(const LC::Entity &entity) const =0
Returns whether plugin can handle given entity.
IDownload::GetDownloadSpeed
virtual qint64 GetDownloadSpeed() const =0
Returns download speed.
LC::Util::Either
Definition
either.h:33
QFuture
Definition
idownload.h:17
QList
Definition
ianrulesstorage.h:14
operator==
auto operator==(const T &left, const T &right)
Definition
common.h:21
eitherfwd.h
EntityTestHandleResult
The result of testing whether an entity could be handled by a plugin.
Definition
entitytesthandleresult.h:26
IDownload::Error
Definition
idownload.h:46
IDownload::Error::Type
Type
Definition
idownload.h:48
IDownload::Error::Type_
enum IDownload::Error::Type Type_
IDownload::Error::Message_
QString Message_
Definition
idownload.h:64
IDownload::Success
Definition
idownload.h:72
LC::Entity
A message used for inter-plugin communication.
Definition
structures.h:97
structures.h
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QVariantList *)
src
interfaces
idownload.h
Generated by
1.17.0