diff --git a/src/map/IMG/rastertile.cpp b/src/map/IMG/rastertile.cpp index dd4c5b20..5476f880 100644 --- a/src/map/IMG/rastertile.cpp +++ b/src/map/IMG/rastertile.cpp @@ -445,7 +445,11 @@ void RasterTile::fetchData(QList &polygons, if (dynamic_cast(_data)) { _file = new QFile(_data->fileName()); - _file->open(QIODevice::ReadOnly | QIODevice::Unbuffered); + if (!_file->open(QIODevice::ReadOnly | QIODevice::Unbuffered)) { + qWarning("%s: %s", qPrintable(_file->fileName()), + qPrintable(_file->errorString())); + return; + } } QRectF polyRect(ttl, QPointF(ttl.x() + _rect.width(), ttl.y() diff --git a/src/map/IMG/subfile.h b/src/map/IMG/subfile.h index 8d76396a..762a6ecc 100644 --- a/src/map/IMG/subfile.h +++ b/src/map/IMG/subfile.h @@ -26,7 +26,9 @@ public: if (!_file) { _file = new QFile(subFile->fileName()); - _file->open(QIODevice::ReadOnly | QIODevice::Unbuffered); + if (!_file->open(QIODevice::ReadOnly | QIODevice::Unbuffered)) + qWarning("%s: %s", qPrintable(_file->fileName()), + qPrintable(_file->errorString())); _delete = true; } _data.resize(subFile->blockSize()); diff --git a/src/map/aqmmap.cpp b/src/map/aqmmap.cpp index bc00b658..e2052923 100644 --- a/src/map/aqmmap.cpp +++ b/src/map/aqmmap.cpp @@ -258,7 +258,9 @@ void AQMMap::load(const Projection &in, const Projection &out, Q_UNUSED(out); _mapRatio = hidpi ? deviceRatio : 1.0; - _file.open(QIODevice::ReadOnly); + if (!_file.open(QIODevice::ReadOnly)) + qWarning("%s: %s", qPrintable(_file.fileName()), + qPrintable(_file.errorString())); } void AQMMap::unload() diff --git a/src/map/conversion.cpp b/src/map/conversion.cpp index c09bc643..5e441531 100644 --- a/src/map/conversion.cpp +++ b/src/map/conversion.cpp @@ -141,8 +141,7 @@ bool Conversion::loadList(const QString &path) bool res; if (!file.open(QFile::ReadOnly)) { - qWarning("Error opening projections file: %s: %s", qPrintable(path), - qPrintable(file.errorString())); + qWarning("%s: %s", qPrintable(path), qPrintable(file.errorString())); return false; } diff --git a/src/map/ellipsoid.cpp b/src/map/ellipsoid.cpp index 97c30e4f..b5fa7c77 100644 --- a/src/map/ellipsoid.cpp +++ b/src/map/ellipsoid.cpp @@ -38,8 +38,7 @@ bool Ellipsoid::loadList(const QString &path) bool res; if (!file.open(QFile::ReadOnly)) { - qWarning("Error opening ellipsoids file: %s: %s", qPrintable(path), - qPrintable(file.errorString())); + qWarning("%s: %s", qPrintable(path), qPrintable(file.errorString())); return false; } diff --git a/src/map/gcs.cpp b/src/map/gcs.cpp index 2aef8dcd..6593c4bc 100644 --- a/src/map/gcs.cpp +++ b/src/map/gcs.cpp @@ -102,8 +102,7 @@ bool GCS::loadList(const QString &path) bool res; if (!file.open(QFile::ReadOnly)) { - qWarning("Error opening GCS file: %s: %s", qPrintable(path), - qPrintable(file.errorString())); + qWarning("%s: %s", qPrintable(path), qPrintable(file.errorString())); return false; } diff --git a/src/map/gemfmap.cpp b/src/map/gemfmap.cpp index 91797df3..1ad68d0b 100644 --- a/src/map/gemfmap.cpp +++ b/src/map/gemfmap.cpp @@ -189,7 +189,9 @@ void GEMFMap::load(const Projection &in, const Projection &out, Q_UNUSED(out); _mapRatio = hidpi ? deviceRatio : 1.0; - _file.open(QIODevice::ReadOnly); + if (!_file.open(QIODevice::ReadOnly)) + qWarning("%s: %s", qPrintable(_file.fileName()), + qPrintable(_file.errorString())); } void GEMFMap::unload() diff --git a/src/map/jnxmap.cpp b/src/map/jnxmap.cpp index 6cc72d70..bfad6f50 100644 --- a/src/map/jnxmap.cpp +++ b/src/map/jnxmap.cpp @@ -162,7 +162,10 @@ void JNXMap::load(const Projection &in, const Projection &out, _projection = in; _mapRatio = hidpi ? deviceRatio : 1.0; - if (_file.open(QIODevice::ReadOnly)) + if (!_file.open(QIODevice::ReadOnly)) + qWarning("%s: %s", qPrintable(_file.fileName()), + qPrintable(_file.errorString())); + else readTiles(); } diff --git a/src/map/mapsforge/mapdata.cpp b/src/map/mapsforge/mapdata.cpp index 63e6ceb2..bae0e91a 100644 --- a/src/map/mapsforge/mapdata.cpp +++ b/src/map/mapsforge/mapdata.cpp @@ -459,7 +459,11 @@ RectC MapData::bounds() const void MapData::load() { QFile file(_fileName); - if (file.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) + + if (!file.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) + qWarning("%s: %s", qPrintable(file.fileName()), + qPrintable(file.errorString())); + else readSubFiles(file); } diff --git a/src/map/mapsforge/rastertile.cpp b/src/map/mapsforge/rastertile.cpp index 3aba51c8..ee42efa9 100644 --- a/src/map/mapsforge/rastertile.cpp +++ b/src/map/mapsforge/rastertile.cpp @@ -410,8 +410,11 @@ void RasterTile::fetchData(QList &paths, QPoint ttl(_rect.topLeft()); QFile file(_data->fileName()); - if (!file.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) + if (!file.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) { + qWarning("%s: %s", qPrintable(file.fileName()), + qPrintable(file.errorString())); return; + } QRectF pathRect(QPointF(ttl.x() - PATHS_EXTENT, ttl.y() - PATHS_EXTENT), QPointF(ttl.x() + _rect.width() + PATHS_EXTENT, ttl.y() + _rect.height() diff --git a/src/map/pcs.cpp b/src/map/pcs.cpp index c72c1dc5..bebe36ce 100644 --- a/src/map/pcs.cpp +++ b/src/map/pcs.cpp @@ -31,8 +31,7 @@ bool PCS::loadList(const QString &path) bool res; if (!file.open(QFile::ReadOnly)) { - qWarning("Error opening PCS file: %s: %s", qPrintable(path), - qPrintable(file.errorString())); + qWarning("%s: %s", qPrintable(path), qPrintable(file.errorString())); return false; } diff --git a/src/map/qctmap.cpp b/src/map/qctmap.cpp index 6d05ef24..4373b1be 100644 --- a/src/map/qctmap.cpp +++ b/src/map/qctmap.cpp @@ -361,7 +361,9 @@ void QCTMap::load(const Projection &in, const Projection &out, Q_UNUSED(out); _mapRatio = hidpi ? deviceRatio : 1.0; - _file.open(QIODevice::ReadOnly); + if (!_file.open(QIODevice::ReadOnly)) + qWarning("%s: %s", qPrintable(_file.fileName()), + qPrintable(_file.errorString())); } void QCTMap::unload() diff --git a/src/map/rmap.cpp b/src/map/rmap.cpp index b107221c..ef1ac79f 100644 --- a/src/map/rmap.cpp +++ b/src/map/rmap.cpp @@ -365,7 +365,9 @@ void RMap::load(const Projection &in, const Projection &out, qreal deviceRatio, Q_UNUSED(out); _mapRatio = hidpi ? deviceRatio : 1.0; - _file.open(QIODevice::ReadOnly); + if (!_file.open(QIODevice::ReadOnly)) + qWarning("%s: %s", qPrintable(_file.fileName()), + qPrintable(_file.errorString())); } void RMap::unload()