summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@theqtcompany.com>2015-07-08 16:56:22 +0200
committerKai Koehne <kai.koehne@theqtcompany.com>2015-07-09 13:38:42 +0000
commitb2a65ce68bce4fcd4b517d1aadedb40792bfc818 (patch)
treee3685aa349abe10148c250d963723c049919b5c9 /tools
parentd7f53290d9a8589752b9191131dfe2b500a23511 (diff)
Sanitize QDebug output
Prefer using the stream operator logic instead of using QString::fromLatin1. Add a noquote() where a QString should be printed without any quotes/escapes. This also fixes the tests with Qt 5.5, where QString's are further escaped. Change-Id: Ie3afd14b9355101d3c0b52f30f66ec759c76526c Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/binarycreator/binarycreator.cpp5
-rw-r--r--tools/common/repositorygen.cpp25
2 files changed, 13 insertions, 17 deletions
diff --git a/tools/binarycreator/binarycreator.cpp b/tools/binarycreator/binarycreator.cpp
index 4f400e6f2..4564b5188 100644
--- a/tools/binarycreator/binarycreator.cpp
+++ b/tools/binarycreator/binarycreator.cpp
@@ -280,8 +280,7 @@ static int assemble(Input input, const QInstaller::Settings &settings)
qDebug() << "Creating resource archive for" << info.name;
foreach (const QString &file, info.copiedFiles) {
const QSharedPointer<Resource> resource(new Resource(file));
- qDebug() << QString::fromLatin1("Appending %1 (%2)").arg(file,
- humanReadableSize(resource->size()));
+ qDebug().nospace() << "Appending " << file << " (" << humanReadableSize(resource->size()) << ")";
collection.appendResource(resource);
}
input.manager.insertCollection(collection);
@@ -493,7 +492,7 @@ void copyConfigData(const QString &configFile, const QString &targetDir)
const QString tagName = domElement.tagName();
const QString elementText = domElement.text();
- qDebug() << QString::fromLatin1("Read dom element: <%1>%2</%1>.").arg(tagName, elementText);
+ qDebug().noquote() << QString::fromLatin1("Read dom element: <%1>%2</%1>.").arg(tagName, elementText);
QString newName = domElement.text().replace(QRegExp(QLatin1String("\\\\|/|\\.|:")),
QLatin1String("_"));
diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp
index 5e1e348a8..63ee2385b 100644
--- a/tools/common/repositorygen.cpp
+++ b/tools/common/repositorygen.cpp
@@ -77,7 +77,7 @@ QString QInstallerTools::makePathAbsolute(const QString &path)
void QInstallerTools::copyWithException(const QString &source, const QString &target, const QString &kind)
{
- qDebug() << QString::fromLatin1("Copying associated %1 file \"%2\".").arg(kind, source);
+ qDebug() << "Copying associated" << kind << "file" << source;
const QFileInfo targetFileInfo(target);
if (!targetFileInfo.dir().exists())
@@ -163,8 +163,7 @@ void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &met
throw QInstaller::Error(QString::fromLatin1("Cannot create directory \"%1\".").arg(info.name));
const QString packageXmlPath = QString::fromLatin1("%1/meta/package.xml").arg(info.directory);
- qDebug() << QString::fromLatin1("Copy meta data for package \"%1\" using \"%2\".").arg(info.name,
- packageXmlPath);
+ qDebug() << "Copy meta data for package" << info.name << "using" << packageXmlPath;
QFile file(packageXmlPath);
QInstaller::openForRead(&file);
@@ -222,8 +221,7 @@ void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &met
}
if (!foundDisplayName) {
- qWarning() << QString::fromLatin1("No DisplayName tag found at \"%1\", using component Name instead."
- ).arg(info.name);
+ qWarning() << "No DisplayName tag found at" << info.name << ", using component Name instead.";
QDomElement displayNameElement = doc.createElement(QLatin1String("DisplayName"));
update.appendChild(displayNameElement).appendChild(doc.createTextNode(info.name));
}
@@ -236,7 +234,7 @@ void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &met
const QDir dataDir = QString::fromLatin1("%1/%2/data").arg(metaDataDir, info.name);
const QFileInfoList entries = dataDir.exists() ? dataDir.entryInfoList(filters | QDir::Dirs)
: QDir(QString::fromLatin1("%1/%2").arg(metaDataDir, info.name)).entryInfoList(filters);
- qDebug() << QString::fromLatin1("calculate size of directory: %1").arg(dataDir.absolutePath());
+ qDebug() << "calculate size of directory" << dataDir.absolutePath();
foreach (const QFileInfo &fi, entries) {
try {
if (fi.isDir()) {
@@ -264,7 +262,7 @@ void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &met
compressedComponentSize += size;
}
} catch (const QInstaller::Error &error) {
- qDebug() << error.message();
+ qDebug().noquote() << error.message();
} catch(...) {
// ignore, that's just about the sizes - and size doesn't matter, you know?
}
@@ -397,7 +395,7 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QStringList &packa
continue;
packagesToFilter->removeAll(it->fileName());
}
- qDebug() << QString::fromLatin1("Found subdirectory \"%1\".").arg(it->fileName());
+ qDebug() << "Found subdirectory" << it->fileName();
// because the filter is QDir::Dirs - filename means the name of the subdirectory
if (it->fileName().contains(QLatin1Char('-'))) {
if (ignoreInvalidPackages)
@@ -434,9 +432,9 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QStringList &packa
const QDomElement packageElement = doc.firstChildElement(QLatin1String("Package"));
const QString name = packageElement.firstChildElement(QLatin1String("Name")).text();
if (!name.isEmpty() && name != it->fileName()) {
- qWarning() << QString::fromLatin1("The <Name> tag in the file \"%1\" is ignored - the installer uses the "
- "path element right before the 'meta' (\"%2\").").arg(fileInfo.absoluteFilePath(),
- it->fileName());
+ qWarning().nospace() << "The <Name> tag in the file " << fileInfo.absoluteFilePath()
+ << " is ignored - the installer uses the path element right before the 'meta'"
+ << " (" << it->fileName() << ")";
}
QString releaseDate = packageElement.firstChildElement(QLatin1String("ReleaseDate")).text();
@@ -468,7 +466,7 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QStringList &packa
info.directory = it->filePath();
dict.push_back(info);
- qDebug() << QString::fromLatin1("- it provides the package %1 - %2").arg(info.name, info.version);
+ qDebug() << "- it provides the package" << info.name << " - " << info.version;
}
if (!packagesToFilter->isEmpty() && packagesToFilter->at(0) != QString::fromLatin1(
@@ -578,8 +576,7 @@ void QInstallerTools::copyComponentData(const QStringList &packageDirs, const QS
if (Lib7z::isSupportedArchive(absoluteEntryFilePath)) {
QFile tmp(absoluteEntryFilePath);
QString target = QString::fromLatin1("%1/%3%2").arg(namedRepoDir, entry, info.version);
- qDebug() << QString::fromLatin1("Copying archive from \"%1\" to \"%2\".").arg(tmp.fileName(),
- target);
+ qDebug() << "Copying archive from" << tmp.fileName() << "to" << target;
if (!tmp.copy(target)) {
throw QInstaller::Error(QString::fromLatin1("Cannot copy file \"%1\" to \"%2\": %3")
.arg(QDir::toNativeSeparators(tmp.fileName()), QDir::toNativeSeparators(target), tmp.errorString()));