The Download class allows to control a download that was created in the download manager.
More...
#include <download.h>
The Download class allows to control a download that was created in the download manager.
- Since
- 0.3
The Download class represents a download request that was created to be performed by the download manager.
Due to the asynchronous nature of the API a download request is not performed on the Download object creation but after the client has requested it via the Download::start method.
- Note
- The ownership of the Download is relayed to the caller and therefore the client must call delete or deleteLater whenever it considers to be appropriate.
Definition at line 49 of file download.h.
Enumerator |
---|
IDLE |
|
START |
|
PAUSE |
|
RESUME |
|
CANCEL |
|
UNCOLLECTED |
|
FINISH |
|
ERROR |
|
Definition at line 60 of file download.h.
Ubuntu::DownloadManager::Download::Download |
( |
QObject * |
parent = 0 | ) |
|
|
inlineexplicit |
void Ubuntu::DownloadManager::Download::allowMobileDownload |
( |
bool |
allowed | ) |
|
|
pure virtual |
Notifies the download manager that the download represented by this download object is allowed or not to use the phones mobile data whenever the devices is connected to it. If the download is not allows to use mobile data it will be automatically paused until a valid network connection is present.
void Ubuntu::DownloadManager::Download::cancel |
( |
| ) |
|
|
pure virtual |
Notifies the download manager that the download represented by this download object must be canceled and all it resources must be cleaned.
void Ubuntu::DownloadManager::Download::canceled |
( |
bool |
success | ) |
|
|
signal |
This signal is emitted whenever a download cancellation was requested and notifies if the cancellation was successful or not via success.
QString Ubuntu::DownloadManager::Download::clickPackage |
( |
| ) |
const |
|
pure virtual |
Returns the value of the click package property of the download. The property shows the id of a download that represents a new click application being downloaded. Only unconfined applications are allowed to set this property.
void Ubuntu::DownloadManager::Download::clickPackagedChanged |
( |
| ) |
|
|
signal |
This signal is emitted whenever the click property of a download has been updated.
void Ubuntu::DownloadManager::Download::collected |
( |
| ) |
|
|
pure virtual |
Notifies the download manager that the finished signal for this download object has been received by the client. This allows UDM to report downloads that have finished while a client isn't running.
QString Ubuntu::DownloadManager::Download::destinationApp |
( |
| ) |
const |
|
pure virtual |
Returns the value of the destinationApp property of the download. The owner of the download is the application that created the download in the system.
void Ubuntu::DownloadManager::Download::destinationAppChanged |
( |
| ) |
|
|
signal |
This signal is emitted whenever the download owner property of the download has been updated.
Error * Ubuntu::DownloadManager::Download::error |
( |
| ) |
const |
|
pure virtual |
Returns the last error encountered by the download object.
void Ubuntu::DownloadManager::Download::error |
( |
Error * |
error | ) |
|
|
signal |
This signal is emitted whenever and error occurred during a download. To get more information about the cause of the error the client can check the type of the error via Error::type() and cast error to the appropriate subclass.
QString Ubuntu::DownloadManager::Download::filePath |
( |
| ) |
|
|
pure virtual |
Returns the value of the downloaded file's location. This is only set once the download is complete.
void Ubuntu::DownloadManager::Download::finished |
( |
const QString & |
path | ) |
|
|
signal |
This signal is emitted whenever a download has successfully completed. path is the absolute local file path where the downloaded file can be found.
QMap< QString, QString > Ubuntu::DownloadManager::Download::headers |
( |
| ) |
|
|
pure virtual |
- Since
- 0.4
Returns the headers that have been set to be fwd in the download request.
QString Ubuntu::DownloadManager::Download::id |
( |
| ) |
const |
|
pure virtual |
Returns the unique identifier that represents the download within the download manager.
bool Ubuntu::DownloadManager::Download::isError |
( |
| ) |
const |
|
pure virtual |
Returns if the download represented by the object has had an error.
bool Ubuntu::DownloadManager::Download::isMobileDownloadAllowed |
( |
| ) |
|
|
pure virtual |
Returns if the download represented by this download object is allowed to use the phones mobile data connection.
QVariantMap Ubuntu::DownloadManager::Download::metadata |
( |
| ) |
|
|
pure virtual |
Returns the metadata used upon creation of the download represented by the object.
void Ubuntu::DownloadManager::Download::pause |
( |
| ) |
|
|
pure virtual |
Notifies the download manager that the download represented by this download object must be paused.
void Ubuntu::DownloadManager::Download::paused |
( |
bool |
success | ) |
|
|
signal |
This signal is emitted whenever a download paused was requested and notifies if the pause was successful or not via success.
void Ubuntu::DownloadManager::Download::processing |
( |
const QString & |
path | ) |
|
|
signal |
This signal is emitted whenever a post processing action is being performed on the download file indicated by path.
qulonglong Ubuntu::DownloadManager::Download::progress |
( |
| ) |
|
|
pure virtual |
Returns the size of all the data downloaded so far in bytes.
void Ubuntu::DownloadManager::Download::progress |
( |
qulonglong |
received, |
|
|
qulonglong |
total |
|
) |
| |
|
signal |
This signal is emitted to indicate the progress of the download where received is the number of bytes received and total is the total size of the download.
- Note
- If the download manager is not able to estimate the size of a download, which is something that can happen when the server does not correctly send the size back, received and total will have the same value. The fact that the values are the same DOES NOT mean that a download was completed for that the signals Download::finished(const QString& path) should be used.
void Ubuntu::DownloadManager::Download::resume |
( |
| ) |
|
|
pure virtual |
Notifies the download manager that the download represented by this download object must be resumed. There is no guarantee that nor errors will be raised if a not paused download is resumed.
void Ubuntu::DownloadManager::Download::resumed |
( |
bool |
success | ) |
|
|
signal |
This signal is emitted whenever a download resume was requested and notifies if the resume was successful via success.
void Ubuntu::DownloadManager::Download::setDestinationDir |
( |
const QString & |
path | ) |
|
|
pure virtual |
Notifies the download manager that the local path of the download must be a different one. This call can only be performed if the download was not started else it will result in an error.
void Ubuntu::DownloadManager::Download::setHeaders |
( |
QMap< QString, QString > |
headers | ) |
|
|
pure virtual |
- Since
- 0.4
Allows to set the headers to be used for the download request. If the download has been started the operation will result in an error.
void Ubuntu::DownloadManager::Download::setMetadata |
( |
QVariantMap |
map | ) |
|
|
pure virtual |
- Since
- 0.9
Allows to set the metadata to be used for the download request.
void Ubuntu::DownloadManager::Download::setThrottle |
( |
qulonglong |
speed | ) |
|
|
pure virtual |
Notifies the download manager that the download represented by this download object has its download bandwidth limited to the value provided by speed represented in bytes.
bool Ubuntu::DownloadManager::Download::showInIndicator |
( |
| ) |
const |
|
pure virtual |
Returns the value of the show in indicator property of the download. The property states if the download will be shown in the systems transfer indicator. Confined applications are allowed to set this property to false via the metadata to hide their downloads from being shown in the indicator.
void Ubuntu::DownloadManager::Download::showInIndicatorChanged |
( |
| ) |
|
|
signal |
void Ubuntu::DownloadManager::Download::start |
( |
| ) |
|
|
pure virtual |
Notifies the download manager that the download that is represented by this download object is ready to be downloaded.
The normal use case is that the client of the API connects to all the download signals that he is interested in and the calls the start methods. This pattern ensures that if a download is performed that all signals are connected else the client could see cases in where no signals are received because the download finished before he connected to the signals.
void Ubuntu::DownloadManager::Download::started |
( |
bool |
success | ) |
|
|
signal |
This signal is emitted whenever a download start was requested and notifies if the start action was successful via success.
State Ubuntu::DownloadManager::Download::state |
( |
| ) |
|
|
pure virtual |
Returns the current state of the download.
qulonglong Ubuntu::DownloadManager::Download::throttle |
( |
| ) |
|
|
pure virtual |
Returns the bandwidth limit that was set for the download represented by this object. If the result is 0 is that no limit was set.
QString Ubuntu::DownloadManager::Download::title |
( |
| ) |
const |
|
pure virtual |
Returns the value of the title property of the download. The title of the download is the string that will be shown in the transfer indicator while the download is in progress. Confined applications are allowed to set the properties value via the metadata.
void Ubuntu::DownloadManager::Download::titleChanged |
( |
| ) |
|
|
signal |
This signal is emitted whenever the title property of the download has been updated.
qulonglong Ubuntu::DownloadManager::Download::totalSize |
( |
| ) |
|
|
pure virtual |
Returns the totals size estimated for the download. The result can be 0 when the download manager was not able to deduce the download size due to a wrong configuration of the server.
QString Ubuntu::DownloadManager::Download::ClickPackage |
|
read |
QString Ubuntu::DownloadManager::Download::DownloadOwner |
|
read |
bool Ubuntu::DownloadManager::Download::ShowInIndicator |
|
read |
QString Ubuntu::DownloadManager::Download::Title |
|
read |
The documentation for this class was generated from the following file:
- /build/ubuntu-download-manager-Tenffo/ubuntu-download-manager-1.2+16.04.20160112.2/src/downloads/client/ubuntu/download_manager/download.h