From 0b92d6cc61a18ae18d254ac6ee463e74cb570db4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 1 Jun 2011 12:34:59 +0200 Subject: use a printErr() function instead of std::cerr like in lupdate --- tools/linguist/lrelease/main.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index b1beec8..8d2cf4a 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -55,8 +55,6 @@ #include #include -#include - QT_USE_NAMESPACE #ifdef QT_BOOTSTRAPPED @@ -84,6 +82,12 @@ static void printOut(const QString & out) stream << out; } +static void printErr(const QString & out) +{ + QTextStream stream(stderr); + stream << out; +} + static void printUsage() { printOut(LR::tr( @@ -119,7 +123,7 @@ static bool loadTsFile(Translator &tor, const QString &tsFileName, bool /* verbo ConversionData cd; bool ok = tor.load(tsFileName, cd, QLatin1String("auto")); if (!ok) { - std::cerr << qPrintable(LR::tr("lrelease error: %1").arg(cd.error())); + printErr(LR::tr("lrelease error: %1").arg(cd.error())); } else { if (!cd.errors().isEmpty()) printOut(cd.error()); @@ -143,7 +147,7 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName, QFile file(qmFileName); if (!file.open(QIODevice::WriteOnly)) { - std::cerr << qPrintable(LR::tr("lrelease error: cannot create '%1': %2\n") + printErr(LR::tr("lrelease error: cannot create '%1': %2\n") .arg(qmFileName, file.errorString())); return false; } @@ -153,7 +157,7 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName, file.close(); if (!ok) { - std::cerr << qPrintable(LR::tr("lrelease error: cannot save '%1': %2") + printErr(LR::tr("lrelease error: cannot save '%1': %2") .arg(qmFileName, cd.error())); } else if (!cd.errors().isEmpty()) { printOut(cd.error()); @@ -274,13 +278,13 @@ int main(int argc, char **argv) visitor.setVerbose(cd.isVerbose()); if (!visitor.queryProFile(&pro)) { - std::cerr << qPrintable(LR::tr( + printErr(LR::tr( "lrelease error: cannot read project file '%1'.\n") .arg(inputFile)); continue; } if (!visitor.accept(&pro)) { - std::cerr << qPrintable(LR::tr( + printErr(LR::tr( "lrelease error: cannot process project file '%1'.\n") .arg(inputFile)); continue; @@ -288,7 +292,7 @@ int main(int argc, char **argv) QStringList translations = visitor.values(QLatin1String("TRANSLATIONS")); if (translations.isEmpty()) { - std::cerr << qPrintable(LR::tr( + printErr(LR::tr( "lrelease warning: Met no 'TRANSLATIONS' entry in project file '%1'\n") .arg(inputFile)); } else { -- cgit v0.12