LeechCraft
0.6.70-13605-g8cd066ad6a
Modular cross-platform feature rich live environment.
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
* Boost Software License - Version 1.0 - August 17th, 2003
6
*
7
* Permission is hereby granted, free of charge, to any person or organization
8
* obtaining a copy of the software and accompanying documentation covered by
9
* this license (the "Software") to use, reproduce, display, distribute,
10
* execute, and transmit the Software, and to prepare derivative works of the
11
* Software, and to permit third-parties to whom the Software is furnished to
12
* do so, all subject to the following:
13
*
14
* The copyright notices in the Software and this entire statement, including
15
* the above license grant, this restriction and the following disclaimer,
16
* must be included in all copies of the Software, in whole or in part, and
17
* all derivative works of the Software, unless such copies or derivative
18
* works are solely in the form of machine-executable object code generated by
19
* a source language processor.
20
*
21
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
* FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
24
* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
25
* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
26
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27
* DEALINGS IN THE SOFTWARE.
28
**********************************************************************/
29
30
#pragma once
31
32
#include <QByteArray>
33
#include <QUrl>
34
#include <QtPlugin>
35
#include <
util/sll/eitherfwd.h
>
36
#include "
structures.h
"
37
38
template
<
typename
>
39
class
QFuture
;
40
41
struct
EntityTestHandleResult
;
42
64
class
Q_DECL_EXPORT
IDownload
65
{
66
public
:
67
struct
Error
68
{
69
enum class
Type
70
{
71
Unknown,
72
NoError,
73
NotFound,
74
Gone,
75
AccessDenied,
76
AuthRequired,
77
ProtocolError,
78
NetworkError,
79
ContentError,
80
ProxyError,
81
ServerError,
82
LocalError,
83
UserCanceled
84
} Type_;
85
86
QString
Message_
;
87
88
bool
operator==
(
const
Error
& other)
const
89
{
90
return
Type_ == other.
Type_
&& Message_ == other.
Message_
;
91
}
92
};
93
94
struct
Success
{};
95
96
using
Result
=
LC::Util::Either<Error, Success>
;
97
108
virtual
qint64 GetDownloadSpeed ()
const
= 0;
119
virtual
qint64 GetUploadSpeed ()
const
= 0;
120
126
virtual
void
StartAll () = 0;
132
virtual
void
StopAll () = 0;
133
149
virtual
EntityTestHandleResult
CouldDownload (
const
LC::Entity
& entity)
const
= 0;
150
161
virtual
QFuture<Result>
AddJob (
LC::Entity
entity) = 0;
162
165
virtual
~IDownload
() {}
166
};
167
168
Q_DECLARE_INTERFACE (
IDownload
,
"org.Deviant.LeechCraft.IDownload/1.0"
)
169
170
Q_DECLARE_METATYPE
(
QList
<QUrl>)
QList
Definition:
ianrulesstorage.h:34
IDownload::Error::Type
Type
Definition:
idownload.h:69
IDownload::~IDownload
virtual ~IDownload()
Virtual destructor.
Definition:
idownload.h:165
LC::Util::Either
Definition:
either.h:97
LC::Entity
A message used for inter-plugin communication.
Definition:
structures.h:118
structures.h
IDownload
Common interface for all the downloaders.
Definition:
idownload.h:64
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QVariantList *)
IDownload::Success
Definition:
idownload.h:94
IDownload::Error
Definition:
idownload.h:67
QFuture
Definition:
idownload.h:39
operator==
auto operator==(const T &left, const T &right)
Definition:
common.h:58
EntityTestHandleResult
The result of testing whether an entity could be handled by a plugin.
Definition:
entitytesthandleresult.h:46
IDownload::Error::Type_
enum IDownload::Error::Type Type_
IDownload::Error::Message_
QString Message_
Definition:
idownload.h:86
eitherfwd.h
src
interfaces
idownload.h
Generated by
1.8.16