libosmscout
0.1
|
Downloads a file specified by URL. More...
#include <FileDownloader.h>
Public Slots | |
void | startDownload () |
Signals | |
void | downloadedBytes (uint64_t sz) |
void | error (QString error_text, bool recoverable) |
void | finished (QString path) |
void | writtenBytes (uint64_t sz) |
Public Member Functions | |
FileDownloader (QNetworkAccessManager *manager, QString url, QString path, QObject *parent=nullptr) | |
uint64_t | getBytesDownloaded () const |
QString | getFileName () const |
QString | getFilePath () const |
operator bool () const | |
~FileDownloader () override | |
Protected Slots | |
void | onDownloaded () |
void | onNetworkError (QNetworkReply::NetworkError code) |
void | onNetworkReadyRead () |
void | onTimeout () |
Protected Member Functions | |
void | onError (const QString &err) |
void | onFinished () |
bool | restartDownload () |
Restart download if download retries are not used up. More... | |
Downloads a file specified by URL.
Downloads a file as specified by URL and stores in a given path. If the required directories do not exist, creates all parent directories as needed.
|
explicit |
|
override |
|
signal |
Referenced by onNetworkReadyRead().
|
signal |
Referenced by onError(), onNetworkError(), onNetworkReadyRead(), onTimeout(), osmscout::DownloadJob::start(), and startDownload().
|
signal |
Referenced by onFinished(), and osmscout::DownloadJob::start().
uint64_t osmscout::FileDownloader::getBytesDownloaded | ( | ) | const |
Referenced by osmscout::DownloadJob::onJobFinished().
|
inline |
|
inline |
Referenced by osmscout::DownloadJob::onJobFinished().
|
protectedslot |
References onFinished(), and onNetworkReadyRead().
Referenced by startDownload().
|
protected |
References error().
Referenced by onNetworkError(), onNetworkReadyRead(), and onTimeout().
|
protected |
References finished().
Referenced by onDownloaded().
|
protectedslot |
References error(), onError(), and restartDownload().
Referenced by startDownload().
|
protectedslot |
References downloadedBytes(), error(), onError(), and writtenBytes().
Referenced by onDownloaded(), and startDownload().
|
protectedslot |
References error(), onError(), and restartDownload().
Referenced by FileDownloader().
|
inlineexplicit |
|
protected |
Restart download if download retries are not used up.
Referenced by onNetworkError(), and onTimeout().
|
slot |
Default value for "Accept-Encoding" in Qt is "gzip, deflate" and Qt code do the decompressing for us (when server reply with "Content-Encoding: gzip"). But with explicit byte range (content not from the beginning) decompressing is not possible (gzip header is not valid) and Qt fails with NetworkError::ProtocolFailure
For that reason we have to specify that only accepted encoding is identity.
References osmscout::FileDownloaderConfig::BufferNetwork, error(), osmscout::OSMScoutQt::GetInstance(), onDownloaded(), onNetworkError(), and onNetworkReadyRead().
Referenced by FileDownloader().
|
signal |
Referenced by onNetworkReadyRead(), and osmscout::DownloadJob::start().