summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-05-28 08:27:50 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-05-28 08:31:07 (GMT)
commitf390f9b51cf8686e9ed44f13a33c7349b9e96a09 (patch)
tree162c768769713a7215bca64daf8f2bdc75c9fbee /src/tools
parent0bb0699d403b7541472a72a4057ecf0ca366a7cd (diff)
downloadQt-f390f9b51cf8686e9ed44f13a33c7349b9e96a09.zip
Qt-f390f9b51cf8686e9ed44f13a33c7349b9e96a09.tar.gz
Qt-f390f9b51cf8686e9ed44f13a33c7349b9e96a09.tar.bz2
improved string operations all over the place
used character operations whenever possible better usage of QLatin1String
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/idc/main.cpp6
-rw-r--r--src/tools/moc/generator.cpp4
-rw-r--r--src/tools/moc/moc.cpp6
-rw-r--r--src/tools/moc/preprocessor.cpp2
-rw-r--r--src/tools/uic/cpp/cppwriteicondata.cpp4
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp6
-rw-r--r--src/tools/uic3/embed.cpp2
-rw-r--r--src/tools/uic3/form.cpp84
-rw-r--r--src/tools/uic3/main.cpp2
-rw-r--r--src/tools/uic3/parser.cpp12
-rw-r--r--src/tools/uic3/qt3to4.cpp2
-rw-r--r--src/tools/uic3/subclassing.cpp36
-rw-r--r--src/tools/uic3/ui3reader.cpp24
13 files changed, 95 insertions, 95 deletions
diff --git a/src/tools/idc/main.cpp b/src/tools/idc/main.cpp
index eb04114..8d2f0cc 100644
--- a/src/tools/idc/main.cpp
+++ b/src/tools/idc/main.cpp
@@ -50,8 +50,8 @@ QT_BEGIN_NAMESPACE
static QString quotePath(const QString &s)
{
- if (!s.startsWith(QLatin1String("\"")) && s.contains(QLatin1Char(' ')))
- return QLatin1String("\"") + s + QLatin1String("\"");
+ if (!s.startsWith(QLatin1Char('\"')) && s.contains(QLatin1Char(' ')))
+ return QLatin1Char('\"') + s + QLatin1Char('\"');
return s;
}
@@ -282,7 +282,7 @@ int runIdc(int argc, char **argv)
fprintf(stderr, "Server unregistered successfully!\n");
return 0;
} else if (p[0] == QLatin1Char('/') || p[0] == QLatin1Char('-')) {
- error = QLatin1String("Unknown option \"") + p + QLatin1String("\"");
+ error = QLatin1String("Unknown option \"") + p + QLatin1Char('\"');
break;
} else {
input = QLatin1String(argv[i]);
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index ae8a76e..e94bb77 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -1161,8 +1161,8 @@ void Generator::_generateFunctions(QList<FunctionDef> &list, int type)
for (int j = 0; j < f.arguments.count(); ++j) {
const ArgumentDef &a = f.arguments.at(j);
if (j) {
- sig += ",";
- arguments += ",";
+ sig += ',';
+ arguments += ',';
}
sig += a.normalizedType;
arguments += a.name;
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index a6a0ba1..8ca2823 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -752,14 +752,14 @@ void Moc::generate(FILE *out)
if (!noInclude) {
- if (includePath.size() && includePath.right(1) != "/")
- includePath += "/";
+ if (includePath.size() && !includePath.endsWith('/'))
+ includePath += '/';
for (int i = 0; i < includeFiles.size(); ++i) {
QByteArray inc = includeFiles.at(i);
if (inc[0] != '<' && inc[0] != '"') {
if (includePath.size() && includePath != "./")
inc.prepend(includePath);
- inc = "\"" + inc + "\"";
+ inc = '\"' + inc + '\"';
}
fprintf(out, "#include %s\n", inc.constData());
}
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index 45cbbfd..3260ca2 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -807,7 +807,7 @@ void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed)
continue;
QByteArray frameworkCandidate = include.left(slashPos);
frameworkCandidate.append(".framework/Headers/");
- fi.setFile(QString::fromLocal8Bit(p.path + "/" + frameworkCandidate), QString::fromLocal8Bit(include.mid(slashPos + 1)));
+ fi.setFile(QString::fromLocal8Bit(p.path + '/' + frameworkCandidate), QString::fromLocal8Bit(include.mid(slashPos + 1)));
} else {
fi.setFile(QString::fromLocal8Bit(p.path), QString::fromLocal8Bit(include));
}
diff --git a/src/tools/uic/cpp/cppwriteicondata.cpp b/src/tools/uic/cpp/cppwriteicondata.cpp
index 53b108f..08d552d 100644
--- a/src/tools/uic/cpp/cppwriteicondata.cpp
+++ b/src/tools/uic/cpp/cppwriteicondata.cpp
@@ -161,9 +161,9 @@ void WriteIconData::writeImage(QTextStream &output, const QString &indent, DomIm
for (a = 0; a < (int) (data.length()/2)-1; a++) {
output << "0x" << QString(data[2*a]) << QString(data[2*a+1]) << ',';
if (a % 12 == 11)
- output << "\n" << indent;
+ output << '\n' << indent;
else
- output << " ";
+ output << ' ';
}
output << "0x" << QString(data[2*a]) << QString(data[2*a+1]) << '\n';
output << "};\n\n";
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index 47566ad..5a2f487 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -2813,7 +2813,7 @@ QString WriteInitialization::Item::writeSetupUi(const QString &parent, Item::Emp
bool generateMultiDirective = false;
if (emptyItemPolicy == Item::ConstructItemOnly && m_children.size() == 0) {
if (m_setupUiData.policy == ItemData::DontGenerate) {
- m_setupUiStream << m_indent << "new " << m_itemClassName << "(" << parent << ");\n";
+ m_setupUiStream << m_indent << "new " << m_itemClassName << '(' << parent << ");\n";
return QString();
} else if (m_setupUiData.policy == ItemData::GenerateWithMultiDirective) {
generateMultiDirective = true;
@@ -2824,11 +2824,11 @@ QString WriteInitialization::Item::writeSetupUi(const QString &parent, Item::Emp
generateMultiDirectiveBegin(m_setupUiStream, m_setupUiData.directives);
const QString uniqueName = m_driver->unique(QLatin1String("__") + m_itemClassName.toLower());
- m_setupUiStream << m_indent << m_itemClassName << " *" << uniqueName << " = new " << m_itemClassName << "(" << parent << ");\n";
+ m_setupUiStream << m_indent << m_itemClassName << " *" << uniqueName << " = new " << m_itemClassName << '(' << parent << ");\n";
if (generateMultiDirective) {
m_setupUiStream << "#else\n";
- m_setupUiStream << m_indent << "new " << m_itemClassName << "(" << parent << ");\n";
+ m_setupUiStream << m_indent << "new " << m_itemClassName << '(' << parent << ");\n";
generateMultiDirectiveEnd(m_setupUiStream, m_setupUiData.directives);
}
diff --git a/src/tools/uic3/embed.cpp b/src/tools/uic3/embed.cpp
index 882328a..b406c1f 100644
--- a/src/tools/uic3/embed.cpp
+++ b/src/tools/uic3/embed.cpp
@@ -238,7 +238,7 @@ void Ui3Reader::embed(const char *project, const QStringList &images)
out << "true, ";
else
out << "false, ";
- out << "\"" << e->name << "\" },\n";
+ out << '\"' << e->name << "\" },\n";
delete e;
}
#ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
diff --git a/src/tools/uic3/form.cpp b/src/tools/uic3/form.cpp
index d9e968b..b484210 100644
--- a/src/tools/uic3/form.cpp
+++ b/src/tools/uic3/form.cpp
@@ -185,14 +185,14 @@ void Ui3Reader::createFormDecl(const QDomElement &e, bool implicitIncludes)
for (it = globalIncludes.constBegin(); it != globalIncludes.constEnd(); ++it) {
if (!(*it).isEmpty()) {
QString header = fixHeaderName(*it);
- out << "#include <" << header << ">" << endl;
+ out << "#include <" << header << '>' << endl;
}
}
localIncludes = unique(localIncludes);
for (it = localIncludes.constBegin(); it != localIncludes.constEnd(); ++it) {
if (!(*it).isEmpty()) {
QString header = fixHeaderName(*it);
- out << "#include \"" << header << "\"" << endl;
+ out << "#include \"" << header << '\"' << endl;
}
}
out << endl;
@@ -216,7 +216,7 @@ void Ui3Reader::createFormDecl(const QDomElement &e, bool implicitIncludes)
typeDefs = unique(typeDefs);
for (it = typeDefs.constBegin(); it != typeDefs.constEnd(); ++it) {
if (!(*it).isEmpty())
- out << "typedef " << *it << ";" << endl;
+ out << "typedef " << *it << ';' << endl;
}
nl = e.parentNode().toElement().elementsByTagName(QLatin1String("forward"));
@@ -236,17 +236,17 @@ void Ui3Reader::createFormDecl(const QDomElement &e, bool implicitIncludes)
out << "namespace " << *ns << " {" << endl;
++ns;
}
- out << "class " << forwardName << ";" << endl;
+ out << "class " << forwardName << ';' << endl;
for (int i = 0; i < (int) forwardNamespaces.count(); i++)
- out << "}" << endl;
+ out << '}' << endl;
}
}
for (it = forwardDecl2.constBegin(); it != forwardDecl2.constEnd(); ++it) {
QString fd = *it;
fd = fd.trimmed();
- if (!fd.endsWith(QLatin1String(";")))
- fd += QLatin1String(";");
+ if (!fd.endsWith(QLatin1Char(';')))
+ fd += QLatin1Char(';');
out << fd << endl;
}
@@ -279,7 +279,7 @@ void Ui3Reader::createWrapperDecl(const QDomElement &e, const QString &converted
out << "#ifndef " << protector << endl;
out << "#define " << protector << endl;
out << endl;
- out << "#include \"" << convertedUiFile << "\"" << endl;
+ out << "#include \"" << convertedUiFile << '\"' << endl;
createWrapperDeclContents(e);
out << endl;
@@ -309,8 +309,8 @@ void Ui3Reader::createWrapperDeclContents(const QDomElement &e)
out << "class ";
if (!exportMacro.isEmpty())
- out << exportMacro << " ";
- out << bareNameOfClass << " : public " << objClass << ", public Ui::" << bareNameOfClass << endl << "{" << endl;
+ out << exportMacro << ' ';
+ out << bareNameOfClass << " : public " << objClass << ", public Ui::" << bareNameOfClass << endl << '{' << endl;
/* qmake ignore Q_OBJECT */
out << " Q_OBJECT" << endl;
@@ -362,8 +362,8 @@ void Ui3Reader::createWrapperDeclContents(const QDomElement &e)
continue;
QString returnType = n.attribute(QLatin1String("returnType"), QLatin1String("void"));
QString functionName = n.firstChild().toText().data().trimmed();
- if (functionName.endsWith(QLatin1String(";")))
- functionName = functionName.left(functionName.length() - 1);
+ if (functionName.endsWith(QLatin1Char(';')))
+ functionName.chop(1);
QString specifier = n.attribute(QLatin1String("specifier"));
QString access = n.attribute(QLatin1String("access"));
if (access == QLatin1String(QLatin1String("protected"))) {
@@ -394,8 +394,8 @@ void Ui3Reader::createWrapperDeclContents(const QDomElement &e)
continue;
QString returnType = n.attribute(QLatin1String("returnType"), QLatin1String("void"));
QString functionName = n.firstChild().toText().data().trimmed();
- if (functionName.endsWith(QLatin1String(";")))
- functionName = functionName.left(functionName.length() - 1);
+ if (functionName.endsWith(QLatin1Char(';')))
+ functionName.chop(1);
QString specifier = n.attribute(QLatin1String("specifier"));
QString access = n.attribute(QLatin1String("access"));
if (access == QLatin1String("protected")) {
@@ -423,8 +423,8 @@ void Ui3Reader::createWrapperDeclContents(const QDomElement &e)
// continue;
QString access = n.attribute(QLatin1String("access"), QLatin1String("protected"));
QString var = fixDeclaration(n.firstChild().toText().data().trimmed());
- if (!var.endsWith(QLatin1String(";")))
- var += QLatin1String(";");
+ if (!var.endsWith(QLatin1Char(';')))
+ var += QLatin1Char(';');
if (access == QLatin1String("public"))
publicVars += var;
else if (access == QLatin1String("private"))
@@ -458,7 +458,7 @@ void Ui3Reader::createWrapperDeclContents(const QDomElement &e)
if (n.attribute(QLatin1String("language"), QLatin1String("C++")) != QLatin1String("C++"))
continue;
QString sigName = n.firstChild().toText().data().trimmed();
- if (sigName.endsWith(QLatin1String(";")))
+ if (sigName.endsWith(QLatin1Char(';')))
sigName = sigName.left(sigName.length() - 1);
extraSignals += fixDeclaration(sigName);
}
@@ -467,7 +467,7 @@ void Ui3Reader::createWrapperDeclContents(const QDomElement &e)
if (!extraSignals.isEmpty()) {
out << "signals:" << endl;
for (it = extraSignals.constBegin(); it != extraSignals.constEnd(); ++it)
- out << " void " << (*it) << ";" << endl;
+ out << " void " << (*it) << ';' << endl;
out << endl;
}
@@ -513,7 +513,7 @@ void Ui3Reader::createWrapperDeclContents(const QDomElement &e)
out << "};" << endl;
for (i = 0; i < (int) namespaces.count(); i++)
- out << "}" << endl;
+ out << '}' << endl;
out << endl;
}
@@ -543,7 +543,7 @@ void Ui3Reader::writeFunctionsDecl(const QStringList &fuLst, const QStringList &
signature = fixDeclaration(signature);
type = fixType(type);
- out << " " << specifier << type << " " << signature << pure << ";" << endl;
+ out << " " << specifier << type << ' ' << signature << pure << ';' << endl;
}
out << endl;
}
@@ -583,8 +583,8 @@ void Ui3Reader::createFormImpl(const QDomElement &e)
if (n.attribute(QLatin1String("language"), QLatin1String("C++")) != QLatin1String("C++"))
continue;
QString functionName = n.firstChild().toText().data().trimmed();
- if (functionName.endsWith(QLatin1String(";")))
- functionName = functionName.left(functionName.length() - 1);
+ if (functionName.endsWith(QLatin1Char(';')))
+ functionName.chop(1);
extraFuncts += functionName;
extraFunctTyp += n.attribute(QLatin1String("returnType"), QLatin1String("void"));
extraFunctSpecifier += n.attribute(QLatin1String("specifier"), QLatin1String("virtual"));
@@ -598,8 +598,8 @@ void Ui3Reader::createFormImpl(const QDomElement &e)
if (n.attribute(QLatin1String("language"), QLatin1String("C++")) != QLatin1String("C++"))
continue;
QString functionName = n.firstChild().toText().data().trimmed();
- if (functionName.endsWith(QLatin1String(";")))
- functionName = functionName.left(functionName.length() - 1);
+ if (functionName.endsWith(QLatin1Char(';')))
+ functionName.chop(1);
extraFuncts += functionName;
extraFunctTyp += n.attribute(QLatin1String("returnType"), QLatin1String("void"));
extraFunctSpecifier += n.attribute(QLatin1String("specifier"), QLatin1String("virtual"));
@@ -663,7 +663,7 @@ void Ui3Reader::createFormImpl(const QDomElement &e)
globalIncludes = unique(globalIncludes);
for (it = globalIncludes.begin(); it != globalIncludes.end(); ++it) {
if (!(*it).isEmpty())
- out << "#include <" << fixHeaderName(*it) << ">" << endl;
+ out << "#include <" << fixHeaderName(*it) << '>' << endl;
}
if (externPixmaps) {
@@ -677,14 +677,14 @@ void Ui3Reader::createFormImpl(const QDomElement &e)
localIncludes = unique(localIncludes);
for (it = localIncludes.begin(); it != localIncludes.end(); ++it) {
if (!(*it).isEmpty() && *it != QFileInfo(fileName + QLatin1String(".h")).fileName())
- out << "#include \"" << fixHeaderName(*it) << "\"" << endl;
+ out << "#include \"" << fixHeaderName(*it) << '\"' << endl;
}
QString uiDotH = fileName + QLatin1String(".h");
if (QFile::exists(uiDotH)) {
if (!outputFileName.isEmpty())
uiDotH = QString::fromUtf8(combinePath(uiDotH.ascii(), outputFileName.ascii()));
- out << "#include \"" << uiDotH << "\"" << endl;
+ out << "#include \"" << uiDotH << '\"' << endl;
writeFunctImpl = false;
}
@@ -702,7 +702,7 @@ void Ui3Reader::createFormImpl(const QDomElement &e)
out << " * name 'name' and widget flags set to 'f'." << endl;
out << " *" << endl;
out << " * The " << objClass.mid(1).toLower() << " will by default be modeless, unless you set 'modal' to" << endl;
- out << " * true to construct a modal " << objClass.mid(1).toLower() << "." << endl;
+ out << " * true to construct a modal " << objClass.mid(1).toLower() << '.' << endl;
out << " */" << endl;
out << nameOfClass << "::" << bareNameOfClass << "(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)" << endl;
out << " : " << objClass << "(parent, name, modal, fl)";
@@ -733,7 +733,7 @@ void Ui3Reader::createFormImpl(const QDomElement &e)
out << endl;
- out << "{" << endl;
+ out << '{' << endl;
//
// setup the gui
@@ -775,7 +775,7 @@ void Ui3Reader::createFormImpl(const QDomElement &e)
out << indent << "init();" << endl;
// end of constructor
- out << "}" << endl;
+ out << '}' << endl;
out << endl;
// destructor
@@ -783,11 +783,11 @@ void Ui3Reader::createFormImpl(const QDomElement &e)
out << " * Destroys the object and frees any allocated resources" << endl;
out << " */" << endl;
out << nameOfClass << "::~" << bareNameOfClass << "()" << endl;
- out << "{" << endl;
+ out << '{' << endl;
if (extraFuncts.contains(QLatin1String("destroy()")))
out << indent << "destroy();" << endl;
out << indent << "// no need to delete child widgets, Qt does it all for us" << endl;
- out << "}" << endl;
+ out << '}' << endl;
out << endl;
// handle application events if required
@@ -816,9 +816,9 @@ void Ui3Reader::createFormImpl(const QDomElement &e)
out << " * language." << endl;
out << " */" << endl;
out << "void " << nameOfClass << "::languageChange()" << endl;
- out << "{" << endl;
+ out << '{' << endl;
out << " retranslateUi(this);" << endl;
- out << "}" << endl;
+ out << '}' << endl;
out << endl;
// create stubs for additional slots if necessary
@@ -833,8 +833,8 @@ void Ui3Reader::createFormImpl(const QDomElement &e)
type = type.simplified();
QString fname = fixDeclaration(Parser::cleanArgs(*it));
if (!(*it3).startsWith(QLatin1String("pure"))) { // "pure virtual" or "pureVirtual"
- out << type << " " << nameOfClass << "::" << fname << endl;
- out << "{" << endl;
+ out << type << ' ' << nameOfClass << "::" << fname << endl;
+ out << '{' << endl;
if (*it != QLatin1String("init()") && *it != QLatin1String("destroy()")) {
QRegExp numeric(QLatin1String("^(?:signed|unsigned|u?char|u?short|u?int"
"|u?long|Q_U?INT(?:8|16|32)|Q_U?LONG|float"
@@ -868,14 +868,14 @@ void Ui3Reader::createFormImpl(const QDomElement &e)
if (type == QLatin1String("bool")) {
retVal = QLatin1String("false");
- } else if (isBasicNumericType || type.endsWith(QLatin1String("*"))) {
+ } else if (isBasicNumericType || type.endsWith(QLatin1Char('*'))) {
retVal = QLatin1String("0");
- } else if (type.endsWith(QLatin1String("&"))) {
+ } else if (type.endsWith(QLatin1Char('&'))) {
do {
type.chop(1);
- } while (type.endsWith(QLatin1String(" ")));
+ } while (type.endsWith(QLatin1Char(' ')));
retVal = QLatin1String("uic_temp_var");
- out << indent << "static " << type << " " << retVal << ";" << endl;
+ out << indent << "static " << type << ' ' << retVal << ';' << endl;
} else {
retVal = type + QLatin1String("()");
}
@@ -883,9 +883,9 @@ void Ui3Reader::createFormImpl(const QDomElement &e)
out << indent << "qWarning(\"" << nameOfClass << "::" << fname << ": Not implemented yet\");" << endl;
if (!retVal.isEmpty())
- out << indent << "return " << retVal << ";" << endl;
+ out << indent << "return " << retVal << ';' << endl;
}
- out << "}" << endl;
+ out << '}' << endl;
out << endl;
}
++it;
diff --git a/src/tools/uic3/main.cpp b/src/tools/uic3/main.cpp
index d581016..9535b91 100644
--- a/src/tools/uic3/main.cpp
+++ b/src/tools/uic3/main.cpp
@@ -367,7 +367,7 @@ int runUic3(int argc, char * argv[])
}
if (headerFile) {
- out << "#include \"" << headerFile << "\"" << endl << endl;
+ out << "#include \"" << headerFile << '\"' << endl << endl;
}
QString convertedUi;
diff --git a/src/tools/uic3/parser.cpp b/src/tools/uic3/parser.cpp
index 744dd30..395cc4d 100644
--- a/src/tools/uic3/parser.cpp
+++ b/src/tools/uic3/parser.cpp
@@ -48,14 +48,14 @@ QT_BEGIN_NAMESPACE
QString Parser::cleanArgs(const QString &func)
{
QString slot(func);
- int begin = slot.indexOf(QLatin1String("(")) + 1;
+ int begin = slot.indexOf(QLatin1Char('(')) + 1;
QString args = slot.mid(begin);
- args = args.left(args.indexOf(QLatin1String(")")));
+ args = args.left(args.indexOf(QLatin1Char(')')));
QStringList lst = args.split(QLatin1Char(','));
QString res = slot.left(begin);
for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it) {
if (it != lst.begin())
- res += QLatin1String(",");
+ res += QLatin1Char(',');
QString arg = *it;
int pos = 0;
if ((pos = arg.indexOf(QLatin1Char('&'))) != -1) {
@@ -65,7 +65,7 @@ QString Parser::cleanArgs(const QString &func)
} else {
arg = arg.simplified();
if ((pos = arg.indexOf(QLatin1Char(':'))) != -1)
- arg = arg.left(pos).simplified() + QLatin1String(":") + arg.mid(pos + 1).simplified();
+ arg = arg.left(pos).simplified() + QLatin1Char(':') + arg.mid(pos + 1).simplified();
QStringList l = arg.split(QLatin1Char(' '));
if (l.count() == 2) {
if (l[0] != QLatin1String("const")
@@ -73,12 +73,12 @@ QString Parser::cleanArgs(const QString &func)
&& l[0] != QLatin1String("var"))
arg = l[0];
} else if (l.count() == 3) {
- arg = l[0] + QLatin1String(" ") + l[1];
+ arg = l[0] + QLatin1Char(' ') + l[1];
}
}
res += arg;
}
- res += QLatin1String(")");
+ res += QLatin1Char(')');
return res;
}
diff --git a/src/tools/uic3/qt3to4.cpp b/src/tools/uic3/qt3to4.cpp
index 9e5b64b..2862727 100644
--- a/src/tools/uic3/qt3to4.cpp
+++ b/src/tools/uic3/qt3to4.cpp
@@ -149,7 +149,7 @@ void Porting::readXML(RuleList *renamedHeaders, RuleList *renamedClasses, RuleLi
QString fileName = QLatin1String("q3porting.xml");
QString filePath;
//check QLibraryInfo::DataPath/filename
- filePath = QDir::cleanPath(QLibraryInfo::location(QLibraryInfo::DataPath) + QLatin1String("/") + fileName) ;
+ filePath = QDir::cleanPath(QLibraryInfo::location(QLibraryInfo::DataPath) + QLatin1Char('/') + fileName) ;
//check QLibraryInfo::PrefixPath/tools/porting/src/filename
if (!QFile::exists(filePath))
diff --git a/src/tools/uic3/subclassing.cpp b/src/tools/uic3/subclassing.cpp
index e590ab7..85c2218 100644
--- a/src/tools/uic3/subclassing.cpp
+++ b/src/tools/uic3/subclassing.cpp
@@ -69,7 +69,7 @@ void Ui3Reader::createSubDecl( const QDomElement &e, const QString& subClass )
return;
out << "class " << subClass << " : public " << nameOfClass << endl;
- out << "{" << endl;
+ out << '{' << endl;
/* tmake ignore Q_OBJECT */
out << " Q_OBJECT" << endl;
@@ -105,8 +105,8 @@ void Ui3Reader::createSubDecl( const QDomElement &e, const QString& subClass )
continue;
QString returnType = n.attribute(QLatin1String("returnType"), QLatin1String("void"));
QString functionName = n.firstChild().toText().data().trimmed();
- if ( functionName.endsWith(QLatin1String(";")))
- functionName = functionName.left( functionName.length() - 1 );
+ if ( functionName.endsWith(QLatin1Char(';')))
+ functionName.chop(1);
QString specifier = n.attribute(QLatin1String("specifier"));
QString access = n.attribute(QLatin1String("access"));
if ( access == QLatin1String("protected") ) {
@@ -133,8 +133,8 @@ void Ui3Reader::createSubDecl( const QDomElement &e, const QString& subClass )
continue;
QString returnType = n.attribute(QLatin1String("returnType"), QLatin1String("void"));
QString functionName = n.firstChild().toText().data().trimmed();
- if ( functionName.endsWith(QLatin1String(";")) )
- functionName = functionName.left( functionName.length() - 1 );
+ if ( functionName.endsWith(QLatin1Char(';')) )
+ functionName.chop(1);
QString specifier = n.attribute(QLatin1String("specifier"));
QString access = n.attribute(QLatin1String("access"));
if ( access == QLatin1String("protected") ) {
@@ -195,7 +195,7 @@ void Ui3Reader::writeFunctionsSubDecl( const QStringList &fuLst, const QStringLi
type = QLatin1String("void");
if ( *it3 == QLatin1String("non virtual") )
continue;
- out << " " << type << " " << fixDeclaration(*it) << ";" << endl;
+ out << " " << type << ' ' << fixDeclaration(*it) << ';' << endl;
}
out << endl;
}
@@ -223,7 +223,7 @@ void Ui3Reader::createSubImpl( const QDomElement &e, const QString& subClass )
out << " * name 'name' and widget flags set to 'f' " << endl;
out << " *" << endl;
out << " * The " << objClass.mid(1).toLower() << " will by default be modeless, unless you set 'modal' to" << endl;
- out << " * true to construct a modal " << objClass.mid(1).toLower() << "." << endl;
+ out << " * true to construct a modal " << objClass.mid(1).toLower() << '.' << endl;
out << " */" << endl;
out << subClass << "::" << subClass << "( QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl )" << endl;
out << " : " << nameOfClass << "( parent, name, modal, fl )" << endl;
@@ -235,8 +235,8 @@ void Ui3Reader::createSubImpl( const QDomElement &e, const QString& subClass )
out << subClass << "::" << subClass << "( QWidget* parent, const char* name, Qt::WindowFlags fl )" << endl;
out << " : " << nameOfClass << "( parent, name, fl )" << endl;
}
- out << "{" << endl;
- out << "}" << endl;
+ out << '{' << endl;
+ out << '}' << endl;
out << endl;
// destructor
@@ -244,9 +244,9 @@ void Ui3Reader::createSubImpl( const QDomElement &e, const QString& subClass )
out << " * Destroys the object and frees any allocated resources" << endl;
out << " */" << endl;
out << subClass << "::~" << subClass << "()" << endl;
- out << "{" << endl;
+ out << '{' << endl;
out << " // no need to delete child widgets, Qt does it all for us" << endl;
- out << "}" << endl;
+ out << '}' << endl;
out << endl;
@@ -268,8 +268,8 @@ void Ui3Reader::createSubImpl( const QDomElement &e, const QString& subClass )
continue;
QString returnType = n.attribute(QLatin1String("returnType"), QLatin1String("void"));
QString functionName = n.firstChild().toText().data().trimmed();
- if ( functionName.endsWith(QLatin1String(";")) )
- functionName = functionName.left( functionName.length() - 1 );
+ if ( functionName.endsWith(QLatin1Char(';')) )
+ functionName.chop(1);
QString specifier = n.attribute(QLatin1String("specifier"));
QString access = n.attribute(QLatin1String("access"));
if ( access == QLatin1String("protected") ) {
@@ -296,8 +296,8 @@ void Ui3Reader::createSubImpl( const QDomElement &e, const QString& subClass )
continue;
QString returnType = n.attribute(QLatin1String("returnType"), QLatin1String("void"));
QString functionName = n.firstChild().toText().data().trimmed();
- if ( functionName.endsWith(QLatin1String(";")) )
- functionName = functionName.left( functionName.length() - 1 );
+ if ( functionName.endsWith(QLatin1Char(';')) )
+ functionName.chop(1);
QString specifier = n.attribute(QLatin1String("specifier"));
QString access = n.attribute(QLatin1String("access"));
if ( access == QLatin1String("protected") ) {
@@ -351,10 +351,10 @@ void Ui3Reader::writeFunctionsSubImpl( const QStringList &fuLst, const QStringLi
out << "/*" << endl;
out << " * " << descr << endl;
out << " */" << endl;
- out << type << " " << subClass << "::" << fixDeclaration(*it) << endl;
- out << "{" << endl;
+ out << type << ' ' << subClass << "::" << fixDeclaration(*it) << endl;
+ out << '{' << endl;
out << " qWarning( \"" << subClass << "::" << fixDeclaration(*it) << " not yet implemented!\" );" << endl;
- out << "}" << endl << endl;
+ out << '}' << endl << endl;
}
out << endl;
}
diff --git a/src/tools/uic3/ui3reader.cpp b/src/tools/uic3/ui3reader.cpp
index 1ba4b2f..539565c 100644
--- a/src/tools/uic3/ui3reader.cpp
+++ b/src/tools/uic3/ui3reader.cpp
@@ -125,10 +125,10 @@ QString Ui3Reader::fixString(const QString &str, bool encode)
QString s;
if (!encode) {
s = str;
- s.replace(QLatin1String("\\"), QLatin1String("\\\\"));
- s.replace(QLatin1String("\""), QLatin1String("\\\""));
- s.replace(QLatin1String("\r"), QLatin1String(""));
- s.replace(QLatin1String("\n"), QLatin1String("\\n\"\n\""));
+ s.replace(QLatin1Char('\\'), QLatin1String("\\\\"));
+ s.replace(QLatin1Char('\"'), QLatin1String("\\\""));
+ s.remove(QLatin1Char('\r'));
+ s.replace(QLatin1Char('\n'), QLatin1String("\\n\"\n\""));
} else {
QByteArray utf8 = str.utf8();
const int l = utf8.length();
@@ -136,7 +136,7 @@ QString Ui3Reader::fixString(const QString &str, bool encode)
s += QLatin1String("\\x") + QString::number((uchar)utf8[i], 16);
}
- return QLatin1String("\"") + s + QLatin1String("\"");
+ return QLatin1Char('\"') + s + QLatin1Char('\"');
}
QString Ui3Reader::trcall(const QString& sourceText, const QString& comment)
@@ -158,12 +158,12 @@ QString Ui3Reader::trcall(const QString& sourceText, const QString& comment)
}
if (comment.isEmpty()) {
- return t + QLatin1String("(") + fixString(sourceText, encode) + QLatin1String(")");
+ return t + QLatin1Char('(') + fixString(sourceText, encode) + QLatin1Char(')');
} else {
- return t + QLatin1String("(")
+ return t + QLatin1Char('(')
+ fixString(sourceText, encode)
+ QLatin1String(", ")
- + fixString(comment, encode) + QLatin1String(")");
+ + fixString(comment, encode) + QLatin1Char(')');
}
}
@@ -480,10 +480,10 @@ void Ui3Reader::createColorGroupImpl(const QString& name, const QDomElement& e)
QString pixmap = n.firstChild().toText().data();
if (!pixmapLoaderFunction.isEmpty()) {
pixmap.prepend(pixmapLoaderFunction
- + QLatin1String("(")
+ + QLatin1Char('(')
+ QLatin1String(externPixmaps ? "\"" : ""));
- pixmap.append(QLatin1String(externPixmaps ? "\"" : "") + QLatin1String(")"));
+ pixmap.append(QLatin1String(externPixmaps ? "\"" : "") + QLatin1Char(')'));
}
out << indent << name << ".setBrush(QColorGroup::"
<< ColorRole[r] << ", QBrush(" << color << ", " << pixmap << "));" << endl;
@@ -578,9 +578,9 @@ QString Ui3Reader::registerObject(const QString& name)
if (objectNames.contains(result)) {
int i = 2;
- while (objectNames.contains(result + QLatin1String("_") + QString::number(i)))
+ while (objectNames.contains(result + QLatin1Char('_') + QString::number(i)))
i++;
- result += QLatin1String("_");
+ result += QLatin1Char('_');
result += QString::number(i);
}
objectNames += result;