|
libosmscout 0.1
|
Class that provide abstraction for download job of multiple files in sequence. More...
#include <FileDownloader.h>
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 |
Class that provide abstraction for download job of multiple files in sequence.
| osmscout::DownloadJob::DownloadJob | ( | QNetworkAccessManager * | webCtrl, |
| QDir | target, | ||
| bool | replaceExisting ) |
References replaceExisting, target, and webCtrl.
Referenced by DownloadJob(), DownloadJob(), downloadProgress(), osmscout::MapDownloadJob::MapDownloadJob(), operator=(), operator==(), and osmscout::VoiceDownloadJob::VoiceDownloadJob().
|
override |
References clearJobs().
|
delete |
References DownloadJob().
|
delete |
References DownloadJob().
| 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==().
|
signal |
Referenced by osmscout::VoiceManager::download(), osmscout::MapDownloader::downloadMap(), and onJobFailed().
|
protected |
Clear all file download jobs, it removes temporary *.download files.
References jobs.
Referenced by onJobFailed(), ~DownloadJob(), and osmscout::MapDownloadJob::~MapDownloadJob().
|
slot |
References done, downloadProgress(), finished(), jobs, and successful.
Referenced by downloadProgress(), onJobFinished(), and start().
|
signal |
References DownloadJob(), downloadNextFile(), onDownloadProgress(), onJobFailed(), onJobFinished(), replaceExisting, target, and webCtrl.
Referenced by downloadNextFile(), osmscout::MapDownloadsModel::onDownloadJobsChanged(), onJobFailed(), and start().
|
pure virtual |
Implemented in osmscout::MapDownloadJob, and osmscout::VoiceDownloadJob.
Referenced by getProgress().
|
signal |
References error.
Referenced by osmscout::VoiceManager::download(), osmscout::MapDownloader::downloadMap(), onJobFailed(), osmscout::MapDownloadJob::start(), and osmscout::VoiceDownloadJob::start().
|
signal |
Referenced by osmscout::VoiceManager::download(), osmscout::MapDownloader::downloadMap(), and downloadNextFile().
|
inline |
References target.
| QString osmscout::DownloadJob::getDownloadingFile | ( | ) |
References jobs.
|
inline |
References error.
| double osmscout::DownloadJob::getProgress | ( | ) |
References downloadedBytes, expectedSize(), and jobs.
|
inline |
References done.
|
inline |
References replaceExisting.
Referenced by osmscout::VoiceDownloadJob::start().
|
inline |
References successful.
|
slot |
References error.
Referenced by downloadProgress(), and start().
|
slot |
References canceled(), canceledByUser, clearJobs(), done, downloadProgress(), error, failed(), and osmscout::log.
Referenced by cancel(), downloadProgress(), start(), osmscout::MapDownloadJob::start(), and osmscout::VoiceDownloadJob::start().
|
slot |
References downloadedBytes, downloadNextFile(), osmscout::FileDownloader::getBytesDownloaded(), osmscout::FileDownloader::getFilePath(), and jobs.
Referenced by downloadProgress(), and start().
|
delete |
References DownloadJob().
|
delete |
References cancel(), DownloadJob(), and start().
| void osmscout::DownloadJob::start | ( | const QString & | serverBasePath, |
| const QStringList & | files ) |
References downloadNextFile(), downloadProgress(), osmscout::FileDownloader::error(), osmscout::FileDownloader::finished(), jobs, onDownloadProgress(), onJobFailed(), onJobFinished(), started, target, webCtrl, and osmscout::FileDownloader::writtenBytes().
Referenced by operator==(), osmscout::MapDownloadJob::start(), and osmscout::VoiceDownloadJob::start().
|
protected |
Referenced by cancel(), and onJobFailed().
|
protected |
|
protected |
Referenced by getProgress(), and onJobFinished().
|
protected |
|
protected |
Referenced by clearJobs(), downloadNextFile(), getDownloadingFile(), getProgress(), onJobFinished(), and start().
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by DownloadJob(), downloadProgress(), getDestinationDirectory(), osmscout::MapDownloadJob::MapDownloadJob(), start(), osmscout::MapDownloadJob::start(), osmscout::VoiceDownloadJob::start(), osmscout::VoiceDownloadJob::VoiceDownloadJob(), osmscout::MapDownloadJob::~MapDownloadJob(), and osmscout::VoiceDownloadJob::~VoiceDownloadJob().
|
protected |