1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-18 03:42:09 +01:00

Improved error reporting

This commit is contained in:
Martin Tůma 2025-01-02 18:55:15 +01:00
parent 699e086618
commit 701f392a29
13 changed files with 37 additions and 17 deletions

View File

@ -445,7 +445,11 @@ void RasterTile::fetchData(QList<MapData::Poly> &polygons,
if (dynamic_cast<IMGData*>(_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()

View File

@ -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());

View File

@ -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()

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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()

View File

@ -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();
}

View File

@ -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);
}

View File

@ -410,8 +410,11 @@ void RasterTile::fetchData(QList<MapData::Path> &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()

View File

@ -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;
}

View File

@ -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()

View File

@ -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()