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 <hjk121@nokiamail.com>
This commit is contained in:
Kai Koehne 2014-07-15 14:33:13 +02:00 committed by hjk
parent edfac1a9ed
commit e46d72751b
2 changed files with 8 additions and 8 deletions

View File

@ -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;
}

View File

@ -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<int>(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());
}