Ubuntu Download Manager  0.9.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)
53  Q_PROPERTY(QString Title READ title NOTIFY titleChanged)
54 
55  public:
56  explicit Download(QObject* parent = 0)
57  : QObject(parent) {}
58 
72  virtual void start() = 0;
73 
80  virtual void pause() = 0;
81 
89  virtual void resume() = 0;
90 
97  virtual void cancel() = 0;
98 
108  virtual void allowMobileDownload(bool allowed) = 0;
109 
116  virtual bool isMobileDownloadAllowed() = 0;
117 
125  virtual void setDestinationDir(const QString& path) = 0;
126 
135  virtual void setHeaders(QMap<QString, QString> headers) = 0;
136 
143  virtual void setMetadata(QVariantMap map) = 0;
144 
152  virtual QMap<QString, QString> headers() = 0;
153 
161  virtual void setThrottle(qulonglong speed) = 0;
162 
169  virtual qulonglong throttle() = 0;
170 
177  virtual QString id() const = 0;
178 
185  virtual QVariantMap metadata() = 0;
186 
192  virtual qulonglong progress() = 0;
193 
201  virtual qulonglong totalSize() = 0;
202 
208  virtual bool isError() const = 0;
209 
215  virtual Error* error() const = 0;
216 
225  virtual QString clickPackage() const = 0;
226 
235  virtual bool showInIndicator() const = 0;
236 
245  virtual QString title() const = 0;
246 
247  signals:
248 
255  void canceled(bool success);
256 
265  void error(Error* error);
266 
274  void finished(const QString& path);
275 
282  void paused(bool success);
283 
290  void processing(const QString &path);
291 
306  void progress(qulonglong received, qulonglong total);
307 
314  void resumed(bool success);
315 
322  void started(bool success);
323 
330  void clickPackagedChanged();
331 
338  void showInIndicatorChanged();
339 
340 
347  void titleChanged();
348 
349 };
350 
351 } // Ubuntu
352 
353 } // DownloadManager
354 
355 #endif // UBUNTU_DOWNLOADMANAGER_CLIENT_DOWNLOAD_H
The Error class is the base class that represents an error in the download manager API...
Definition: error.h:55
virtual void setMetadata(QVariantMap map)=0
void finished(const QString &path)
virtual void setDestinationDir(const QString &path)=0
virtual bool showInIndicator() const =0
virtual bool isError() const =0
virtual QString clickPackage() const =0
virtual QMap< QString, QString > headers()=0
virtual void setThrottle(qulonglong speed)=0
virtual QVariantMap metadata()=0
The Download class allows to control a download that was created in the download manager.
Definition: download.h:49
virtual QString title() const =0
virtual qulonglong totalSize()=0
virtual void setHeaders(QMap< QString, QString > headers)=0
virtual QString id() const =0
void processing(const QString &path)
virtual Error * error() const =0
virtual bool isMobileDownloadAllowed()=0
virtual qulonglong throttle()=0
virtual void allowMobileDownload(bool allowed)=0
virtual qulonglong progress()=0