Lomiri Download Manager 0.1.1
A session-wide downloading service
 
Loading...
Searching...
No Matches
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 LOMIRI_DOWNLOADMANAGER_CLIENT_DOWNLOAD_H
20#define LOMIRI_DOWNLOADMANAGER_CLIENT_DOWNLOAD_H
21
22#include <QObject>
23#include <QVariantMap>
24#include <QString>
25
26namespace Lomiri {
27
28namespace DownloadManager {
29
30class Error;
31
49class 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 Q_PROPERTY(QString DownloadOwner READ destinationApp NOTIFY destinationAppChanged)
55
56 public:
57 explicit Download(QObject* parent = 0)
58 : QObject(parent) {}
59
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
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
375
383
384
392
400
401};
402
403} // Lomiri
404
405} // DownloadManager
406
407#endif
The Download class allows to control a download that was created in the download manager.
Definition download.h:49
virtual QMap< QString, QString > headers()=0
virtual bool isError() const =0
virtual QString id() const =0
virtual QString destinationApp() const =0
virtual qulonglong throttle()=0
virtual void setDestinationDir(const QString &path)=0
virtual QVariantMap metadata()=0
void progress(qulonglong received, qulonglong total)
virtual qulonglong totalSize()=0
virtual void allowMobileDownload(bool allowed)=0
void finished(const QString &path)
virtual Error * error() const =0
virtual bool showInIndicator() const =0
virtual bool isMobileDownloadAllowed()=0
void processing(const QString &path)
virtual void setMetadata(QVariantMap map)=0
virtual QString clickPackage() const =0
virtual QString title() const =0
virtual void setThrottle(qulonglong speed)=0
virtual void setHeaders(QMap< QString, QString > headers)=0
virtual qulonglong progress()=0
The Error class is the base class that represents an error in the download manager API.
Definition error.h:55