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.
◆ State
Enumerator |
---|
IDLE | |
START | |
PAUSE | |
RESUME | |
CANCEL | |
UNCOLLECTED | |
FINISH | |
ERROR | |
Definition at line 60 of file download.h.
◆ Download()
Lomiri::DownloadManager::Download::Download |
( |
QObject * | parent = 0 | ) |
|
|
inlineexplicit |
◆ allowMobileDownload()
void Lomiri::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.
◆ cancel()
void Lomiri::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.
◆ canceled
void Lomiri::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.
◆ clickPackage()
QString Lomiri::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.
◆ clickPackagedChanged
void Lomiri::DownloadManager::Download::clickPackagedChanged |
( |
| ) |
|
|
signal |
This signal is emitted whenever the click property of a download has been updated.
◆ collected()
void Lomiri::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 LDM to report downloads that have finished while a client isn't running.
◆ destinationApp()
QString Lomiri::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.
◆ destinationAppChanged
void Lomiri::DownloadManager::Download::destinationAppChanged |
( |
| ) |
|
|
signal |
This signal is emitted whenever the download owner property of the download has been updated.
◆ error() [1/2]
Error * Lomiri::DownloadManager::Download::error |
( |
| ) |
const |
|
pure virtual |
Returns the last error encountered by the download object.
◆ error [2/2]
void Lomiri::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.
◆ filePath()
QString Lomiri::DownloadManager::Download::filePath |
( |
| ) |
|
|
pure virtual |
Returns the value of the downloaded file's location. This is only set once the download is complete.
◆ finished
void Lomiri::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.
◆ headers()
QMap< QString, QString > Lomiri::DownloadManager::Download::headers |
( |
| ) |
|
|
pure virtual |
- Since
- 0.4
Returns the headers that have been set to be fwd in the download request.
◆ id()
QString Lomiri::DownloadManager::Download::id |
( |
| ) |
const |
|
pure virtual |
Returns the unique identifier that represents the download within the download manager.
◆ isError()
bool Lomiri::DownloadManager::Download::isError |
( |
| ) |
const |
|
pure virtual |
Returns if the download represented by the object has had an error.
◆ isMobileDownloadAllowed()
bool Lomiri::DownloadManager::Download::isMobileDownloadAllowed |
( |
| ) |
|
|
pure virtual |
Returns if the download represented by this download object is allowed to use the phones mobile data connection.
◆ metadata()
QVariantMap Lomiri::DownloadManager::Download::metadata |
( |
| ) |
|
|
pure virtual |
Returns the metadata used upon creation of the download represented by the object.
◆ pause()
void Lomiri::DownloadManager::Download::pause |
( |
| ) |
|
|
pure virtual |
Notifies the download manager that the download represented by this download object must be paused.
◆ paused
void Lomiri::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.
◆ processing
void Lomiri::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.
◆ progress() [1/2]
qulonglong Lomiri::DownloadManager::Download::progress |
( |
| ) |
|
|
pure virtual |
Returns the size of all the data downloaded so far in bytes.
◆ progress [2/2]
void Lomiri::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 \tt DOES NOT mean that a download was completed for that the signals Download::finished(const QString& path) should be used.
◆ resume()
void Lomiri::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.
◆ resumed
void Lomiri::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.
◆ setDestinationDir()
void Lomiri::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.
◆ setHeaders()
void Lomiri::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.
◆ setMetadata()
void Lomiri::DownloadManager::Download::setMetadata |
( |
QVariantMap | map | ) |
|
|
pure virtual |
- Since
- 0.9
Allows to set the metadata to be used for the download request.
◆ setThrottle()
void Lomiri::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.
◆ showInIndicator()
bool Lomiri::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.
◆ showInIndicatorChanged
void Lomiri::DownloadManager::Download::showInIndicatorChanged |
( |
| ) |
|
|
signal |
◆ start()
void Lomiri::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.
◆ started
void Lomiri::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()
State Lomiri::DownloadManager::Download::state |
( |
| ) |
|
|
pure virtual |
Returns the current state of the download.
◆ throttle()
qulonglong Lomiri::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.
◆ title()
QString Lomiri::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.
◆ titleChanged
void Lomiri::DownloadManager::Download::titleChanged |
( |
| ) |
|
|
signal |
This signal is emitted whenever the title property of the download has been updated.
◆ totalSize()
qulonglong Lomiri::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.
◆ ClickPackage
QString Lomiri::DownloadManager::Download::ClickPackage |
|
read |
◆ DownloadOwner
QString Lomiri::DownloadManager::Download::DownloadOwner |
|
read |
◆ ShowInIndicator
bool Lomiri::DownloadManager::Download::ShowInIndicator |
|
read |
◆ Title
QString Lomiri::DownloadManager::Download::Title |
|
read |
The documentation for this class was generated from the following file: