Ubuntu Download Manager: /build/ubuntu-download-manager-git/src/ubuntu-download-manager/src/downloads/client/ubuntu/download_manager/download.h Source File

Ubuntu Download Manager 1.2.0 A session-wide downloading service |

download.h
Go to the documentation of this file.
1 /*
2 * Copyright 2013-2014 Canonical Ltd.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of version 3 of the GNU Lesser General Public
6 * License as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the
15 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301, USA.
17 */
18
19 #ifndef UBUNTU_DOWNLOADMANAGER_CLIENT_DOWNLOAD_H
20 #define UBUNTU_DOWNLOADMANAGER_CLIENT_DOWNLOAD_H
21
22 #include <QObject>
23 #include <QVariantMap>
24 #include <QString>
25
26 namespace Ubuntu {
27
28 namespace DownloadManager {
29
30 class Error;
31
49 class Download : public QObject {
50 Q_OBJECT
51 Q_PROPERTY(QString ClickPackage READ clickPackage NOTIFY clickPackagedChanged)
52 Q_PROPERTY(bool ShowInIndicator READ showInIndicator NOTIFY showInIndicatorChanged)
53 Q_PROPERTY(QString Title READ title NOTIFY titleChanged)
54 Q_PROPERTY(QString DownloadOwner READ destinationApp NOTIFY destinationAppChanged)
55
56 public:
57 explicit Download(QObject* parent = 0)
58 : QObject(parent) {}
59
60 enum State {
61 IDLE,
62 START,
63 PAUSE,
64 RESUME,
65 CANCEL,
66 UNCOLLECTED,
67 FINISH,
68 ERROR
69 };
70
84 virtual void start() = 0;
85
92 virtual void pause() = 0;
93
101 virtual void resume() = 0;
102
109 virtual void cancel() = 0;
110
118 virtual void collected() = 0;
119
129 virtual void allowMobileDownload(bool allowed) = 0;
130
137 virtual bool isMobileDownloadAllowed() = 0;
138
146 virtual void setDestinationDir(const QString& path) = 0;
147
156 virtual void setHeaders(QMap<QString, QString> headers) = 0;
157
164 virtual void setMetadata(QVariantMap map) = 0;
165
173 virtual QMap<QString, QString> headers() = 0;
174
182 virtual void setThrottle(qulonglong speed) = 0;
183
190 virtual qulonglong throttle() = 0;
191
198 virtual QString id() const = 0;
199
206 virtual QVariantMap metadata() = 0;
207
213 virtual qulonglong progress() = 0;
214
222 virtual qulonglong totalSize() = 0;
223
230 virtual QString filePath() = 0;
231
237 virtual State state() = 0;
238
244 virtual bool isError() const = 0;
245
251 virtual Error* error() const = 0;
252
261 virtual QString clickPackage() const = 0;
262
271 virtual bool showInIndicator() const = 0;
272
281 virtual QString title() const = 0;
282
289 virtual QString destinationApp() const = 0;
290
291 signals:
292
299 void canceled(bool success);
300
309 void error(Error* error);
310
318 void finished(const QString& path);
319
326 void paused(bool success);
327
334 void processing(const QString &path);
335
350 void progress(qulonglong received, qulonglong total);
351
358 void resumed(bool success);
359
366 void started(bool success);
367
374 void clickPackagedChanged();
375
382 void showInIndicatorChanged();
383
384
391 void titleChanged();
392
399 void destinationAppChanged();
400
401 };
402
403 } // Ubuntu
404
405 } // DownloadManager
406
407 #endif
Ubuntu::DownloadManager::Download::titleChanged
void titleChanged()
Definition: moc_download.cpp:378
Ubuntu::DownloadManager::Download::finished
void finished(const QString &path)
Definition: moc_download.cpp:324
QObject
Ubuntu::DownloadManager::Download::RESUME
@ RESUME
Definition: download.h:64
Ubuntu::DownloadManager::Download::CANCEL
@ CANCEL
Definition: download.h:65
Ubuntu::DownloadManager::Download::FINISH
@ FINISH
Definition: download.h:67
Ubuntu::DownloadManager::Download
The Download class allows to control a download that was created in the download manager.
Definition: download.h:49
Ubuntu::DownloadManager::Download::ShowInIndicator
bool ShowInIndicator
Definition: download.h:52
Ubuntu::DownloadManager::Download::error
virtual Error * error() const =0
Ubuntu
Definition: download.h:26
Ubuntu::DownloadManager::Download::id
virtual QString id() const =0
Ubuntu::DownloadManager::Download::resumed
void resumed(bool success)
Definition: moc_download.cpp:352
Ubuntu::DownloadManager::Download::metadata
virtual QVariantMap metadata()=0
Ubuntu::DownloadManager::Download::state
virtual State state()=0
Ubuntu::DownloadManager::Download::started
void started(bool success)
Definition: moc_download.cpp:359
Ubuntu::DownloadManager::Download::PAUSE
@ PAUSE
Definition: download.h:63
Ubuntu::DownloadManager::Download::Title
QString Title
Definition: download.h:53
Ubuntu::DownloadManager::Download::progress
virtual qulonglong progress()=0
Ubuntu::DownloadManager::Download::ClickPackage
QString ClickPackage
Definition: download.h:51
Ubuntu::DownloadManager::Download::destinationAppChanged
void destinationAppChanged()
Definition: moc_download.cpp:384
Ubuntu::DownloadManager::Download::cancel
virtual void cancel()=0
Ubuntu::DownloadManager::Download::State
State
Definition: download.h:60
Ubuntu::DownloadManager::Download::isError
virtual bool isError() const =0
Ubuntu::DownloadManager::Download::setDestinationDir
virtual void setDestinationDir(const QString &path)=0
Ubuntu::DownloadManager::Download::title
virtual QString title() const =0
Ubuntu::DownloadManager::Download::canceled
void canceled(bool success)
Definition: moc_download.cpp:310
Ubuntu::DownloadManager::Download::collected
virtual void collected()=0
Ubuntu::DownloadManager::Download::resume
virtual void resume()=0
Ubuntu::DownloadManager::Download::setMetadata
virtual void setMetadata(QVariantMap map)=0
Ubuntu::DownloadManager::Download::paused
void paused(bool success)
Definition: moc_download.cpp:331
Ubuntu::DownloadManager::Download::setHeaders
virtual void setHeaders(QMap< QString, QString > headers)=0
Ubuntu::DownloadManager::Download::UNCOLLECTED
@ UNCOLLECTED
Definition: download.h:66
Ubuntu::DownloadManager::Download::headers
virtual QMap< QString, QString > headers()=0
Ubuntu::DownloadManager::Download::filePath
virtual QString filePath()=0
Ubuntu::DownloadManager::Download::START
@ START
Definition: download.h:62
Ubuntu::DownloadManager::Download::IDLE
@ IDLE
Definition: download.h:61
Ubuntu::DownloadManager::Download::totalSize
virtual qulonglong totalSize()=0
Ubuntu::DownloadManager::Download::Download
Download(QObject *parent=0)
Definition: download.h:57
Ubuntu::DownloadManager::Download::isMobileDownloadAllowed
virtual bool isMobileDownloadAllowed()=0
Ubuntu::DownloadManager::Download::start
virtual void start()=0
Ubuntu::DownloadManager::Download::throttle
virtual qulonglong throttle()=0
Ubuntu::DownloadManager::Download::processing
void processing(const QString &path)
Definition: moc_download.cpp:338
Ubuntu::DownloadManager::Download::setThrottle
virtual void setThrottle(qulonglong speed)=0
Ubuntu::DownloadManager::Download::ERROR
@ ERROR
Definition: download.h:68
Ubuntu::DownloadManager::Error
The Error class is the base class that represents an error in the download manager API.
Definition: error.h:55
Ubuntu::DownloadManager::Download::DownloadOwner
QString DownloadOwner
Definition: download.h:54
Ubuntu::DownloadManager::Download::destinationApp
virtual QString destinationApp() const =0
Ubuntu::DownloadManager::Download::clickPackagedChanged
void clickPackagedChanged()
Definition: moc_download.cpp:366
Ubuntu::DownloadManager::Download::allowMobileDownload
virtual void allowMobileDownload(bool allowed)=0
Ubuntu::DownloadManager::Download::pause
virtual void pause()=0
Ubuntu::DownloadManager::Download::clickPackage
virtual QString clickPackage() const =0
Ubuntu::DownloadManager::Download::showInIndicator
virtual bool showInIndicator() const =0
Ubuntu::DownloadManager::Download::showInIndicatorChanged
void showInIndicatorChanged()
Definition: moc_download.cpp:372