Loading...
Searching...
No Matches
download.h
Go to the documentation of this file.
/*
* Copyright 2013-2014 Canonical Ltd.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of version 3 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef LOMIRI_DOWNLOADMANAGER_CLIENT_DOWNLOAD_H
#define LOMIRI_DOWNLOADMANAGER_CLIENT_DOWNLOAD_H
#include <QObject>
#include <QVariantMap>
#include <QString>
namespace Lomiri {
namespace DownloadManager {
class Error;
class Download : public QObject {
Q_OBJECT
Q_PROPERTY(QString ClickPackage READ clickPackage NOTIFY clickPackagedChanged)
Q_PROPERTY(bool ShowInIndicator READ showInIndicator NOTIFY showInIndicatorChanged)
Q_PROPERTY(QString Title READ title NOTIFY titleChanged)
Q_PROPERTY(QString DownloadOwner READ destinationApp NOTIFY destinationAppChanged)
public:
explicit Download(QObject* parent = 0)
: QObject(parent) {}
enum State {
IDLE,
START,
PAUSE,
RESUME,
CANCEL,
UNCOLLECTED,
FINISH,
ERROR
};
virtual void start() = 0;
virtual void pause() = 0;
virtual void resume() = 0;
virtual void cancel() = 0;
virtual void collected() = 0;
virtual void allowMobileDownload(bool allowed) = 0;
virtual bool isMobileDownloadAllowed() = 0;
virtual void setDestinationDir(const QString& path) = 0;
virtual void setHeaders(QMap<QString, QString> headers) = 0;
virtual void setMetadata(QVariantMap map) = 0;
virtual QMap<QString, QString> headers() = 0;
virtual void setThrottle(qulonglong speed) = 0;
virtual qulonglong throttle() = 0;
virtual QString id() const = 0;
virtual QVariantMap metadata() = 0;
virtual qulonglong progress() = 0;
virtual qulonglong totalSize() = 0;
virtual QString filePath() = 0;
virtual State state() = 0;
virtual bool isError() const = 0;
virtual Error* error() const = 0;
virtual QString clickPackage() const = 0;
virtual bool showInIndicator() const = 0;
virtual QString title() const = 0;
virtual QString destinationApp() const = 0;
Q_SIGNALS:
void canceled(bool success);
void error(Error* error);
void finished(const QString& path);
void paused(bool success);
void processing(const QString &path);
void progress(qulonglong received, qulonglong total);
void resumed(bool success);
void started(bool success);
void clickPackagedChanged();
void showInIndicatorChanged();
void titleChanged();
void destinationAppChanged();
};
} // Lomiri
} // DownloadManager
#endif
Lomiri::DownloadManager::Download::ClickPackage
QString ClickPackage
Definition download.h:51
Lomiri::DownloadManager::Download::destinationApp
virtual QString destinationApp() const =0
Lomiri::DownloadManager::Download::setMetadata
virtual void setMetadata(QVariantMap map)=0
Lomiri::DownloadManager::Download::isMobileDownloadAllowed
virtual bool isMobileDownloadAllowed()=0
Lomiri::DownloadManager::Download::start
virtual void start()=0
Lomiri::DownloadManager::Download::ShowInIndicator
bool ShowInIndicator
Definition download.h:52
Lomiri::DownloadManager::Download::setDestinationDir
virtual void setDestinationDir(const QString &path)=0
Lomiri::DownloadManager::Download::title
virtual QString title() const =0
Lomiri::DownloadManager::Download::collected
virtual void collected()=0
Lomiri::DownloadManager::Download::clickPackagedChanged
void clickPackagedChanged()
Lomiri::DownloadManager::Download::titleChanged
void titleChanged()
Lomiri::DownloadManager::Download::showInIndicator
virtual bool showInIndicator() const =0
Lomiri::DownloadManager::Download::error
void error(Error *error)
Lomiri::DownloadManager::Download::totalSize
virtual qulonglong totalSize()=0
Lomiri::DownloadManager::Download::Title
QString Title
Definition download.h:53
Lomiri::DownloadManager::Download::progress
void progress(qulonglong received, qulonglong total)
Lomiri::DownloadManager::Download::metadata
virtual QVariantMap metadata()=0
Lomiri::DownloadManager::Download::setHeaders
virtual void setHeaders(QMap< QString, QString > headers)=0
Lomiri::DownloadManager::Download::canceled
void canceled(bool success)
Lomiri::DownloadManager::Download::filePath
virtual QString filePath()=0
Lomiri::DownloadManager::Download::destinationAppChanged
void destinationAppChanged()
Lomiri::DownloadManager::Download::showInIndicatorChanged
void showInIndicatorChanged()
Lomiri::DownloadManager::Download::setThrottle
virtual void setThrottle(qulonglong speed)=0
Lomiri::DownloadManager::Download::finished
void finished(const QString &path)
Lomiri::DownloadManager::Download::error
virtual Error * error() const =0
Lomiri::DownloadManager::Download::throttle
virtual qulonglong throttle()=0
Lomiri::DownloadManager::Download::Download
Download(QObject *parent=0)
Definition download.h:57
Lomiri::DownloadManager::Download::DownloadOwner
QString DownloadOwner
Definition download.h:54
Lomiri::DownloadManager::Download::progress
virtual qulonglong progress()=0
Lomiri::DownloadManager::Download::resumed
void resumed(bool success)
Lomiri::DownloadManager::Download::pause
virtual void pause()=0
Lomiri::DownloadManager::Download::state
virtual State state()=0
Lomiri::DownloadManager::Download::clickPackage
virtual QString clickPackage() const =0
Lomiri::DownloadManager::Download::State
State
Definition download.h:60
Lomiri::DownloadManager::Download::PAUSE
@ PAUSE
Definition download.h:63
Lomiri::DownloadManager::Download::UNCOLLECTED
@ UNCOLLECTED
Definition download.h:66
Lomiri::DownloadManager::Download::IDLE
@ IDLE
Definition download.h:61
Lomiri::DownloadManager::Download::ERROR
@ ERROR
Definition download.h:68
Lomiri::DownloadManager::Download::CANCEL
@ CANCEL
Definition download.h:65
Lomiri::DownloadManager::Download::START
@ START
Definition download.h:62
Lomiri::DownloadManager::Download::RESUME
@ RESUME
Definition download.h:64
Lomiri::DownloadManager::Download::FINISH
@ FINISH
Definition download.h:67
Lomiri::DownloadManager::Download::started
void started(bool success)
Lomiri::DownloadManager::Download::processing
void processing(const QString &path)
Lomiri::DownloadManager::Download::resume
virtual void resume()=0
Lomiri::DownloadManager::Download::paused
void paused(bool success)
Lomiri::DownloadManager::Download::isError
virtual bool isError() const =0
Lomiri::DownloadManager::Download::allowMobileDownload
virtual void allowMobileDownload(bool allowed)=0
Lomiri::DownloadManager::Download::cancel
virtual void cancel()=0
Lomiri::DownloadManager::Download::headers
virtual QMap< QString, QString > headers()=0
Lomiri::DownloadManager::Download::id
virtual QString id() const =0
Lomiri::DownloadManager::Error
The Error class is the base class that represents an error in the download manager API.
Definition error.h:55
QObject
Lomiri::DownloadManager
Definition download.h:28
Lomiri
Definition download.h:26