From e46d72751ba8188dfc37ad0e8e76198525f8d1f2 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 15 Jul 2014 14:33:13 +0200 Subject: rcc: String literal conversion cleanup Replace QString::fromUtf8 with QString::fromLatin1 for ascii strings. Also optimize use of QT_VERSION_STR. Change-Id: I13c683499c56cb4ac4d2bbd9b6b53c337917e347 Reviewed-by: hjk --- src/tools/rcc/main.cpp | 6 +++--- src/tools/rcc/rcc.cpp | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/tools') diff --git a/src/tools/rcc/main.cpp b/src/tools/rcc/main.cpp index 0dcbcafb11..81beff8363 100644 --- a/src/tools/rcc/main.cpp +++ b/src/tools/rcc/main.cpp @@ -112,13 +112,13 @@ int createProject(const QString &outFileName) int runRcc(int argc, char *argv[]) { QCoreApplication app(argc, argv); - QCoreApplication::setApplicationVersion(QString::fromLatin1(QT_VERSION_STR)); + QCoreApplication::setApplicationVersion(QStringLiteral(QT_VERSION_STR)); // Note that rcc isn't translated. // If you use this code as an example for a translated app, make sure to translate the strings. QCommandLineParser parser; parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); - parser.setApplicationDescription(QStringLiteral("Qt Resource Compiler version %1").arg(QString::fromLatin1(QT_VERSION_STR))); + parser.setApplicationDescription(QLatin1String("Qt Resource Compiler version " QT_VERSION_STR)); parser.addHelpOption(); parser.addVersionOption(); @@ -266,7 +266,7 @@ int runRcc(int argc, char *argv[]) } else { out.setFileName(outFilename); if (!out.open(mode)) { - const QString msg = QString::fromUtf8("Unable to open %1 for writing: %2\n").arg(outFilename).arg(out.errorString()); + const QString msg = QString::fromLatin1("Unable to open %1 for writing: %2\n").arg(outFilename).arg(out.errorString()); errorDevice.write(msg.toUtf8()); return 1; } diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 3896f6c0e3..813ca518b7 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -86,7 +86,7 @@ void RCCResourceLibrary::writeByteArray(const QByteArray &other) static inline QString msgOpenReadFailed(const QString &fname, const QString &why) { - return QString::fromUtf8("Unable to open %1 for reading: %2\n").arg(fname).arg(why); + return QString::fromLatin1("Unable to open %1 for reading: %2\n").arg(fname).arg(why); } @@ -576,7 +576,7 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice, } if (m_root == 0) { - const QString msg = QString::fromUtf8("RCC: Warning: No resources in '%1'.\n").arg(fname); + const QString msg = QString::fromLatin1("RCC: Warning: No resources in '%1'.\n").arg(fname); m_errorDevice->write(msg.toUtf8()); if (!ignoreErrors && m_format == Binary) { // create dummy entry, otherwise loading with QResource will crash @@ -592,7 +592,7 @@ bool RCCResourceLibrary::addFile(const QString &alias, const RCCFileInfo &file) { Q_ASSERT(m_errorDevice); if (file.m_fileInfo.size() > 0xffffffff) { - const QString msg = QString::fromUtf8("File too big: %1\n").arg(file.m_fileInfo.absoluteFilePath()); + const QString msg = QString::fromLatin1("File too big: %1\n").arg(file.m_fileInfo.absoluteFilePath()); m_errorDevice->write(msg.toUtf8()); return false; } @@ -644,7 +644,7 @@ bool RCCResourceLibrary::readFiles(bool ignoreErrors, QIODevice &errorDevice) m_errorDevice = &errorDevice; //read in data if (m_verbose) { - const QString msg = QString::fromUtf8("Processing %1 files [%2]\n") + const QString msg = QString::fromLatin1("Processing %1 files [%2]\n") .arg(m_fileNames.size()).arg(static_cast(ignoreErrors)); m_errorDevice->write(msg.toUtf8()); } @@ -669,7 +669,7 @@ bool RCCResourceLibrary::readFiles(bool ignoreErrors, QIODevice &errorDevice) } } if (m_verbose) { - const QString msg = QString::fromUtf8("Interpreting %1\n").arg(fname); + const QString msg = QString::fromLatin1("Interpreting %1\n").arg(fname); m_errorDevice->write(msg.toUtf8()); } -- cgit v1.2.3