mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-06-27 03:29:16 +02:00
Added support for downloading DEM tiles
This commit is contained in:
@ -77,7 +77,7 @@ QNetworkAccessManager *Downloader::_manager = 0;
|
||||
int Downloader::_timeout = 30;
|
||||
bool Downloader::_http2 = true;
|
||||
|
||||
bool Downloader::doDownload(const Download &dl, const QByteArray &authorization)
|
||||
bool Downloader::doDownload(const Download &dl, const Authorization &auth)
|
||||
{
|
||||
const QUrl &url = dl.url();
|
||||
|
||||
@ -98,8 +98,8 @@ bool Downloader::doDownload(const Download &dl, const QByteArray &authorization)
|
||||
QNetworkRequest::NoLessSafeRedirectPolicy);
|
||||
request.setAttribute(ATTR_HTTP2_ALLOWED, QVariant(_http2));
|
||||
request.setRawHeader("User-Agent", USER_AGENT);
|
||||
if (!authorization.isNull())
|
||||
request.setRawHeader("Authorization", authorization);
|
||||
if (!auth.isNull())
|
||||
request.setRawHeader("Authorization", auth.header());
|
||||
|
||||
QFile *file = new QFile(tmpName(dl.file()));
|
||||
if (!file->open(QIODevice::WriteOnly)) {
|
||||
@ -182,7 +182,7 @@ bool Downloader::get(const QList<Download> &list,
|
||||
bool finishEmitted = false;
|
||||
|
||||
for (int i = 0; i < list.count(); i++)
|
||||
finishEmitted |= doDownload(list.at(i), authorization.header());
|
||||
finishEmitted |= doDownload(list.at(i), authorization);
|
||||
|
||||
return finishEmitted;
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ public:
|
||||
Authorization() {}
|
||||
Authorization(const QString &username, const QString &password);
|
||||
|
||||
bool isNull() const {return _header.isNull();}
|
||||
const QByteArray &header() const {return _header;}
|
||||
|
||||
private:
|
||||
@ -79,7 +80,7 @@ private:
|
||||
class ReplyTimeout;
|
||||
|
||||
void insertError(const QUrl &url, QNetworkReply::NetworkError error);
|
||||
bool doDownload(const Download &dl, const QByteArray &authorization);
|
||||
bool doDownload(const Download &dl, const Authorization &auth);
|
||||
void downloadFinished(QNetworkReply *reply);
|
||||
void readData(QNetworkReply *reply);
|
||||
|
||||
|
Reference in New Issue
Block a user