Loading...
Searching...
No Matches
manager.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_MANAGER_H
#define LOMIRI_DOWNLOADMANAGER_CLIENT_MANAGER_H
#include <functional>
#include <QObject>
#include <lomiri/download_manager/metatypes.h>
#include <lomiri/download_manager/download_struct.h>
#include <lomiri/download_manager/group_download_struct.h>
namespace Lomiri {
namespace DownloadManager {
class Download;
class DownloadsList;
class Error;
class GroupDownload;
typedef std::function<void(Download*)> DownloadCb;
typedef std::function<void(DownloadsList*)> DownloadsListCb;
typedef std::function<void(const QString&, const QString&, DownloadsList*)> MetadataDownloadsListCb;
typedef std::function<void(GroupDownload*)> GroupCb;
class Manager : public QObject {
Q_OBJECT
public:
explicit Manager(QObject* parent = 0)
: QObject(parent) {}
virtual Download* getDownloadForId(const QString& id) = 0;
virtual void createDownload(DownloadStruct downStruct) = 0;
virtual void createDownload(DownloadStruct downStruct,
DownloadCb cb,
DownloadCb errCb) = 0;
virtual void createDownload(StructList downs,
const QString& algorithm,
bool allowed3G,
const QVariantMap& metadata,
StringMap headers) = 0;
virtual void createDownload(StructList downs,
const QString& algorithm,
bool allowed3G,
const QVariantMap& metadata,
StringMap headers,
GroupCb cb,
GroupCb errCb) = 0;
virtual void getAllDownloads(const QString& appId, bool uncollected) = 0;
virtual void getAllDownloads(const QString& appId,
bool uncollected,
DownloadsListCb cb,
DownloadsListCb errCb) = 0;
virtual void getAllDownloadsWithMetadata(const QString &name,
const QString &value) = 0;
virtual void getAllDownloadsWithMetadata(const QString &name,
const QString &value,
MetadataDownloadsListCb cb,
MetadataDownloadsListCb errCb) = 0;
virtual bool isError() const = 0;
virtual Error* lastError() const = 0;
virtual void allowMobileDataDownload(bool allowed) = 0;
virtual bool isMobileDataDownload() = 0;
virtual qulonglong defaultThrottle() = 0;
virtual void setDefaultThrottle(qulonglong speed) = 0;
virtual void exit() = 0;
static Manager* createSessionManager(const QString& path = "", QObject* parent=0);
static Manager* createSystemManager(const QString& path = "", QObject* parent=0);
Q_SIGNALS:
void downloadCreated(Download* down);
void downloadsFound(DownloadsList* downloads);
void downloadsWithMetadataFound(const QString& name,
const QString& value,
DownloadsList* downloads);
void groupCreated(GroupDownload* down);
};
} // DownloadManager
} // Lomiri
#endif // LOMIRI_DOWNLOADMANAGER_CLIENT_MANAGER_H
Lomiri::DownloadManager::Download
The Download class allows to control a download that was created in the download manager.
Definition download.h:49
Lomiri::DownloadManager::DownloadsList
Definition downloads_list.h:33
Lomiri::DownloadManager::Error
The Error class is the base class that represents an error in the download manager API.
Definition error.h:55
Lomiri::DownloadManager::GroupDownload
Definition group_download.h:32
Lomiri::DownloadManager::Manager::downloadCreated
void downloadCreated(Download *down)
Lomiri::DownloadManager::Manager::createDownload
virtual void createDownload(StructList downs, const QString &algorithm, bool allowed3G, const QVariantMap &metadata, StringMap headers)=0
Lomiri::DownloadManager::Manager::getAllDownloads
virtual void getAllDownloads(const QString &appId, bool uncollected, DownloadsListCb cb, DownloadsListCb errCb)=0
Lomiri::DownloadManager::Manager::allowMobileDataDownload
virtual void allowMobileDataDownload(bool allowed)=0
Lomiri::DownloadManager::Manager::createSessionManager
static Manager * createSessionManager(const QString &path="", QObject *parent=0)
Definition manager.cpp:31
Lomiri::DownloadManager::Manager::createDownload
virtual void createDownload(StructList downs, const QString &algorithm, bool allowed3G, const QVariantMap &metadata, StringMap headers, GroupCb cb, GroupCb errCb)=0
Lomiri::DownloadManager::Manager::getAllDownloads
virtual void getAllDownloads(const QString &appId, bool uncollected)=0
Lomiri::DownloadManager::Manager::exit
virtual void exit()=0
Lomiri::DownloadManager::Manager::downloadsFound
void downloadsFound(DownloadsList *downloads)
Lomiri::DownloadManager::Manager::getDownloadForId
virtual Download * getDownloadForId(const QString &id)=0
Lomiri::DownloadManager::Manager::createDownload
virtual void createDownload(DownloadStruct downStruct, DownloadCb cb, DownloadCb errCb)=0
Lomiri::DownloadManager::Manager::isMobileDataDownload
virtual bool isMobileDataDownload()=0
Lomiri::DownloadManager::Manager::setDefaultThrottle
virtual void setDefaultThrottle(qulonglong speed)=0
Lomiri::DownloadManager::Manager::createDownload
virtual void createDownload(DownloadStruct downStruct)=0
Lomiri::DownloadManager::Manager::defaultThrottle
virtual qulonglong defaultThrottle()=0
Lomiri::DownloadManager::Manager::Manager
Manager(QObject *parent=0)
Definition manager.h:84
Lomiri::DownloadManager::Manager::getAllDownloadsWithMetadata
virtual void getAllDownloadsWithMetadata(const QString &name, const QString &value)=0
Lomiri::DownloadManager::Manager::groupCreated
void groupCreated(GroupDownload *down)
Lomiri::DownloadManager::Manager::downloadsWithMetadataFound
void downloadsWithMetadataFound(const QString &name, const QString &value, DownloadsList *downloads)
Lomiri::DownloadManager::Manager::lastError
virtual Error * lastError() const =0
Lomiri::DownloadManager::Manager::createSystemManager
static Manager * createSystemManager(const QString &path="", QObject *parent=0)
Definition manager.cpp:40
Lomiri::DownloadManager::Manager::isError
virtual bool isError() const =0
Lomiri::DownloadManager::Manager::getAllDownloadsWithMetadata
virtual void getAllDownloadsWithMetadata(const QString &name, const QString &value, MetadataDownloadsListCb cb, MetadataDownloadsListCb errCb)=0
QObject
Lomiri::DownloadManager
Definition download.h:28
Lomiri::DownloadManager::DownloadsListCb
std::function< void(DownloadsList *)> DownloadsListCb
Definition manager.h:48
Lomiri::DownloadManager::GroupCb
std::function< void(GroupDownload *)> GroupCb
Definition manager.h:60
Lomiri::DownloadManager::MetadataDownloadsListCb
std::function< void(const QString &, const QString &, DownloadsList *)> MetadataDownloadsListCb
Definition manager.h:54
Lomiri::DownloadManager::DownloadCb
std::function< void(Download *)> DownloadCb
Definition manager.h:42
Lomiri
Definition download.h:26