libosmscout 0.1
Loading...
Searching...
No Matches
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.
 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
DownloadJob & operator= (const DownloadJob &)=delete
DownloadJob & operator== (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.

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 )

◆ ~DownloadJob()

osmscout::DownloadJob::~DownloadJob ( )
override

References clearJobs().

◆ DownloadJob() [2/3]

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

References DownloadJob().

◆ DownloadJob() [3/3]

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

References DownloadJob().

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().

Referenced by operator==().

◆ 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

◆ downloadProgress

◆ expectedSize()

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

◆ failed

◆ finished

void osmscout::DownloadJob::finished ( )
signal

◆ getDestinationDirectory()

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

References target.

◆ getDownloadingFile()

QString osmscout::DownloadJob::getDownloadingFile ( )

References jobs.

◆ getError()

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

References error.

◆ getProgress()

double osmscout::DownloadJob::getProgress ( )

References downloadedBytes, expectedSize(), and jobs.

◆ isDone()

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

References done.

◆ isDownloading()

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

References done, and started.

◆ isReplaceExisting()

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

◆ isSuccessful()

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

References successful.

◆ onDownloadProgress

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

References error.

Referenced by downloadProgress(), and 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

References DownloadJob().

◆ operator==()

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

References cancel(), DownloadJob(), and start().

◆ start()

Member Data Documentation

◆ canceledByUser

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

Referenced by cancel(), and onJobFailed().

◆ done

◆ downloadedBytes

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

Referenced by getProgress(), and onJobFinished().

◆ error

◆ jobs

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

◆ replaceExisting

◆ started

◆ successful

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

◆ target

◆ webCtrl

QNetworkAccessManager* osmscout::DownloadJob::webCtrl
protected

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