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 
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 
131  virtual void setThrottle(qulonglong speed) = 0;
132 
139  virtual qulonglong throttle() = 0;
140 
147  virtual QString id() const = 0;
148 
155  virtual QVariantMap metadata() = 0;
156 
162  virtual qulonglong progress() = 0;
163 
171  virtual qulonglong totalSize() = 0;
172 
178  virtual bool isError() const = 0;
179 
185  virtual Error* error() const = 0;
186 
187  signals:
188 
195  void canceled(bool success);
196 
205  void error(Error* error);
206 
214  void finished(const QString& path);
215 
222  void paused(bool success);
223 
230  void processing(const QString &path);
231 
246  void progress(qulonglong received, qulonglong total);
247 
254  void resumed(bool success);
255 
262  void started(bool success);
263 
264 };
265 
266 } // Ubuntu
267 
268 } // DownloadManager
269 
270 #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 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 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