From 51767479dedc892bc09324ec4ea83500744091d2 Mon Sep 17 00:00:00 2001 From: tjenssen Date: Thu, 27 Sep 2012 17:49:31 +0200 Subject: emphasize the dynamic values in outputs - this makes the debug output much clearer Change-Id: I580b3af1479e2e38c5a44b50628e4c71d6b5d45f Reviewed-by: Karsten Heimrich Reviewed-by: Tim Jenssen --- tools/binarycreator/binarycreator.cpp | 50 +++++++++++++++++------------------ tools/common/repositorygen.cpp | 46 ++++++++++++++++---------------- 2 files changed, 48 insertions(+), 48 deletions(-) (limited to 'tools') diff --git a/tools/binarycreator/binarycreator.cpp b/tools/binarycreator/binarycreator.cpp index 31cc54652..043497ee3 100644 --- a/tools/binarycreator/binarycreator.cpp +++ b/tools/binarycreator/binarycreator.cpp @@ -183,7 +183,7 @@ Q_UNUSED(settings) QTemporaryFile file(input.outputPath); if (!file.open()) { - throw Error(QObject::tr("Could not copy %1 to %2: %3").arg(input.installerExePath, + throw Error(QString::fromLatin1("Could not copy %1 to %2: %3").arg(input.installerExePath, input.outputPath, file.errorString())); } @@ -193,7 +193,7 @@ Q_UNUSED(settings) QFile instExe(input.installerExePath); if (!instExe.copy(tempFile)) { - throw Error(QObject::tr("Could not copy %1 to %2: %3").arg(instExe.fileName(), tempFile, + throw Error(QString::fromLatin1("Could not copy %1 to %2: %3").arg(instExe.fileName(), tempFile, instExe.errorString())); } @@ -238,7 +238,7 @@ Q_UNUSED(settings) QFile exe(input.installerExePath); if (!exe.copy(input.outputPath)) { - throw Error(QObject::tr("Could not copy %1 to %2: %3").arg(exe.fileName(), input.outputPath, + throw Error(QString::fromLatin1("Could not copy %1 to %2: %3").arg(exe.fileName(), input.outputPath, exe.errorString())); } #else @@ -373,7 +373,7 @@ static QString createBinaryResourceFile(const QString &directory) { QTemporaryFile projectFile(directory + QLatin1String("/rccprojectXXXXXX.qrc")); if (!projectFile.open()) - throw Error(QObject::tr("Could not create temporary file for generated rcc project file")); + throw Error(QString::fromLatin1("Could not create temporary file for generated rcc project file")); projectFile.close(); const WorkingDirectoryChange wd(directory); @@ -485,7 +485,7 @@ static QString createMetaDataDirectory(const QInstallerTools::PackageInfoVector const QString target = targetFileInfo.absoluteFilePath(); if (!QFile::copy(source, target)) - throw Error(QObject::tr("Could not copy %1.").arg(source)); + throw Error(QString::fromLatin1("Could not copy %1.").arg(source)); if (sourceFileInfo.fileName() == QFileInfo(configFile).fileName()) { QFile configXml(targetDir.filePath(QLatin1String("config.xml"))); @@ -523,7 +523,7 @@ static QString createMetaDataDirectory(const QInstallerTools::PackageInfoVector if (!QFile::exists(targetDir.absoluteFilePath(newName))) { if (!QFile::copy(fi.absoluteFilePath(), targetDir.absoluteFilePath(newName))) - throw Error(QObject::tr("Could not copy %1.").arg(el.text())); + throw Error(QString::fromLatin1("Could not copy %1.").arg(el.text())); } el.removeChild(el.firstChild()); el.appendChild(dom.createTextNode(newName)); @@ -577,28 +577,28 @@ int main(int argc, char **argv) } else if (*it == QLatin1String("-p") || *it == QLatin1String("--packages")) { ++it; if (it == args.end()) { - return printErrorAndUsageAndExit(QObject::tr("Error: Packages parameter missing argument.")); + return printErrorAndUsageAndExit(QString::fromLatin1("Error: Packages parameter missing argument.")); } if (!QFileInfo(*it).exists()) { - return printErrorAndUsageAndExit(QObject::tr("Error: Package directory not found at the " + return printErrorAndUsageAndExit(QString::fromLatin1("Error: Package directory not found at the " "specified location.")); } packagesDirectory = *it; } else if (*it == QLatin1String("-e") || *it == QLatin1String("--exclude")) { ++it; if (!filteredPackages.isEmpty()) - return printErrorAndUsageAndExit(QObject::tr("Error: --include and --exclude are mutually " + return printErrorAndUsageAndExit(QString::fromLatin1("Error: --include and --exclude are mutually " "exclusive. Use either one or the other.")); if (it == args.end() || it->startsWith(QLatin1String("-"))) - return printErrorAndUsageAndExit(QObject::tr("Error: Package to exclude missing.")); + return printErrorAndUsageAndExit(QString::fromLatin1("Error: Package to exclude missing.")); filteredPackages = it->split(QLatin1Char(',')); } else if (*it == QLatin1String("-i") || *it == QLatin1String("--include")) { ++it; if (!filteredPackages.isEmpty()) - return printErrorAndUsageAndExit(QObject::tr("Error: --include and --exclude are mutually " + return printErrorAndUsageAndExit(QString::fromLatin1("Error: --include and --exclude are mutually " "exclusive. Use either one or the other.")); if (it == args.end() || it->startsWith(QLatin1String("-"))) - return printErrorAndUsageAndExit(QObject::tr("Error: Package to include missing.")); + return printErrorAndUsageAndExit(QString::fromLatin1("Error: Package to include missing.")); filteredPackages = it->split(QLatin1Char(',')); ftype = QInstallerTools::Include; } @@ -606,7 +606,7 @@ int main(int argc, char **argv) QInstaller::setVerbose(true); } else if (*it == QLatin1String("-n") || *it == QLatin1String("--online-only")) { if (!filteredPackages.isEmpty()) { - return printErrorAndUsageAndExit(QObject::tr("for the --include and --exclude case you also " + return printErrorAndUsageAndExit(QString::fromLatin1("for the --include and --exclude case you also " "have to ensure that online-only==false, as that means include nothing")); } filteredPackages.append(QLatin1String("XXXXXXXXXXXXXXXXX_online_XXXXXXXXXXXXXXXXX")); @@ -614,14 +614,14 @@ int main(int argc, char **argv) onlineOnly = true; } else if (*it == QLatin1String("-f") || *it == QLatin1String("--offline-only")) { if (onlineOnly) { - return printErrorAndUsageAndExit(QObject::tr("You cannot use --online-only and " + return printErrorAndUsageAndExit(QString::fromLatin1("You cannot use --online-only and " "--offline-only at the same time.")); } offlineOnly = true; } else if (*it == QLatin1String("-t") || *it == QLatin1String("--template")) { ++it; if (it == args.end()) { - return printErrorAndUsageAndExit(QObject::tr("Error: Template parameter missing argument.")); + return printErrorAndUsageAndExit(QString::fromLatin1("Error: Template parameter missing argument.")); } templateBinary = *it; #ifdef Q_OS_WIN @@ -629,38 +629,38 @@ int main(int argc, char **argv) templateBinary = templateBinary + suffix; #endif if (!QFileInfo(templateBinary).exists()) { - return printErrorAndUsageAndExit(QObject::tr("Error: Template not found at the specified " + return printErrorAndUsageAndExit(QString::fromLatin1("Error: Template not found at the specified " "location.")); } } else if (*it == QLatin1String("-c") || *it == QLatin1String("--config")) { ++it; if (it == args.end()) - return printErrorAndUsageAndExit(QObject::tr("Error: Config parameter missing argument.")); + return printErrorAndUsageAndExit(QString::fromLatin1("Error: Config parameter missing argument.")); const QFileInfo fi(*it); if (!fi.exists()) { - return printErrorAndUsageAndExit(QObject::tr("Error: Config file %1 not found at the " + return printErrorAndUsageAndExit(QString::fromLatin1("Error: Config file %1 not found at the " "specified location.").arg(*it)); } if (!fi.isFile()) { - return printErrorAndUsageAndExit(QObject::tr("Error: Configuration %1 is not a file.") + return printErrorAndUsageAndExit(QString::fromLatin1("Error: Configuration %1 is not a file.") .arg(*it)); } if (!fi.isReadable()) { - return printErrorAndUsageAndExit(QObject::tr("Error: Config file %1 is not readable.") + return printErrorAndUsageAndExit(QString::fromLatin1("Error: Config file %1 is not readable.") .arg(*it)); } configFile = *it; } else if (*it == QLatin1String("-r") || *it == QLatin1String("--resources")) { ++it; if (it == args.end() || it->startsWith(QLatin1String("-"))) - return printErrorAndUsageAndExit(QObject::tr("Error: Resource files to include are missing.")); + return printErrorAndUsageAndExit(QString::fromLatin1("Error: Resource files to include are missing.")); resources = it->split(QLatin1Char(',')); } else if (*it == QLatin1String("--ignore-translations") || *it == QLatin1String("--ignore-invalid-packages")) { continue; } else { if (it->startsWith(QLatin1String("-"))) { - return printErrorAndUsageAndExit(QObject::tr("Error: Unknown option \"%1\" used. Maybe you " + return printErrorAndUsageAndExit(QString::fromLatin1("Error: Unknown option \"%1\" used. Maybe you " "are using an old syntax.").arg(*it)); } else if (target.isEmpty()) { target = *it; @@ -669,7 +669,7 @@ int main(int argc, char **argv) target = target + suffix; #endif } else { - return printErrorAndUsageAndExit(QObject::tr("Error: You are using an old syntax please add the " + return printErrorAndUsageAndExit(QString::fromLatin1("Error: You are using an old syntax please add the " "component name with the include option") .arg(*it)); } @@ -677,10 +677,10 @@ int main(int argc, char **argv) } if (target.isEmpty()) - return printErrorAndUsageAndExit(QObject::tr("Error: Target parameter missing.")); + return printErrorAndUsageAndExit(QString::fromLatin1("Error: Target parameter missing.")); if (configFile.isEmpty()) - return printErrorAndUsageAndExit(QObject::tr("Error: No configuration file selected.")); + return printErrorAndUsageAndExit(QString::fromLatin1("Error: No configuration file selected.")); qDebug() << "Parsed arguments, ok."; diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp index 17305be34..dadb651f2 100644 --- a/tools/common/repositorygen.cpp +++ b/tools/common/repositorygen.cpp @@ -86,7 +86,7 @@ void QInstallerTools::compressMetaDirectories(const QString &repoDir) QFile tmp(tmpTarget); const QString finalTarget = absPath + QLatin1String("/") + fn; if (!tmp.rename(finalTarget)) { - throw QInstaller::Error(QObject::tr("Could not move %1 to %2").arg(tmpTarget, + throw QInstaller::Error(QString::fromLatin1("Could not move file from \"%1\" to \"%2\"").arg(tmpTarget, finalTarget)); } } @@ -148,7 +148,7 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt int col = 0; int line = 0; if (!packageXml.setContent(&file, &errMsg, &line, &col)) { - throw QInstaller::Error(QObject::tr("Could not parse %1: line: %2, column: %3: %4 (%5)") + throw QInstaller::Error(QString::fromLatin1("Could not parse \"%1\": line: %2, column: %3: %4 (%5)") .arg(packageXmlPath, QString::number(line), QString::number(col), errMsg, it->name)); } const QDomNode package = packageXml.firstChildElement(QLatin1String("Package")); @@ -228,7 +228,7 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt root.appendChild(update); if (!QDir(metapath).mkpath(it->name)) - throw QInstaller::Error(QObject::tr("Could not create directory %1.").arg(it->name)); + throw QInstaller::Error(QString::fromLatin1("Could not create directory \"%1\".").arg(it->name)); // copy scripts const QString script = package.firstChildElement(QLatin1String("Script")).text(); @@ -244,7 +244,7 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt static QScriptEngine testScriptEngine; testScriptEngine.evaluate(scriptContent, scriptFile.fileName()); if (testScriptEngine.hasUncaughtException()) { - throw QInstaller::Error(QObject::tr("Exception while loading the component script: %1") + throw QInstaller::Error(QString::fromLatin1("Exception while loading the component script: \"%1\"") .arg(QInstaller::uncaughtExceptionString(&testScriptEngine, scriptFile.fileName()))); } @@ -259,7 +259,7 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt QString toLocation(QString::fromLatin1("%1/%2/%3").arg(metapath, it->name, script)); if (!scriptFile.copy(toLocation)) { qDebug() << "failed!"; - throw QInstaller::Error(QObject::tr("Could not copy the script %1 to its target location %2.") + throw QInstaller::Error(QString::fromLatin1("Could not copy the script \"%1\" to its target location \"%2\".") .arg(fromLocation, toLocation)); } else { qDebug() << "\tdone."; @@ -277,7 +277,7 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt const QDir dir(QString::fromLatin1("%1/meta").arg(it->directory)); const QStringList uis = dir.entryList(QStringList(node.toElement().text()), QDir::Files); if (uis.isEmpty()) { - throw QInstaller::Error(QObject::tr("Couldn't find any user interface matching %1 while " + throw QInstaller::Error(QString::fromLatin1("Couldn't find any user interface matching %1 while " "copying user interfaces of %2.").arg(node.toElement().text(), it->name)); } @@ -287,7 +287,7 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt if (!QFile::copy(QString::fromLatin1("%1/meta/%2").arg(it->directory, *ui), QString::fromLatin1("%1/%2/%3").arg(metapath, it->name, *ui))) { qDebug() << "failed!"; - throw QInstaller::Error(QObject::tr("Could not copy the UI file %1 to its target " + throw QInstaller::Error(QString::fromLatin1("Could not copy the UI file %1 to its target " "location %2.").arg(*ui, it->name)); } else { qDebug() << "done"; @@ -312,8 +312,8 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt const QDir dir(QString::fromLatin1("%1/meta").arg(it->directory)); const QStringList qms = dir.entryList(QStringList(node.toElement().text()), QDir::Files); if (qms.isEmpty()) { - throw QInstaller::Error(QObject::tr("Could not find any translation file matching %1 " - "while copying translations of %2.").arg(node.toElement().text(), it->name)); + throw QInstaller::Error(QString::fromLatin1("Could not find any translation file matching \"%1\" " + "while copying translations of \"%2\".").arg(node.toElement().text(), it->name)); } for (QStringList::const_iterator qm = qms.begin(); qm != qms.end(); ++qm) { @@ -322,8 +322,8 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt if (!QFile::copy(QString::fromLatin1("%1/meta/%2").arg(it->directory, *qm), QString::fromLatin1("%1/%2/%3").arg(metapath, it->name, *qm))) { qDebug() << "failed!"; - throw QInstaller::Error(QObject::tr("Could not copy the translation %1 to its " - "target location %2.").arg(*qm, it->name)); + throw QInstaller::Error(QString::fromLatin1("Could not copy the translation \"%1\" to its " + "target location \"%2\".").arg(*qm, it->name)); } else { qDebug() << "done"; } @@ -347,7 +347,7 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt const QString &sourceFile = QString::fromLatin1("%1/meta/%2").arg(it->directory).arg(licenseFile); if (!QFile::exists(sourceFile)) { - throw QInstaller::Error(QObject::tr("Could not find any license matching %1 while " + throw QInstaller::Error(QString::fromLatin1("Could not find any license matching \"%1\" while " "copying license files of %2.").arg(licenseFile, it->name)); } @@ -355,7 +355,7 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt if (!QFile::copy(sourceFile, QString::fromLatin1("%1/%2/%3") .arg(metapath, it->name, licenseFile))) { qDebug() << "failed!"; - throw QInstaller::Error(QObject::tr("Could not copy the license file %1 to its " + throw QInstaller::Error(QString::fromLatin1("Could not copy the license file \"%1\" to its " "target location %2.").arg(licenseFile, it->name)); } else { qDebug() << "done."; @@ -419,12 +419,12 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesD if (!filteredPackages.contains(it->fileName())) continue; } - qDebug() << QString::fromLatin1("\tfound subdirectory %1").arg(it->fileName()); + qDebug() << QString::fromLatin1("\tfound subdirectory \"%1\"").arg(it->fileName()); // because the filter is QDir::Dirs - filename means the name of the subdirectory if (it->fileName().contains(QLatin1Char('-'))) { if (ignoreInvalidPackages) continue; - throw QInstaller::Error(QObject::tr("Component %1 can't contain '-'. This is not allowed, because " + throw QInstaller::Error(QString::fromLatin1("Component \"%1\" can't contain '-'. This is not allowed, because " "it is used as the separator between the component name and the version number internally.") .arg(it->fileName())); } @@ -434,8 +434,8 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesD if (!fileInfo.exists()) { if (ignoreInvalidPackages) continue; - throw QInstaller::Error(QObject::tr("Component %1 does not contain a package " - "description(meta/package.xml is missing).").arg(it->fileName())); + throw QInstaller::Error(QString::fromLatin1("Component \"%1\" does not contain a package " + "description (meta/package.xml is missing).").arg(it->fileName())); } file.open(QIODevice::ReadOnly); @@ -447,7 +447,7 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesD if (!doc.setContent(&file, &error, &errorLine, &errorColumn)) { if (ignoreInvalidPackages) continue; - throw QInstaller::Error(QObject::tr("Component package description in %1 is invalid. " + throw QInstaller::Error(QString::fromLatin1("Component package description in \"%1\" is invalid. " "Error at line: %2, column: %3 -> %4").arg(fileInfo.absoluteFilePath(), QString::number(errorLine), QString::number(errorColumn), error)); } @@ -455,7 +455,7 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesD const QString name = doc.firstChildElement(QLatin1String("Package")) .firstChildElement(QLatin1String("Name")).text(); if (!name.isEmpty() && name != it->fileName()) { - qWarning() << QString::fromLatin1("The tag in the %1 is ignored - the installer uses the " + qWarning() << QString::fromLatin1("The tag in the \"%1\" is ignored - the installer uses the " "path element right before the \"meta\" (\"%2\").").arg(fileInfo.absoluteFilePath(), it->fileName()); } @@ -466,7 +466,7 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QString &packagesD if (!QRegExp(QLatin1String("[0-9]+((\\.|-)[0-9]+)*")).exactMatch(info.version)) { if (ignoreInvalidPackages) continue; - throw QInstaller::Error(QObject::tr("Component version for %1 is invalid! %2") + throw QInstaller::Error(QString::fromLatin1("Component version for %1 is invalid! %2") .arg(fileInfo.absoluteFilePath(), info.version)); } info.dependencies = doc.firstChildElement(QLatin1String("Package")). @@ -546,7 +546,7 @@ void QInstallerTools::compressMetaDirectories(const QString &repoDir, const QStr writeSHA1ToNodeWithName(doc, elements, sha1Sum, path); const QString finalTarget = absPath + QLatin1String("/") + fn; if (!tmp.rename(finalTarget)) - throw QInstaller::Error(QObject::tr("Could not move %1 to %2").arg(tmpTarget, finalTarget)); + throw QInstaller::Error(QString::fromLatin1("Could not move %1 to %2").arg(tmpTarget, finalTarget)); } QInstaller::openForWrite(&existingUpdatesXml, existingUpdatesXml.fileName()); @@ -564,7 +564,7 @@ void QInstallerTools::copyComponentData(const QString &packageDir, const QString const QString namedRepoDir = QString::fromLatin1("%1/%2").arg(repoDir, name); if (!QDir().mkpath(namedRepoDir)) { - throw QInstaller::Error(QObject::tr("Could not create repository folder for component %1") + throw QInstaller::Error(QString::fromLatin1("Could not create repository folder for component %1") .arg(name)); } @@ -581,7 +581,7 @@ void QInstallerTools::copyComponentData(const QString &packageDir, const QString qDebug() << QString::fromLatin1("Copying archive from %1 to %2").arg(tmp.fileName(), target); if (!tmp.copy(target)) { - throw QInstaller::Error(QObject::tr("Could not copy %1 to %2: %3").arg(tmp.fileName(), + throw QInstaller::Error(QString::fromLatin1("Could not copy %1 to %2: %3").arg(tmp.fileName(), target, tmp.errorString())); } compressedFiles.append(target); -- cgit v1.2.3