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

qPrintable() -> qUtf8Printable()

This commit is contained in:
Martin Tůma 2025-01-04 00:18:27 +01:00
parent 2b967ce05e
commit ad13a5b0cf
40 changed files with 148 additions and 140 deletions

View File

@ -164,7 +164,8 @@ void GUI::mapInitialized()
_showMapAction->setEnabled(true);
_clearMapCacheAction->setEnabled(true);
} else {
qWarning("%s: %s", qPrintable(map->path()), qPrintable(map->errorString()));
qWarning("%s: %s", qUtf8Printable(map->path()),
qUtf8Printable(map->errorString()));
action->deleteLater();
}
}

View File

@ -127,11 +127,11 @@ Data::Data(const QString &fileName, bool tryUnknown)
++it;
}
qWarning("%s:", qPrintable(fileName));
qWarning("%s:", qUtf8Printable(fileName));
for (it = _parsers.find(suffix); it != _parsers.end()
&& it.key() == suffix; it++)
qWarning(" %s: line %d: %s", qPrintable(it.key()),
it.value()->errorLine(), qPrintable(it.value()->errorString()));
qWarning(" %s: line %d: %s", qUtf8Printable(it.key()),
it.value()->errorLine(), qUtf8Printable(it.value()->errorString()));
} else if (tryUnknown) {
for (it = _parsers.begin(); it != _parsers.end(); it++) {
@ -144,10 +144,10 @@ Data::Data(const QString &fileName, bool tryUnknown)
file.reset();
}
qWarning("%s:", qPrintable(fileName));
qWarning("%s:", qUtf8Printable(fileName));
for (it = _parsers.begin(); it != _parsers.end(); it++)
qWarning(" %s: line %d: %s", qPrintable(it.key()),
it.value()->errorLine(), qPrintable(it.value()->errorString()));
qWarning(" %s: line %d: %s", qUtf8Printable(it.key()),
it.value()->errorLine(), qUtf8Printable(it.value()->errorString()));
_errorLine = 0;
_errorString = "Unknown format";

View File

@ -245,7 +245,7 @@ bool IGCParser::parse(QFile *file, QList<TrackData> &tracks,
/* The date H header is mandatory, but XCSOAR generates
files without it, so add a dummy date in such case */
qWarning("%s: Missing date header",
qPrintable(file->fileName()));
qUtf8Printable(file->fileName()));
ctx.date = QDate(1970, 1, 1);
}
if (!track) {

View File

@ -28,11 +28,12 @@ bool OMDParser::readHeaderFile(const QString &omdPath, Header &hdr)
char buffer[60];
if (!file.open(QIODevice::ReadOnly)) {
qWarning("%s: %s", qPrintable(path), qPrintable(file.errorString()));
qWarning("%s: %s", qUtf8Printable(path),
qUtf8Printable(file.errorString()));
return false;
}
if (file.read(buffer, sizeof(buffer)) != sizeof(buffer)) {
qWarning("%s: invalid OMH file", qPrintable(path));
qWarning("%s: invalid OMH file", qUtf8Printable(path));
return false;
}
@ -48,7 +49,7 @@ bool OMDParser::readHeaderFile(const QString &omdPath, Header &hdr)
QDateTime date(QDate(Y + 2000, M, D), QTime(h, m), QTimeZone::utc());
if (!date.isValid()) {
qWarning("%s: invalid date", qPrintable(path));
qWarning("%s: invalid date", qUtf8Printable(path));
return false;
}
@ -183,11 +184,12 @@ bool GHPParser::readHeaderFile(const QString &ghpPath, Header &hdr)
char buffer[96];
if (!file.open(QIODevice::ReadOnly)) {
qWarning("%s: %s", qPrintable(path), qPrintable(file.errorString()));
qWarning("%s: %s", qUtf8Printable(path),
qUtf8Printable(file.errorString()));
return false;
}
if (file.read(buffer, sizeof(buffer)) != sizeof(buffer)) {
qWarning("%s: invalid GHT file", qPrintable(path));
qWarning("%s: invalid GHT file", qUtf8Printable(path));
return false;
}
@ -202,7 +204,7 @@ bool GHPParser::readHeaderFile(const QString &ghpPath, Header &hdr)
QDateTime date(QDate(Y + 2000, M, D), QTime(h, m, s), QTimeZone::utc());
if (!date.isValid()) {
qWarning("%s: invalid date", qPrintable(path));
qWarning("%s: invalid date", qUtf8Printable(path));
return false;
}

View File

@ -108,8 +108,8 @@ TreeNode<QString> POI::loadDir(const QString &path)
if (loadFile(fi.absoluteFilePath()))
tree.addItem(fi.absoluteFilePath());
else
qWarning("%s: %s", qPrintable(fi.absoluteFilePath()),
qPrintable(_errorString));
qWarning("%s: %s", qUtf8Printable(fi.absoluteFilePath()),
qUtf8Printable(_errorString));
}
}

View File

@ -3,7 +3,7 @@
void SLFParser::warning(const char *text) const
{
const QFile *file = static_cast<QFile *>(_reader.device());
qWarning("%s:%lld: %s", qPrintable(file->fileName()),
qWarning("%s:%lld: %s", qUtf8Printable(file->fileName()),
_reader.lineNumber(), text);
}

View File

@ -4,7 +4,7 @@
void TCXParser::warning(const char *text) const
{
const QFile *file = static_cast<QFile *>(_reader.device());
qWarning("%s:%lld: %s", qPrintable(file->fileName()),
qWarning("%s:%lld: %s", qUtf8Printable(file->fileName()),
_reader.lineNumber(), text);
}

View File

@ -140,8 +140,7 @@ Track::Track(const TrackData &data) : _pause(0)
bool hasTime = !std::isnan(seg.time.first());
for (int j = 1; j < sd.size(); j++) {
ds = sd.at(j).coordinates().distanceTo(
sd.at(j-1).coordinates());
ds = sd.at(j).coordinates().distanceTo(sd.at(j-1).coordinates());
seg.distance.append(seg.distance.last() + ds);
if (hasTime && sd.at(j).timestamp().isValid()) {
@ -149,16 +148,16 @@ Track::Track(const TrackData &data) : _pause(0)
dt = sd.at(j-1).timestamp().msecsTo(
sd.at(j).timestamp()) / 1000.0;
else {
qWarning("%s: %s: time skew detected", qPrintable(
_data.name()), qPrintable(sd.at(j).timestamp().toString(
Qt::ISODate)));
qWarning("%s: %s: time skew detected",
qUtf8Printable(_data.name()),
qUtf8Printable(sd.at(j).timestamp().toString(Qt::ISODate)));
dt = 0;
}
} else {
dt = NAN;
if (hasTime) {
qWarning("%s: missing timestamp(s), time graphs disabled",
qPrintable(_data.name()));
qUtf8Printable(_data.name()));
hasTime = false;
for (int i = 0; i < seg.time.size(); i++)
seg.time[i] = NAN;

View File

@ -37,7 +37,7 @@ void Waypoint::loadSymbolIcons(const QString &dir)
QPixmap pm(files.at(i).absoluteFilePath());
if (pm.isNull())
qWarning("%s: error loading image",
qPrintable(files.at(i).absoluteFilePath()));
qUtf8Printable(files.at(i).absoluteFilePath()));
else
_symbolIcons.insert(files.at(i).baseName(), pm);
}

View File

@ -89,7 +89,7 @@ bool GMAPData::loadTile(const QDir &dir)
if (VectorTile::isTileFile(tt)) {
if (!tile->addFile(fi.absoluteFilePath(), tt)) {
qWarning("%s: Invalid map tile structure",
qPrintable(dir.path()));
qUtf8Printable(dir.path()));
delete tile;
return false;
}
@ -97,7 +97,7 @@ bool GMAPData::loadTile(const QDir &dir)
}
if (!tile->init()) {
qWarning("%s: Invalid map tile", qPrintable(dir.path()));
qWarning("%s: Invalid map tile", qUtf8Printable(dir.path()));
delete tile;
return false;
}

View File

@ -146,8 +146,8 @@ bool IMGData::createTileTree(QFile *file, const TileMap &tileMap)
VectorTile *tile = it.value();
if (!tile->init(file)) {
qWarning("%s: %s: Invalid map tile", qPrintable(_fileName),
qPrintable(it.key()));
qWarning("%s: %s: Invalid map tile", qUtf8Printable(_fileName),
qUtf8Printable(it.key()));
delete tile;
continue;
}

View File

@ -446,8 +446,8 @@ void RasterTile::fetchData(QList<MapData::Poly> &polygons,
if (dynamic_cast<IMGData*>(_data)) {
_file = new QFile(_data->fileName());
if (!_file->open(QIODevice::ReadOnly | QIODevice::Unbuffered)) {
qWarning("%s: %s", qPrintable(_file->fileName()),
qPrintable(_file->errorString()));
qWarning("%s: %s", qUtf8Printable(_file->fileName()),
qUtf8Printable(_file->errorString()));
return;
}
}

View File

@ -1177,7 +1177,7 @@ bool Style::parsePolygons(SubFile *file, SubFile::Handle &hdl,
if (!parsePolygon(file, hdl, section, info, type))
qWarning("%s: %x: broken polygon style",
qPrintable(file->fileName()), type);
qUtf8Printable(file->fileName()), type);
}
return true;
@ -1201,8 +1201,8 @@ bool Style::parseLines(SubFile *file, SubFile::Handle &hdl,
? 0x10000 | (info.type << 8) | info.subtype : (info.type << 8);
if (!parseLine(file, hdl, section, info, type))
qWarning("%s: %x: broken line style", qPrintable(file->fileName()),
type);
qWarning("%s: %x: broken line style",
qUtf8Printable(file->fileName()), type);
}
return true;
@ -1227,8 +1227,8 @@ bool Style::parsePoints(SubFile *file, SubFile::Handle &hdl,
: (info.type << 8) | info.subtype;
if (!parsePoint(file, hdl, section, info, type))
qWarning("%s: %x: broken point style", qPrintable(file->fileName()),
type);
qWarning("%s: %x: broken point style",
qUtf8Printable(file->fileName()), type);
}
return true;
@ -1304,7 +1304,7 @@ bool Style::parseTYPFile(SubFile *typ)
&& parsePolygons(typ, hdl, polygons)
&& parseDrawOrder(typ, hdl, order))) {
qWarning("%s: Invalid TYP file, using default style",
qPrintable(typ->fileName()));
qUtf8Printable(typ->fileName()));
return false;
}

View File

@ -27,8 +27,8 @@ public:
if (!_file) {
_file = new QFile(subFile->fileName());
if (!_file->open(QIODevice::ReadOnly | QIODevice::Unbuffered))
qWarning("%s: %s", qPrintable(_file->fileName()),
qPrintable(_file->errorString()));
qWarning("%s: %s", qUtf8Printable(_file->fileName()),
qUtf8Printable(_file->errorString()));
_delete = true;
}
_data.resize(subFile->blockSize());

View File

@ -259,8 +259,8 @@ void AQMMap::load(const Projection &in, const Projection &out,
_mapRatio = hidpi ? deviceRatio : 1.0;
if (!_file.open(QIODevice::ReadOnly))
qWarning("%s: %s", qPrintable(_file.fileName()),
qPrintable(_file.errorString()));
qWarning("%s: %s", qUtf8Printable(_file.fileName()),
qUtf8Printable(_file.errorString()));
}
void AQMMap::unload()

View File

@ -156,7 +156,8 @@ Atlas::Atlas(const QString &fileName, bool TAR, const Projection &proj,
OziMap::CalibrationType type;
QString cf(calibrationFile(path, type));
if (cf.isNull()) {
qWarning("%s: no calibration file found", qPrintable(path));
qWarning("%s: no calibration file found",
qUtf8Printable(path));
continue;
}
map = new OziMap(cf, type, proj, this);
@ -165,8 +166,8 @@ Atlas::Atlas(const QString &fileName, bool TAR, const Projection &proj,
if (map->isValid())
_maps.append(map);
else {
qWarning("%s: %s", qPrintable(map->path()),
qPrintable(map->errorString()));
qWarning("%s: %s", qUtf8Printable(map->path()),
qUtf8Printable(map->errorString()));
delete map;
}
}

View File

@ -141,17 +141,18 @@ bool Conversion::loadList(const QString &path)
bool res;
if (!file.open(QFile::ReadOnly)) {
qWarning("%s: %s", qPrintable(path), qPrintable(file.errorString()));
qWarning("%s: %s", qUtf8Printable(path),
qUtf8Printable(file.errorString()));
return false;
}
while (!csv.atEnd()) {
if (!csv.readEntry(entry)) {
qWarning("%s:%d: Parse error", qPrintable(path), csv.line());
qWarning("%s:%d: Parse error", qUtf8Printable(path), csv.line());
return false;
}
if (entry.size() < 26) {
qWarning("%s:%d: Invalid column count", qPrintable(path),
qWarning("%s:%d: Invalid column count", qUtf8Printable(path),
csv.line() - 1);
return false;
}
@ -159,42 +160,42 @@ bool Conversion::loadList(const QString &path)
QString name(entry.at(0));
int proj = entry.at(1).toInt(&res);
if (!res) {
qWarning("%s:%d: Invalid projection code", qPrintable(path),
qWarning("%s:%d: Invalid projection code", qUtf8Printable(path),
csv.line() - 1);
continue;
}
int units = entry.at(2).toInt(&res);
if (!res) {
qWarning("%s:%d: Invalid linear units code", qPrintable(path),
qWarning("%s:%d: Invalid linear units code", qUtf8Printable(path),
csv.line() - 1);
continue;
}
int transform = entry.at(3).toInt(&res);
if (!res) {
qWarning("%s:%d: Invalid coordinate transformation code",
qPrintable(path), csv.line() - 1);
qUtf8Printable(path), csv.line() - 1);
continue;
}
int cs = entry.at(4).toInt(&res);
if (!res) {
qWarning("%s:%d: Invalid coordinate system code",
qPrintable(path), csv.line() - 1);
qUtf8Printable(path), csv.line() - 1);
continue;
}
if (!LinearUnits(units).isValid()) {
qWarning("%s:%d: Unknown linear units code", qPrintable(path),
qWarning("%s:%d: Unknown linear units code", qUtf8Printable(path),
csv.line() - 1);
continue;
}
if (!Method(transform).isValid()) {
qWarning("%s:%d: Unknown coordinate transformation code",
qPrintable(path), csv.line() - 1);
qUtf8Printable(path), csv.line() - 1);
continue;
}
if (!CoordinateSystem(cs).isValid()) {
qWarning("%s:%d: Unknown coordinate system code", qPrintable(path),
csv.line() - 1);
qWarning("%s:%d: Unknown coordinate system code",
qUtf8Printable(path), csv.line() - 1);
continue;
}
@ -202,7 +203,7 @@ bool Conversion::loadList(const QString &path)
int pn = projectionSetup(entry, setup);
if (pn) {
qWarning("%s: %d: Invalid projection parameter #%d",
qPrintable(path), csv.line(), pn);
qUtf8Printable(path), csv.line(), pn);
continue;
}

View File

@ -131,8 +131,8 @@ DEM::Entry *DEM::loadTile(const Tile &tile)
} else {
QFile file(path);
if (!file.open(QIODevice::ReadOnly)) {
qWarning("%s: %s", qPrintable(file.fileName()),
qPrintable(file.errorString()));
qWarning("%s: %s", qUtf8Printable(file.fileName()),
qUtf8Printable(file.errorString()));
return new Entry();
} else
return new Entry(file.readAll());

View File

@ -57,7 +57,7 @@ bool DEMLoader::loadTiles(const RectC &rect)
/* Create the user DEM dir only when a download is requested as it will
override the global DEM dir. */
if (!_dir.mkpath(_dir.absolutePath())) {
qWarning("%s: %s", qPrintable(_dir.canonicalPath()),
qWarning("%s: %s", qUtf8Printable(_dir.canonicalPath()),
"Error creating DEM directory");
return false;
}

View File

@ -165,7 +165,7 @@ bool Downloader::doDownload(const Download &dl, const QList<HTTPHeader> &headers
if (!url.isValid() || !(url.scheme() == QLatin1String("http")
|| url.scheme() == QLatin1String("https"))) {
qWarning("%s: Invalid URL", qPrintable(url.toString()));
qWarning("%s: Invalid URL", qUtf8Printable(url.toString()));
return false;
}
@ -195,8 +195,8 @@ bool Downloader::doDownload(const Download &dl, const QList<HTTPHeader> &headers
QFile *file = new QFile(tmpName(dl.file()));
if (!file->open(QIODevice::WriteOnly)) {
qWarning("%s: %s", qPrintable(file->fileName()),
qPrintable(file->errorString()));
qWarning("%s: %s", qUtf8Printable(file->fileName()),
qUtf8Printable(file->errorString()));
delete file;
_errorDownloads.insert(url, RETRIES);
return false;

View File

@ -38,36 +38,37 @@ bool Ellipsoid::loadList(const QString &path)
bool res;
if (!file.open(QFile::ReadOnly)) {
qWarning("%s: %s", qPrintable(path), qPrintable(file.errorString()));
qWarning("%s: %s", qUtf8Printable(path),
qUtf8Printable(file.errorString()));
return false;
}
while (!csv.atEnd()) {
if (!csv.readEntry(entry)) {
qWarning("%s:%d: Parse error", qPrintable(path), csv.line());
qWarning("%s:%d: Parse error", qUtf8Printable(path), csv.line());
return false;
}
if (entry.size() < 4) {
qWarning("%s:%d: Invalid column count", qPrintable(path),
qWarning("%s:%d: Invalid column count", qUtf8Printable(path),
csv.line() - 1);
return false;
}
int id = entry.at(1).toInt(&res);
if (!res) {
qWarning("%s:%d: Invalid ellipsoid code", qPrintable(path),
qWarning("%s:%d: Invalid ellipsoid code", qUtf8Printable(path),
csv.line() - 1);
continue;
}
double radius = entry.at(2).toDouble(&res);
if (!res) {
qWarning("%s:%d: Invalid radius", qPrintable(path),
qWarning("%s:%d: Invalid radius", qUtf8Printable(path),
csv.line() - 1);
continue;
}
double flattening = entry.at(3).toDouble(&res);
if (!res) {
qWarning("%s:%d: Invalid flattening", qPrintable(path),
qWarning("%s:%d: Invalid flattening", qUtf8Printable(path),
csv.line() - 1);
continue;
}

View File

@ -102,11 +102,11 @@ void ENCAtlas::addMap(const QDir &dir, const QByteArray &file,
{
QString path(dir.absoluteFilePath(file));
if (!QFileInfo::exists(path)) {
qWarning("%s: No such map file", qPrintable(path));
qWarning("%s: No such map file", qUtf8Printable(path));
return;
}
if (!bounds.isValid()) {
qWarning("%s: Invalid map bounds", qPrintable(path));
qWarning("%s: Invalid map bounds", qUtf8Printable(path));
return;
}

View File

@ -102,96 +102,97 @@ bool GCS::loadList(const QString &path)
bool res;
if (!file.open(QFile::ReadOnly)) {
qWarning("%s: %s", qPrintable(path), qPrintable(file.errorString()));
qWarning("%s: %s", qUtf8Printable(path),
qUtf8Printable(file.errorString()));
return false;
}
while (!csv.atEnd()) {
if (!csv.readEntry(entry)) {
qWarning("%s:%d: Parse error", qPrintable(path), csv.line());
qWarning("%s:%d: Parse error", qUtf8Printable(path), csv.line());
return false;
}
if (entry.size() < 14) {
qWarning("%s:%d: Invalid column count", qPrintable(path),
qWarning("%s:%d: Invalid column count", qUtf8Printable(path),
csv.line() - 1);
return false;
}
int id = parameter(entry.at(1), &res);
if (!res) {
qWarning("%s:%d: Invalid GCS code", qPrintable(path),
qWarning("%s:%d: Invalid GCS code", qUtf8Printable(path),
csv.line() - 1);
continue;
}
int gd = parameter(entry.at(2), &res);
if (!res) {
qWarning("%s:%d: Invalid geodetic datum code", qPrintable(path),
qWarning("%s:%d: Invalid geodetic datum code", qUtf8Printable(path),
csv.line() - 1);
continue;
}
int au = entry.at(3).toInt(&res);
if (!res) {
qWarning("%s:%d: Invalid angular units code", qPrintable(path),
qWarning("%s:%d: Invalid angular units code", qUtf8Printable(path),
csv.line() - 1);
continue;
}
int el = entry.at(4).toInt(&res);
if (!res) {
qWarning("%s:%d: Invalid ellipsoid code", qPrintable(path),
qWarning("%s:%d: Invalid ellipsoid code", qUtf8Printable(path),
csv.line() - 1);
continue;
}
int pm = entry.at(5).toInt(&res);
if (!res) {
qWarning("%s:%d: Invalid prime meridian code", qPrintable(path),
qWarning("%s:%d: Invalid prime meridian code", qUtf8Printable(path),
csv.line() - 1);
continue;
}
int ct = entry.at(6).toInt(&res);
if (!res) {
qWarning("%s:%d: Invalid coordinates transformation code",
qPrintable(path), csv.line() - 1);
qUtf8Printable(path), csv.line() - 1);
continue;
}
double dx = entry.at(7).toDouble(&res);
if (!res) {
qWarning("%s:%d: Invalid dx", qPrintable(path), csv.line() - 1);
qWarning("%s:%d: Invalid dx", qUtf8Printable(path), csv.line() - 1);
continue;
}
double dy = entry.at(8).toDouble(&res);
if (!res) {
qWarning("%s:%d: Invalid dy", qPrintable(path), csv.line() - 1);
qWarning("%s:%d: Invalid dy", qUtf8Printable(path), csv.line() - 1);
continue;
}
double dz = entry.at(9).toDouble(&res);
if (!res) {
qWarning("%s:%d: Invalid dz", qPrintable(path), csv.line() - 1);
qWarning("%s:%d: Invalid dz", qUtf8Printable(path), csv.line() - 1);
continue;
}
double rx = parameterd(entry.at(10), &res);
if (!res) {
qWarning("%s:%d: Invalid rx", qPrintable(path), csv.line() - 1);
qWarning("%s:%d: Invalid rx", qUtf8Printable(path), csv.line() - 1);
continue;
}
double ry = parameterd(entry.at(11), &res);
if (!res) {
qWarning("%s:%d: Invalid ry", qPrintable(path), csv.line() - 1);
qWarning("%s:%d: Invalid ry", qUtf8Printable(path), csv.line() - 1);
continue;
}
double rz = parameterd(entry.at(12), &res);
if (!res) {
qWarning("%s:%d: Invalid rz", qPrintable(path), csv.line() - 1);
qWarning("%s:%d: Invalid rz", qUtf8Printable(path), csv.line() - 1);
continue;
}
double ds = parameterd(entry.at(13), &res);
if (!res) {
qWarning("%s:%d: Invalid ds", qPrintable(path), csv.line() - 1);
qWarning("%s:%d: Invalid ds", qUtf8Printable(path), csv.line() - 1);
continue;
}
const Ellipsoid &e = Ellipsoid::ellipsoid(el);
if (e.isNull()) {
qWarning("%s:%d: Unknown ellipsoid code", qPrintable(path),
qWarning("%s:%d: Unknown ellipsoid code", qUtf8Printable(path),
csv.line() - 1);
continue;
}
@ -209,12 +210,12 @@ bool GCS::loadList(const QString &path)
break;
default:
qWarning("%s:%d: Unknown coordinates transformation method",
qPrintable(path), csv.line() - 1);
qUtf8Printable(path), csv.line() - 1);
continue;
}
if (!datum.isValid()) {
qWarning("%s:%d: Invalid coordinates transformation parameters",
qPrintable(path), csv.line() - 1);
qUtf8Printable(path), csv.line() - 1);
continue;
}
@ -223,7 +224,7 @@ bool GCS::loadList(const QString &path)
_gcss.append(Entry(id, gd, entry.at(0), gcs));
else
qWarning("%s:%d: Unknown prime meridian/angular units code",
qPrintable(path), csv.line() - 1);
qUtf8Printable(path), csv.line() - 1);
}
std::sort(_gcss.begin(), _gcss.end());

View File

@ -190,8 +190,8 @@ void GEMFMap::load(const Projection &in, const Projection &out,
_mapRatio = hidpi ? deviceRatio : 1.0;
if (!_file.open(QIODevice::ReadOnly))
qWarning("%s: %s", qPrintable(_file.fileName()),
qPrintable(_file.errorString()));
qWarning("%s: %s", qUtf8Printable(_file.fileName()),
qUtf8Printable(_file.errorString()));
}
void GEMFMap::unload()

View File

@ -46,8 +46,8 @@ static QList<MapData*> overlays(const QString &fileName)
if (data->isValid())
list.append(data);
else {
qWarning("%s: %s", qPrintable(data->fileName()),
qPrintable(data->errorString()));
qWarning("%s: %s", qUtf8Printable(data->fileName()),
qUtf8Printable(data->errorString()));
delete data;
}
} else

View File

@ -163,8 +163,8 @@ void JNXMap::load(const Projection &in, const Projection &out,
_mapRatio = hidpi ? deviceRatio : 1.0;
if (!_file.open(QIODevice::ReadOnly))
qWarning("%s: %s", qPrintable(_file.fileName()),
qPrintable(_file.errorString()));
qWarning("%s: %s", qUtf8Printable(_file.fileName()),
qUtf8Printable(_file.errorString()));
else
readTiles();
}

View File

@ -96,9 +96,9 @@ Map *MapList::loadFile(const QString &path, const Projection &proj, bool *isDir)
}
}
qWarning("%s:", qPrintable(path));
qWarning("%s:", qUtf8Printable(path));
for (int i = 0; i < errors.size(); i++)
qWarning(" %s", qPrintable(errors.at(i)));
qWarning(" %s", qUtf8Printable(errors.at(i)));
return map ? map : new InvalidMap(path, "Unknown file format");
}

View File

@ -461,8 +461,8 @@ void MapData::load()
QFile file(_fileName);
if (!file.open(QIODevice::ReadOnly | QIODevice::Unbuffered))
qWarning("%s: %s", qPrintable(file.fileName()),
qPrintable(file.errorString()));
qWarning("%s: %s", qUtf8Printable(file.fileName()),
qUtf8Printable(file.errorString()));
else
readSubFiles(file);
}

View File

@ -411,8 +411,8 @@ void RasterTile::fetchData(QList<MapData::Path> &paths,
QFile file(_data->fileName());
if (!file.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) {
qWarning("%s: %s", qPrintable(file.fileName()),
qPrintable(file.errorString()));
qWarning("%s: %s", qUtf8Printable(file.fileName()),
qUtf8Printable(file.errorString()));
return;
}

View File

@ -85,7 +85,7 @@ const Style::Menu::Layer *Style::Menu::findLayer(const QString &id) const
if (_layers.at(i).id() == id)
return &_layers.at(i);
qWarning("%s: layer not found", qPrintable(id));
qWarning("%s: layer not found", qUtf8Printable(id));
return 0;
}
@ -792,8 +792,8 @@ bool Style::loadXml(const QString &path, const MapData &data, qreal ratio)
}
if (reader.error())
qWarning("%s:%lld %s", qPrintable(path), reader.lineNumber(),
qPrintable(reader.errorString()));
qWarning("%s:%lld %s", qUtf8Printable(path), reader.lineNumber(),
qUtf8Printable(reader.errorString()));
return !reader.error();
}

View File

@ -41,7 +41,7 @@ bool MBTilesMap::getMinZoom(int &zoom)
return false;
}
} else {
qWarning("%s: missing minzoom metadata", qPrintable(path()));
qWarning("%s: missing minzoom metadata", qUtf8Printable(path()));
zoom = OSM::ZOOMS.min();
}
@ -60,7 +60,7 @@ bool MBTilesMap::getMaxZoom(int &zoom)
return false;
}
} else {
qWarning("%s: missing maxzoom metadata", qPrintable(path()));
qWarning("%s: missing maxzoom metadata", qUtf8Printable(path()));
zoom = OSM::ZOOMS.max();
}
@ -103,7 +103,7 @@ bool MBTilesMap::getBounds()
}
_bounds = b;
} else {
qWarning("%s: missing bounds metadata", qPrintable(path()));
qWarning("%s: missing bounds metadata", qUtf8Printable(path()));
int z = _zoomsBase.first().z;
QString sql = QString("SELECT min(tile_column), min(tile_row), "
@ -156,7 +156,7 @@ void MBTilesMap::getTileFormat()
if (query.value(0).toString() == "pbf")
_scalable = true;
} else
qWarning("%s: missing tiles format metadata", qPrintable(path()));
qWarning("%s: missing tiles format metadata", qUtf8Printable(path()));
}
void MBTilesMap::getTilePixelRatio()
@ -177,7 +177,7 @@ void MBTilesMap::getName()
if (query.first())
_name = query.value(0).toString();
else {
qWarning("%s: missing map name", qPrintable(path()));
qWarning("%s: missing map name", qUtf8Printable(path()));
_name = Util::file2name(path());
}
}

View File

@ -514,8 +514,8 @@ QPixmap OruxMap::tile(const Zoom &z, int x, int y) const
query.exec();
if (!query.first()) {
qWarning("%s: SQL %d-%d-%d: not found", qPrintable(name()), z.zoom,
x, y);
qWarning("%s: SQL %d-%d-%d: not found", qUtf8Printable(name()),
z.zoom, x, y);
return QPixmap();
} else {
QImage img(QImage::fromData(query.value(0).toByteArray()));
@ -526,8 +526,8 @@ QPixmap OruxMap::tile(const Zoom &z, int x, int y) const
+ QString::number(y) + ".omc2");
QString path(z.set.absoluteFilePath(fileName));
if (!QFileInfo::exists(path)) {
qWarning("%s: %s: not found", qPrintable(name()),
qPrintable(fileName));
qWarning("%s: %s: not found", qUtf8Printable(name()),
qUtf8Printable(fileName));
return QPixmap();
} else {
QImage img(path);

View File

@ -117,7 +117,7 @@ bool OZF::readHeaders()
if (!initOZF3())
return false;
} else {
qWarning("%s: not a OZF2/OZF3 file", qPrintable(_file.fileName()));
qWarning("%s: not a OZF2/OZF3 file", qUtf8Printable(_file.fileName()));
return false;
}

View File

@ -288,7 +288,7 @@ bool OziMap::setTileInfo(const QStringList &tiles, const QString &path)
if (_tile.size.isValid())
return true;
else
qWarning("%s: error reading tile image", qPrintable(tile));
qWarning("%s: error reading tile image", qUtf8Printable(tile));
}
}
@ -310,16 +310,16 @@ void OziMap::load(const Projection &in, const Projection &out,
if (_tar) {
Q_ASSERT(!_tar->isOpen());
if (!_tar->open()) {
qWarning("%s: %s", qPrintable(_tar->fileName()),
qPrintable(_tar->errorString()));
qWarning("%s: %s", qUtf8Printable(_tar->fileName()),
qUtf8Printable(_tar->errorString()));
return;
}
}
if (_ozf) {
Q_ASSERT(!_ozf->isOpen());
if (!_ozf->open()) {
qWarning("%s: %s", qPrintable(_ozf->fileName()),
qPrintable(_ozf->errorString()));
qWarning("%s: %s", qUtf8Printable(_ozf->fileName()),
qUtf8Printable(_ozf->errorString()));
return;
}
}
@ -370,7 +370,7 @@ void OziMap::drawTiled(QPainter *painter, const QRectF &rect) const
pixmap = QPixmap(tileName);
if (pixmap.isNull())
qWarning("%s: error loading tile image", qPrintable(tileName));
qWarning("%s: error loading tile image", qUtf8Printable(tileName));
else {
pixmap.setDevicePixelRatio(_mapRatio);
QPointF tp(tl.x() + i * ts.width(), tl.y() + j * ts.height());
@ -404,7 +404,7 @@ void OziMap::drawOZF(QPainter *painter, const QRectF &rect) const
}
if (pixmap.isNull())
qWarning("%s: error loading tile image", qPrintable(key));
qWarning("%s: error loading tile image", qUtf8Printable(key));
else {
pixmap.setDevicePixelRatio(_mapRatio);
QPointF tp(tl.x() + i * ts.width(), tl.y() + j * ts.height());

View File

@ -31,17 +31,18 @@ bool PCS::loadList(const QString &path)
bool res;
if (!file.open(QFile::ReadOnly)) {
qWarning("%s: %s", qPrintable(path), qPrintable(file.errorString()));
qWarning("%s: %s", qUtf8Printable(path),
qUtf8Printable(file.errorString()));
return false;
}
while (!csv.atEnd()) {
if (!csv.readEntry(entry)) {
qWarning("%s:%d: Parse error", qPrintable(path), csv.line());
qWarning("%s:%d: Parse error", qUtf8Printable(path), csv.line());
return false;
}
if (entry.size() < 4) {
qWarning("%s:%d: Invalid column count", qPrintable(path),
qWarning("%s:%d: Invalid column count", qUtf8Printable(path),
csv.line() - 1);
return false;
}
@ -49,30 +50,30 @@ bool PCS::loadList(const QString &path)
QString name(entry.at(0));
int id = entry.at(1).toInt(&res);
if (!res) {
qWarning("%s:%d: Invalid PCS code", qPrintable(path),
qWarning("%s:%d: Invalid PCS code", qUtf8Printable(path),
csv.line() - 1);
continue;
}
int gcs = entry.at(2).toInt(&res);
if (!res) {
qWarning("%s:%d: Invalid GCS code", qPrintable(path),
qWarning("%s:%d: Invalid GCS code", qUtf8Printable(path),
csv.line() - 1);
continue;
}
int proj = entry.at(3).toInt(&res);
if (!res) {
qWarning("%s:%d: Invalid projection code", qPrintable(path),
qWarning("%s:%d: Invalid projection code", qUtf8Printable(path),
csv.line() - 1);
continue;
}
if (GCS::gcs(gcs).isNull()) {
qWarning("%s:%d: Unknown GCS code", qPrintable(path),
qWarning("%s:%d: Unknown GCS code", qUtf8Printable(path),
csv.line() - 1);
continue;
}
if (Conversion::conversion(proj).isNull()) {
qWarning("%s:%d: Unknown projection code", qPrintable(path),
qWarning("%s:%d: Unknown projection code", qUtf8Printable(path),
csv.line() - 1);
continue;
}

View File

@ -28,7 +28,7 @@ static Conversion::Method projectionMethod(const QString &name)
if (!name.compare(methods[i].name, Qt::CaseInsensitive))
return methods[i].id;
qWarning("%s: unknown projection", qPrintable(name));
qWarning("%s: unknown projection", qUtf8Printable(name));
return Conversion::Method();
}
@ -66,7 +66,7 @@ static void setParameter(Conversion::Setup *setup, const QString &name,
else if (!name.compare("azimuth", Qt::CaseInsensitive))
setup->setStandardParallel2(val);
else
qWarning("%s: unknown projection parameter", qPrintable(name));
qWarning("%s: unknown projection parameter", qUtf8Printable(name));
}
PRJFile::Token PRJFile::keyword(CTX &ctx)

View File

@ -362,8 +362,8 @@ void QCTMap::load(const Projection &in, const Projection &out,
_mapRatio = hidpi ? deviceRatio : 1.0;
if (!_file.open(QIODevice::ReadOnly))
qWarning("%s: %s", qPrintable(_file.fileName()),
qPrintable(_file.errorString()));
qWarning("%s: %s", qUtf8Printable(_file.fileName()),
qUtf8Printable(_file.errorString()));
}
void QCTMap::unload()
@ -483,7 +483,7 @@ void QCTMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
}
if (pixmap.isNull())
qWarning("%s: error loading tile image", qPrintable(key));
qWarning("%s: error loading tile image", qUtf8Printable(key));
else {
pixmap.setDevicePixelRatio(_mapRatio);
QPointF tp(tl.x() + i * ts.width(), tl.y() + j * ts.height());

View File

@ -366,8 +366,8 @@ void RMap::load(const Projection &in, const Projection &out, qreal deviceRatio,
_mapRatio = hidpi ? deviceRatio : 1.0;
if (!_file.open(QIODevice::ReadOnly))
qWarning("%s: %s", qPrintable(_file.fileName()),
qPrintable(_file.errorString()));
qWarning("%s: %s", qUtf8Printable(_file.fileName()),
qUtf8Printable(_file.errorString()));
}
void RMap::unload()
@ -455,7 +455,7 @@ void RMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
}
if (pixmap.isNull())
qWarning("%s: error loading tile image", qPrintable(key));
qWarning("%s: error loading tile image", qUtf8Printable(key));
else {
pixmap.setDevicePixelRatio(_mapRatio);
QPointF tp(tl.x() + i * ts.width(), tl.y() + j * ts.height());

View File

@ -103,7 +103,7 @@ bool Tar::loadTmi(const QString &path)
QByteArray line(file.readLine(4096));
int pos = line.indexOf(':');
if (line.size() < 10 || pos < 7 || !line.startsWith("block")) {
qWarning("%s:%d: syntax error", qPrintable(path), ln);
qWarning("%s:%d: syntax error", qUtf8Printable(path), ln);
_index.clear();
return false;
}

View File

@ -56,7 +56,8 @@ TileLoader::TileLoader(const QString &dir, QObject *parent)
: QObject(parent), _urlType(XYZ), _dir(dir)
{
if (!QDir().mkpath(_dir))
qWarning("%s: %s", qPrintable(_dir), "Error creating tiles directory");
qWarning("%s: %s", qUtf8Printable(_dir),
"Error creating tiles directory");
_downloader = new Downloader(this);
connect(_downloader, &Downloader::finished, this, &TileLoader::finished);