Ubuntu Download Manager  0.3.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 #include <ubuntu/download_manager/common.h>
26 
27 namespace Ubuntu {
28 
29 namespace DownloadManager {
30 
31 class Error;
32 
50 class Download : public QObject {
51  Q_OBJECT
52 
53  public:
54  explicit Download(QObject* parent = 0)
55  : QObject(parent) {}
56 
70  virtual void start() = 0;
71 
78  virtual void pause() = 0;
79 
87  virtual void resume() = 0;
88 
95  virtual void cancel() = 0;
96 
106  virtual void allowMobileDownload(bool allowed) = 0;
107 
114  virtual bool isMobileDownloadAllowed() = 0;
115 
123  virtual void setDestinationDir(const QString& path) = 0;
124 
132  virtual void setThrottle(qulonglong speed) = 0;
133 
140  virtual qulonglong throttle() = 0;
141 
148  virtual QString id() const = 0;
149 
156  virtual QVariantMap metadata() = 0;
157 
163  virtual qulonglong progress() = 0;
164 
172  virtual qulonglong totalSize() = 0;
173 
179  virtual bool isError() const = 0;
180 
186  virtual Error* error() const = 0;
187 
188  signals:
189 
196  void canceled(bool success);
197 
206  void error(Error* error);
207 
215  void finished(const QString& path);
216 
223  void paused(bool success);
224 
231  void processing(const QString &path);
232 
247  void progress(qulonglong received, qulonglong total);
248 
255  void resumed(bool success);
256 
263  void started(bool success);
264 
265 };
266 
267 } // Ubuntu
268 
269 } // DownloadManager
270 
271 #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:56
void finished(const QString &path)
virtual void setDestinationDir(const QString &path)=0
virtual bool isError() const =0
virtual void setThrottle(qulonglong speed)=0
Download(QObject *parent=0)
Definition: download.h:54
virtual QVariantMap metadata()=0
The Download class allows to control a download that was created in the download manager.
Definition: download.h:50
virtual qulonglong totalSize()=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