diff options
Diffstat (limited to 'src/plugins/geoservices/osm/qgeomapreplyosm.cpp')
-rw-r--r-- | src/plugins/geoservices/osm/qgeomapreplyosm.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/plugins/geoservices/osm/qgeomapreplyosm.cpp b/src/plugins/geoservices/osm/qgeomapreplyosm.cpp index a4a62e7f..052ed351 100644 --- a/src/plugins/geoservices/osm/qgeomapreplyosm.cpp +++ b/src/plugins/geoservices/osm/qgeomapreplyosm.cpp @@ -41,12 +41,16 @@ #include <QtLocation/private/qgeotilespec_p.h> -QGeoMapReplyOsm::QGeoMapReplyOsm(QNetworkReply *reply, const QGeoTileSpec &spec, QObject *parent) +QGeoMapReplyOsm::QGeoMapReplyOsm(QNetworkReply *reply, + const QGeoTileSpec &spec, + const QString &imageFormat, + QObject *parent) : QGeoTiledMapReply(spec, parent), m_reply(reply) { connect(m_reply, SIGNAL(finished()), this, SLOT(networkReplyFinished())); connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(networkReplyError(QNetworkReply::NetworkError))); + setMapImageFormat(imageFormat); } QGeoMapReplyOsm::~QGeoMapReplyOsm() @@ -75,18 +79,15 @@ void QGeoMapReplyOsm::networkReplyFinished() if (!m_reply) return; - if (m_reply->error() != QNetworkReply::NoError) + if (m_reply->error() != QNetworkReply::NoError) { + m_reply->deleteLater(); + m_reply = 0; return; + } QByteArray a = m_reply->readAll(); setMapImageData(a); - int mapId = tileSpec().mapId(); - if (mapId == 1 || mapId == 2) - setMapImageFormat(QStringLiteral("jpg")); - else - setMapImageFormat(QStringLiteral("png")); - setFinished(true); m_reply->deleteLater(); |