|
Albert
|
#include <albert/download.h>
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.
Inherits QObject.
Public Member Functions | |
| Download (const QUrl &url, const QString &path, QObject *parent=nullptr) | |
| Constructs a download with the given url, path and parent. | |
| ~Download () | |
| Destructs this download. | |
| const QUrl & | url () |
| Returns the url of the download. | |
| const QString & | path () |
| Returns the destination path of the download. | |
| bool | isActive () |
| Returns true if the download is active. | |
| const QString & | error () |
| Returns the error of the download, if any. | |
| void | start () |
| Starts the download. | |
Static Public Member Functions | |
| static std::shared_ptr< Download > | unique (const QUrl &url, const QString &path) |
| Returns a unique download for url and path. | |
Signals | |
| void | finished () |
| Emitted when the download has finished. | |
| albert::Download::Download | ( | const QUrl & | url, |
| const QString & | path, | ||
| QObject * | parent = nullptr |
||
| ) |
Constructs a download with the given url, path and parent.
| albert::Download::~Download | ( | ) |
Destructs this download.
| const QString & albert::Download::error | ( | ) |
Returns the error of the download, if any.
This function is thread-safe.
|
signal |
Emitted when the download has finished.
| bool albert::Download::isActive | ( | ) |
Returns true if the download is active.
This function is thread-safe.
| const QString & albert::Download::path | ( | ) |
Returns the destination path of the download.
This function is thread-safe.
| void albert::Download::start | ( | ) |
Starts the download.
Do not move the download to another thread after calling this method.
|
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 created is automatically started and lives in the main thread.
This function is thread-safe.
| const QUrl & albert::Download::url | ( | ) |
Returns the url of the download.
This function is thread-safe.