Lomiri Download Manager 0.1.1
A session-wide downloading service
 
Loading...
Searching...
No Matches
Lomiri::DownloadManager::Download Class Referenceabstract

The Download class allows to control a download that was created in the download manager. More...

#include <download.h>

+ Inheritance diagram for Lomiri::DownloadManager::Download:
+ Collaboration diagram for Lomiri::DownloadManager::Download:

Public Types

enum  State {
  IDLE ,
  START ,
  PAUSE ,
  RESUME ,
  CANCEL ,
  UNCOLLECTED ,
  FINISH ,
  ERROR
}
 

Signals

void canceled (bool success)
 
void error (Error *error)
 
void finished (const QString &path)
 
void paused (bool success)
 
void processing (const QString &path)
 
void progress (qulonglong received, qulonglong total)
 
void resumed (bool success)
 
void started (bool success)
 
void clickPackagedChanged ()
 
void showInIndicatorChanged ()
 
void titleChanged ()
 
void destinationAppChanged ()
 

Public Member Functions

 Download (QObject *parent=0)
 
virtual void start ()=0
 
virtual void pause ()=0
 
virtual void resume ()=0
 
virtual void cancel ()=0
 
virtual void collected ()=0
 
virtual void allowMobileDownload (bool allowed)=0
 
virtual bool isMobileDownloadAllowed ()=0
 
virtual void setDestinationDir (const QString &path)=0
 
virtual void setHeaders (QMap< QString, QString > headers)=0
 
virtual void setMetadata (QVariantMap map)=0
 
virtual QMap< QString, QString > headers ()=0
 
virtual void setThrottle (qulonglong speed)=0
 
virtual qulonglong throttle ()=0
 
virtual QString id () const =0
 
virtual QVariantMap metadata ()=0
 
virtual qulonglong progress ()=0
 
virtual qulonglong totalSize ()=0
 
virtual QString filePath ()=0
 
virtual State state ()=0
 
virtual bool isError () const =0
 
virtual Errorerror () const =0
 
virtual QString clickPackage () const =0
 
virtual bool showInIndicator () const =0
 
virtual QString title () const =0
 
virtual QString destinationApp () const =0
 

Properties

QString ClickPackage
 
bool ShowInIndicator
 
QString Title
 
QString DownloadOwner
 

Detailed Description

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.

Member Enumeration Documentation

◆ State

Enumerator
IDLE 
START 
PAUSE 
RESUME 
CANCEL 
UNCOLLECTED 
FINISH 
ERROR 

Definition at line 60 of file download.h.

Constructor & Destructor Documentation

◆ Download()

Lomiri::DownloadManager::Download::Download ( QObject * parent = 0)
inlineexplicit

Definition at line 57 of file download.h.

Member Function Documentation

◆ 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.

Property Documentation

◆ ClickPackage

QString Lomiri::DownloadManager::Download::ClickPackage
read

Definition at line 51 of file download.h.

◆ DownloadOwner

QString Lomiri::DownloadManager::Download::DownloadOwner
read

Definition at line 54 of file download.h.

◆ ShowInIndicator

bool Lomiri::DownloadManager::Download::ShowInIndicator
read

Definition at line 52 of file download.h.

◆ Title

QString Lomiri::DownloadManager::Download::Title
read

Definition at line 53 of file download.h.


The documentation for this class was generated from the following file: