diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-09-25 16:21:38 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-28 18:50:07 +0200 |
commit | f52b793fc2031b3e3ddfc110ef6be5fe913b8c67 (patch) | |
tree | a23a521ddd4f7804ac8fddc8aae14752f33796d5 /tools/qmlimportscanner | |
parent | 9ecedb87663d38171ec71fcebe9cd71b130ee224 (diff) |
qmlimportscanner: Use iostream for output consistently.
host-built tools should not use <QDebug>.
Change-Id: I2c69c79c138689d22f4979e268313fb461a8053a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'tools/qmlimportscanner')
-rw-r--r-- | tools/qmlimportscanner/main.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/tools/qmlimportscanner/main.cpp b/tools/qmlimportscanner/main.cpp index 50d8ce5322..598be20b70 100644 --- a/tools/qmlimportscanner/main.cpp +++ b/tools/qmlimportscanner/main.cpp @@ -58,7 +58,6 @@ #include <QtCore/QJsonArray> #include <QtCore/QJsonDocument> #include <QtCore/QLibraryInfo> -#include <QtCore/QDebug> #include <iostream> @@ -68,7 +67,7 @@ QStringList g_qmlImportPaths; void printUsage(const QString &appName) { - qWarning() << qPrintable(QString::fromLatin1( + std::cerr << qPrintable(QString::fromLatin1( "Usage: %1 -rootPath qmldir -importPath importPath \n" "Example: %1 -rootPath qmldir -importPath importPath").arg( appName)); @@ -115,7 +114,8 @@ QVariantList findImportsInAst(QQmlJS::AST::UiHeaderItemList *headerItemList, con QVariantList findQmlImportsInFile(const QString &qmlFilePath) { QFile qmlFile(qmlFilePath); if (!qmlFile.open(QIODevice::ReadOnly)) { - std::cerr << "Cannot open input file " << qPrintable(qmlFile.fileName()) << std::endl; + std::cerr << "Cannot open input file " << qPrintable(QDir::toNativeSeparators(qmlFile.fileName())) + << ':' << qPrintable(qmlFile.errorString()) << std::endl; return QVariantList(); } QByteArray code = qmlFile.readAll(); @@ -128,11 +128,7 @@ QVariantList findQmlImportsInFile(const QString &qmlFilePath) { if (!parser.parse() || !parser.diagnosticMessages().isEmpty()) { // Extract errors from the parser foreach (const QQmlJS::DiagnosticMessage &m, parser.diagnosticMessages()) { - if (m.isWarning()) { - qWarning("%s:%d : %s", qPrintable(qmlFile.fileName()), m.loc.startLine, qPrintable(m.message)); - continue; - } - std::cerr << qPrintable(qmlFile.fileName()) << ':' + std::cerr << qPrintable(QDir::toNativeSeparators(qmlFile.fileName())) << ':' << m.loc.startLine << ':' << qPrintable(m.message) << std::endl; } return QVariantList(); @@ -287,7 +283,7 @@ int main(int argc, char *argv[]) qmlRootPaths += arg; } else if (arg == QLatin1String("-rootPath")) { if (i >= args.count()) - qWarning() << "-rootPath requires an argument"; + std::cerr << "-rootPath requires an argument\n"; while (i < args.count()) { const QString arg = args.at(i); @@ -298,7 +294,7 @@ int main(int argc, char *argv[]) } } else if (arg == QLatin1String("-importPath")) { if (i >= args.count()) - qWarning() << "-importPath requires an argument"; + std::cerr << "-importPath requires an argument\n"; while (i < args.count()) { const QString arg = args.at(i); @@ -308,7 +304,7 @@ int main(int argc, char *argv[]) qmlImportPaths += arg; } } else { - qWarning() << "Invalid argument: " << arg; + std::cerr << "Invalid argument: \"" << qPrintable(arg) << "\"\n"; return 1; } } |