#include <albert/download.h>
Inherits QObject.
Downloads a file from the given URL to the given path.
Does not check if the file exists. The download will fail to save the file in this case.
|
| Download (const QUrl &url, const QString &path, QObject *parent=nullptr) |
| Constructs a download with the given url and path. Threadsafe.
|
|
| ~Download () |
|
const QUrl & | url () |
| Returns the url of the download. Threadsafe.
|
|
const QString & | path () |
| Returns the destination path of the download. Threadsafe.
|
|
bool | isActive () |
| Returns true if the download is active. Threadsafe.
|
|
const QString & | error () |
| Returns the error of the download, if any. Threadsafe.
|
|
void | start () |
| Starts the download.
|
|
|
static std::shared_ptr< Download > | unique (const QUrl &url, const QString &path) |
| Returns a unique download for url and path.
|
|
◆ Download()
albert::util::Download::Download |
( |
const QUrl & |
url, |
|
|
const QString & |
path, |
|
|
QObject * |
parent = nullptr |
|
) |
| |
Constructs a download with the given url and path. Threadsafe.
◆ ~Download()
albert::util::Download::~Download |
( |
| ) |
|
◆ error()
const QString & albert::util::Download::error |
( |
| ) |
|
Returns the error of the download, if any. Threadsafe.
◆ finished
void albert::util::Download::finished |
( |
| ) |
|
|
signal |
◆ isActive()
bool albert::util::Download::isActive |
( |
| ) |
|
Returns true if the download is active. Threadsafe.
◆ path()
const QString & albert::util::Download::path |
( |
| ) |
|
Returns the destination path of the download. Threadsafe.
◆ start()
void albert::util::Download::start |
( |
| ) |
|
Starts the download.
The implementation is actually invoked in the thread this download lives in. Do not move the download to another thread after calling this method.
◆ unique()
static std::shared_ptr< Download > albert::util::Download::unique |
( |
const QUrl & |
url, |
|
|
const QString & |
path |
|
) |
| |
|
static |
Returns a unique download for url and path.
If a download for the same URL and path already exists, it is returned. Otherwise a new download is created and returned. The download returned is started and lives in the main thread and Threadsafe.
◆ url()
const QUrl & albert::util::Download::url |
( |
| ) |
|
Returns the url of the download. Threadsafe.
The documentation for this class was generated from the following file: