1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-27 21:24:47 +01:00

Improved error reporting

This commit is contained in:
Martin Tůma 2015-12-03 00:25:53 +01:00
parent db4dc37848
commit 363fc47b88

View File

@ -14,7 +14,10 @@ Map::Map(const QString &name, const QString &url)
connect(&Downloader::instance(), SIGNAL(finished()), this,
SLOT(emitLoaded()));
QDir::home().mkpath(QString(TILES_DIR"/%1").arg(_name));
if (!QDir::home().mkpath(QString(TILES_DIR"/%1").arg(_name)))
fprintf(stderr, "Error creating tiles dir: %s\n",
qPrintable(QDir::home().absolutePath() + QString("/"TILES_DIR"/%1")
.arg(_name)));
}
void Map::emitLoaded()
@ -33,9 +36,11 @@ void Map::loadTiles(QList<Tile> &list)
.arg(t.xy().ry());
QFileInfo fi(file);
if (fi.exists())
t.pixmap().load(file);
else {
if (fi.exists()) {
if (!t.pixmap().load(file))
fprintf(stderr, "Error loading map tile: %s\n",
qPrintable(file));
} else {
t.pixmap() = QPixmap(TILE_SIZE, TILE_SIZE);
t.pixmap().fill();