libosmscout  0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules
osmscout::DownloadJob Class Referenceabstract

Class that provide abstraction for download job of multiple files in sequence. More...

#include <FileDownloader.h>

+ Inheritance diagram for osmscout::DownloadJob:

Public Slots

void downloadNextFile ()
 
void onDownloadProgress (uint64_t)
 
void onJobFailed (QString errorMessage, bool recoverable)
 
void onJobFinished (QString path)
 

Signals

void canceled ()
 
void downloadProgress ()
 
void failed (QString error)
 
void finished ()
 

Public Member Functions

void cancel ()
 Cancel downloading, remove temporary files (of unfinished jobs), emit canceled signal. More...
 
 DownloadJob (const DownloadJob &)=delete
 
 DownloadJob (DownloadJob &&)=delete
 
 DownloadJob (QNetworkAccessManager *webCtrl, QDir target, bool replaceExisting)
 
virtual uint64_t expectedSize () const =0
 
QDir getDestinationDirectory () const
 
QString getDownloadingFile ()
 
QString getError () const
 
double getProgress ()
 
bool isDone () const
 
bool isDownloading () const
 
bool isReplaceExisting () const
 
bool isSuccessful () const
 
DownloadJoboperator= (const DownloadJob &)=delete
 
DownloadJoboperator== (const DownloadJob &&)=delete
 
void start (const QString &serverBasePath, const QStringList &files)
 
 ~DownloadJob () override
 

Protected Member Functions

void clearJobs ()
 Clear all file download jobs, it removes temporary *.download files. More...
 

Protected Attributes

bool canceledByUser {false}
 
bool done {false}
 
uint64_t downloadedBytes {0}
 
QString error
 
QList< FileDownloader * > jobs
 
bool replaceExisting
 
bool started {false}
 
bool successful {false}
 
QDir target
 
QNetworkAccessManager * webCtrl
 

Detailed Description

Class that provide abstraction for download job of multiple files in sequence.

Constructor & Destructor Documentation

◆ DownloadJob() [1/3]

osmscout::DownloadJob::DownloadJob ( QNetworkAccessManager *  webCtrl,
QDir  target,
bool  replaceExisting 
)

References webCtrl.

◆ ~DownloadJob()

osmscout::DownloadJob::~DownloadJob ( )
override

References clearJobs().

◆ DownloadJob() [2/3]

osmscout::DownloadJob::DownloadJob ( const DownloadJob )
delete

◆ DownloadJob() [3/3]

osmscout::DownloadJob::DownloadJob ( DownloadJob &&  )
delete

Member Function Documentation

◆ cancel()

void osmscout::DownloadJob::cancel ( )

Cancel downloading, remove temporary files (of unfinished jobs), emit canceled signal.

Already downloaded files are retained on disk (this behaviour may be modified by subclass).

References canceledByUser, done, and onJobFailed().

◆ canceled

void osmscout::DownloadJob::canceled ( )
signal

◆ clearJobs()

void osmscout::DownloadJob::clearJobs ( )
protected

Clear all file download jobs, it removes temporary *.download files.

References jobs.

Referenced by onJobFailed(), ~DownloadJob(), and osmscout::MapDownloadJob::~MapDownloadJob().

◆ downloadNextFile

void osmscout::DownloadJob::downloadNextFile ( )
slot

References done, downloadProgress(), finished(), jobs, and successful.

Referenced by onJobFinished(), and start().

◆ downloadProgress

void osmscout::DownloadJob::downloadProgress ( )
signal

◆ expectedSize()

virtual uint64_t osmscout::DownloadJob::expectedSize ( ) const
pure virtual

◆ failed

◆ finished

void osmscout::DownloadJob::finished ( )
signal

◆ getDestinationDirectory()

QDir osmscout::DownloadJob::getDestinationDirectory ( ) const
inline

◆ getDownloadingFile()

QString osmscout::DownloadJob::getDownloadingFile ( )

References jobs.

◆ getError()

QString osmscout::DownloadJob::getError ( ) const
inline

◆ getProgress()

double osmscout::DownloadJob::getProgress ( )

References downloadedBytes, expectedSize(), and jobs.

◆ isDone()

bool osmscout::DownloadJob::isDone ( ) const
inline

◆ isDownloading()

bool osmscout::DownloadJob::isDownloading ( ) const
inline

◆ isReplaceExisting()

bool osmscout::DownloadJob::isReplaceExisting ( ) const
inline

◆ isSuccessful()

bool osmscout::DownloadJob::isSuccessful ( ) const
inline

◆ onDownloadProgress

void osmscout::DownloadJob::onDownloadProgress ( uint64_t  )
slot

References error.

Referenced by start().

◆ onJobFailed

void osmscout::DownloadJob::onJobFailed ( QString  errorMessage,
bool  recoverable 
)
slot

◆ onJobFinished

void osmscout::DownloadJob::onJobFinished ( QString  path)
slot

◆ operator=()

DownloadJob& osmscout::DownloadJob::operator= ( const DownloadJob )
delete

◆ operator==()

DownloadJob& osmscout::DownloadJob::operator== ( const DownloadJob &&  )
delete

◆ start()

Member Data Documentation

◆ canceledByUser

bool osmscout::DownloadJob::canceledByUser {false}
protected

Referenced by cancel(), and onJobFailed().

◆ done

bool osmscout::DownloadJob::done {false}
protected

◆ downloadedBytes

uint64_t osmscout::DownloadJob::downloadedBytes {0}
protected

Referenced by getProgress(), and onJobFinished().

◆ error

QString osmscout::DownloadJob::error
protected

◆ jobs

QList<FileDownloader*> osmscout::DownloadJob::jobs
protected

◆ replaceExisting

bool osmscout::DownloadJob::replaceExisting
protected

◆ started

◆ successful

bool osmscout::DownloadJob::successful {false}
protected

◆ target

◆ webCtrl

QNetworkAccessManager* osmscout::DownloadJob::webCtrl
protected

Referenced by DownloadJob(), and start().


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