From 75194bcdabe5167708a8b574b65f69734b3d4f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kubern=C3=A1t?= Date: Mon, 23 Oct 2023 12:07:30 +0200 Subject: [PATCH] OsmTileDownloader: Use logger --- .../src/osmscoutclientqt/OsmTileDownloader.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libosmscout-client-qt/src/osmscoutclientqt/OsmTileDownloader.cpp b/libosmscout-client-qt/src/osmscoutclientqt/OsmTileDownloader.cpp index 54b01eb53..1c4871d33 100644 --- a/libosmscout-client-qt/src/osmscoutclientqt/OsmTileDownloader.cpp +++ b/libosmscout-client-qt/src/osmscoutclientqt/OsmTileDownloader.cpp @@ -17,7 +17,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) /* For compatibility with QT 5.6 */ #include @@ -80,7 +79,7 @@ void OsmTileDownloader::download(uint32_t zoomLevel, uint32_t x, uint32_t y) QString server = QString::fromStdString(servers[serverNumber % servers.size()]); QUrl tileUrl(server.arg(zoomLevel).arg(x).arg(y)); - qDebug() << "Download tile" << tileUrl << "(current thread:" << QThread::currentThread() << ")"; + osmscout::log.Debug() << "Download tile" << tileUrl.toString().toStdString() << "(current thread:" << QThread::currentThread() << ")"; TileCacheKey key = {zoomLevel, x, y}; @@ -103,7 +102,7 @@ void OsmTileDownloader::fileDownloaded(const TileCacheKey &key, QNetworkReply *r QUrl url = reply->url(); if (reply->error() != QNetworkReply::NoError){ - qWarning() << "Downloading" << url << "failed with" << reply->errorString(); + osmscout::log.Warn() << "Downloading" << url.toString().toStdString() << "failed with" << reply->errorString().toStdString(); #if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) /* For compatibility with QT 5.6 */ serverNumber = qrand(); // try another server for future requests #else @@ -115,10 +114,11 @@ void OsmTileDownloader::fileDownloaded(const TileCacheKey &key, QNetworkReply *r QImage image; if (image.loadFromData(downloadedData, Q_NULLPTR)){ - qDebug() << "Downloaded tile " << url << " (current thread: " << QThread::currentThread() << ")"; + osmscout::log.Debug() << "Downloaded tile " << url.toString().toStdString() << " (current thread: " << QThread::currentThread() << ")"; + emit downloaded(key.zoomLevel, key.xtile, key.ytile, image, downloadedData); }else{ - qWarning() << "Failed to load image data from " << url; + osmscout::log.Warn() << "Failed to load image data from " << url.toString().toStdString(); emit failed(key.zoomLevel, key.xtile, key.ytile, false); } }