Ubuntu Download Manager  0.7.0
A session-wide downloading service
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator
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 
52  public:
53  explicit Download(QObject* parent = 0)
54  : QObject(parent) {}
55 
69  virtual void start() = 0;
70 
77  virtual void pause() = 0;
78 
86  virtual void resume() = 0;
87 
94  virtual void cancel() = 0;
95 
105  virtual void allowMobileDownload(bool allowed) = 0;
106 
113  virtual bool isMobileDownloadAllowed() = 0;
114 
122  virtual void setDestinationDir(const QString& path) = 0;
123 
132  virtual void setHeaders(QMap<QString, QString> headers) = 0;
133 
141  virtual QMap<QString, QString> headers() = 0;
142 
150  virtual void setThrottle(qulonglong speed) = 0;
151 
158  virtual qulonglong throttle() = 0;
159 
166  virtual QString id() const = 0;
167 
174  virtual QVariantMap metadata() = 0;
175 
181  virtual qulonglong progress() = 0;
182 
190  virtual qulonglong totalSize() = 0;
191 
197  virtual bool isError() const = 0;
198 
204  virtual Error* error() const = 0;
205 
206  signals:
207 
214  void canceled(bool success);
215 
224  void error(Error* error);
225 
233  void finished(const QString& path);
234 
241  void paused(bool success);
242 
249  void processing(const QString &path);
250 
265  void progress(qulonglong received, qulonglong total);
266 
273  void resumed(bool success);
274 
281  void started(bool success);
282 
283 };
284 
285 } // Ubuntu
286 
287 } // DownloadManager
288 
289 #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
void finished(const QString &path)
virtual void setDestinationDir(const QString &path)=0
virtual bool isError() const =0
virtual QMap< QString, QString > headers()=0
virtual void setThrottle(qulonglong speed)=0
Download(QObject *parent=0)
Definition: download.h:53
virtual QVariantMap metadata()=0
The Download class allows to control a download that was created in the download manager.
Definition: download.h:49
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