summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Wicking <paul.wicking@qt.io>2020-05-27 15:47:37 +0200
committerPaul Wicking <paul.wicking@qt.io>2020-06-04 10:21:10 +0200
commit69a4c15803b55ca8cff01bc9a92f6b27df377016 (patch)
treed952cc31ba8f1401cfeaa64411a1e79befe198a9
parentc25772315c8f4e6ddfd203cbc99f598c0ef88fb0 (diff)
QDoc: Drop half-baked translation effort
The current implementation suffers from lack of maintenance. This causes a poor user experience that adds little value, or is even detrimental to perceived value. Work to improve the situation would have to be done at the expense of something else. This patch removes the Q_DECLARE_TR_FUNCTIONS macros from QDoc, and replaces calls to tr() with QStringLiteral(). Fixes: QTBUG-84568 Change-Id: I2df71c27246ca5de816608c887cf359db8f85900 Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
-rw-r--r--src/qdoc/clangcodeparser.cpp31
-rw-r--r--src/qdoc/clangcodeparser.h2
-rw-r--r--src/qdoc/codeparser.cpp4
-rw-r--r--src/qdoc/codeparser.h2
-rw-r--r--src/qdoc/config.cpp58
-rw-r--r--src/qdoc/config.h2
-rw-r--r--src/qdoc/cppcodemarker.h2
-rw-r--r--src/qdoc/cppcodeparser.cpp92
-rw-r--r--src/qdoc/cppcodeparser.h2
-rw-r--r--src/qdoc/doc.cpp20
-rw-r--r--src/qdoc/doc.h2
-rw-r--r--src/qdoc/docbookgenerator.cpp12
-rw-r--r--src/qdoc/docparser.cpp136
-rw-r--r--src/qdoc/docparser.h2
-rw-r--r--src/qdoc/generator.cpp88
-rw-r--r--src/qdoc/generator.h2
-rw-r--r--src/qdoc/helpprojectwriter.cpp23
-rw-r--r--src/qdoc/helpprojectwriter.h2
-rw-r--r--src/qdoc/htmlgenerator.cpp42
-rw-r--r--src/qdoc/htmlgenerator.h2
-rw-r--r--src/qdoc/jscodemarker.cpp16
-rw-r--r--src/qdoc/jscodemarker.h2
-rw-r--r--src/qdoc/location.cpp27
-rw-r--r--src/qdoc/location.h2
-rw-r--r--src/qdoc/node.cpp30
-rw-r--r--src/qdoc/node.h4
-rw-r--r--src/qdoc/openedlist.cpp2
-rw-r--r--src/qdoc/openedlist.h2
-rw-r--r--src/qdoc/puredocparser.cpp8
-rw-r--r--src/qdoc/puredocparser.h2
-rw-r--r--src/qdoc/qdocdatabase.cpp11
-rw-r--r--src/qdoc/qdocdatabase.h2
-rw-r--r--src/qdoc/qmlcodemarker.cpp7
-rw-r--r--src/qdoc/qmlcodemarker.h2
-rw-r--r--src/qdoc/qmlcodeparser.cpp2
-rw-r--r--src/qdoc/qmlcodeparser.h2
-rw-r--r--src/qdoc/qmlvisitor.cpp13
-rw-r--r--src/qdoc/qmlvisitor.h2
-rw-r--r--src/qdoc/quoter.cpp16
-rw-r--r--src/qdoc/quoter.h2
-rw-r--r--src/qdoc/tokenizer.cpp17
-rw-r--r--src/qdoc/tokenizer.h2
-rw-r--r--src/qdoc/xmlgenerator.cpp5
43 files changed, 363 insertions, 341 deletions
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp
index 063b15894..b03f3827c 100644
--- a/src/qdoc/clangcodeparser.cpp
+++ b/src/qdoc/clangcodeparser.cpp
@@ -1033,7 +1033,7 @@ void ClangVisitor::parseProperty(const QString &spelling, const Location &loc)
if (ok)
property->setRevision(revision);
else
- loc.warning(ClangCodeParser::tr("Invalid revision number: %1").arg(value));
+ loc.warning(QStringLiteral("Invalid revision number: %1").arg(value));
} else if (key == "SCRIPTABLE") {
QString v = value.toLower();
if (v == "true")
@@ -1567,13 +1567,14 @@ void ClangCodeParser::parseSourceFile(const Location & /*location*/, const QStri
future = true;
}
if (!future) {
- doc.location().warning(tr("Cannot tie this documentation to anything"),
- tr("qdoc found a /*! ... */ comment, but there was no "
- "topic command (e.g., '\\%1', '\\%2') in the "
- "comment and no function definition following "
- "the comment.")
- .arg(COMMAND_FN)
- .arg(COMMAND_PAGE));
+ doc.location().warning(
+ QStringLiteral("Cannot tie this documentation to anything"),
+ QStringLiteral("qdoc found a /*! ... */ comment, but there was no "
+ "topic command (e.g., '\\%1', '\\%2') in the "
+ "comment and no function definition following "
+ "the comment.")
+ .arg(COMMAND_FN)
+ .arg(COMMAND_PAGE));
}
}
} else {
@@ -1620,9 +1621,9 @@ Node *ClangCodeParser::parseFnArg(const Location &location, const QString &fnArg
QString tag = fnArg.left(end + 1);
fnNode = qdb_->findFunctionNodeForTag(tag);
if (!fnNode) {
- location.error(ClangCodeParser::tr(
- "tag \\fn %1 not used in any include file in current module")
- .arg(tag));
+ location.error(
+ QStringLiteral("tag \\fn %1 not used in any include file in current module")
+ .arg(tag));
} else {
/*
The function node was found. Use the formal
@@ -1692,7 +1693,7 @@ Node *ClangCodeParser::parseFnArg(const Location &location, const QString &fnArg
qCDebug(lcQdoc) << __FUNCTION__ << "clang_parseTranslationUnit2(" << dummyFileName << args
<< ") returns" << err;
if (err || !tu) {
- location.error(ClangCodeParser::tr("clang could not parse \\fn %1").arg(fnArg));
+ location.error(QStringLiteral("clang could not parse \\fn %1").arg(fnArg));
clang_disposeTranslationUnit(tu);
clang_disposeIndex(index);
return fnNode;
@@ -1734,11 +1735,11 @@ Node *ClangCodeParser::parseFnArg(const Location &location, const QString &fnArg
}
}
if (report) {
- location.warning(ClangCodeParser::tr("clang found diagnostics parsing \\fn %1")
- .arg(fnArg));
+ location.warning(
+ QStringLiteral("clang found diagnostics parsing \\fn %1").arg(fnArg));
for (unsigned i = 0; i < diagnosticCount; ++i) {
CXDiagnostic diagnostic = clang_getDiagnostic(tu, i);
- location.report(tr(" %1").arg(
+ location.report(QStringLiteral(" %1").arg(
fromCXString(clang_formatDiagnostic(diagnostic, 0))));
}
}
diff --git a/src/qdoc/clangcodeparser.h b/src/qdoc/clangcodeparser.h
index 1575d31fb..ba0ba994c 100644
--- a/src/qdoc/clangcodeparser.h
+++ b/src/qdoc/clangcodeparser.h
@@ -48,8 +48,6 @@ QT_BEGIN_NAMESPACE
class ClangCodeParser : public CppCodeParser
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::ClangCodeParser)
-
public:
~ClangCodeParser() override;
diff --git a/src/qdoc/codeparser.cpp b/src/qdoc/codeparser.cpp
index 9bf518847..9f40be2a6 100644
--- a/src/qdoc/codeparser.cpp
+++ b/src/qdoc/codeparser.cpp
@@ -289,8 +289,8 @@ void CodeParser::checkModuleInclusion(Node *n)
}
qdb_->addToModule(Generator::defaultModuleName(), n);
- n->doc().location().warning(tr("%1 %2 has no \\inmodule command; "
- "using project name by default: %3")
+ n->doc().location().warning(QStringLiteral("%1 %2 has no \\inmodule command; "
+ "using project name by default: %3")
.arg(word)
.arg(n->name())
.arg(Generator::defaultModuleName()));
diff --git a/src/qdoc/codeparser.h b/src/qdoc/codeparser.h
index 2c690de9d..c2520db17 100644
--- a/src/qdoc/codeparser.h
+++ b/src/qdoc/codeparser.h
@@ -41,8 +41,6 @@ class QDocDatabase;
class CodeParser
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::CppCodeParser)
-
public:
CodeParser();
virtual ~CodeParser();
diff --git a/src/qdoc/config.cpp b/src/qdoc/config.cpp
index 44016dde2..0fa6c7077 100644
--- a/src/qdoc/config.cpp
+++ b/src/qdoc/config.cpp
@@ -170,8 +170,6 @@ void MetaStackEntry::close()
*/
class MetaStack : private QStack<MetaStackEntry>
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::MetaStack)
-
public:
MetaStack();
@@ -201,7 +199,7 @@ void MetaStack::process(QChar ch, const Location &location)
top().open();
} else if (ch == QLatin1Char('}')) {
if (count() == 1)
- location.fatal(tr("Unexpected '}'"));
+ location.fatal(QStringLiteral("Unexpected '}'"));
top().close();
const QStringList suffixes = pop().accum;
@@ -230,7 +228,7 @@ void MetaStack::process(QChar ch, const Location &location)
QStringList MetaStack::getExpanded(const Location &location)
{
if (count() > 1)
- location.fatal(tr("Missing '}'"));
+ location.fatal(QStringLiteral("Missing '}'"));
top().close();
return top().accum;
@@ -359,14 +357,15 @@ void Config::expandVariables()
const QString &key = it->m_var;
const auto &refVar = m_configVars.value(key);
if (refVar.m_name.isEmpty()) {
- configVar.m_location.fatal(tr("Environment or configuration variable '%1' undefined")
- .arg(it->m_var));
+ configVar.m_location.fatal(
+ QStringLiteral("Environment or configuration variable '%1' undefined")
+ .arg(it->m_var));
} else if (!refVar.m_expandVars.empty()) {
- configVar.m_location.fatal(tr("Nested variable expansion not allowed"),
- tr("When expanding '%1' at %2:%3")
- .arg(refVar.m_name)
- .arg(refVar.m_location.filePath())
- .arg(refVar.m_location.lineNo()));
+ configVar.m_location.fatal(QStringLiteral("Nested variable expansion not allowed"),
+ QStringLiteral("When expanding '%1' at %2:%3")
+ .arg(refVar.m_name)
+ .arg(refVar.m_location.filePath())
+ .arg(refVar.m_location.lineNo()));
}
QString expanded;
if (it->m_delim.isNull())
@@ -608,7 +607,7 @@ QStringList Config::getCanonicalPathList(const QString &var, bool validate) cons
if (dir.isRelative())
dir.setPath(currentPath + QLatin1Char('/') + path);
if (validate && !QFileInfo::exists(dir.path()))
- m_lastLocation.warning(tr("Cannot find file or directory: %1").arg(path));
+ m_lastLocation.warning(QStringLiteral("Cannot find file or directory: %1").arg(path));
else {
const QString canonicalPath = dir.canonicalPath();
if (!canonicalPath.isEmpty())
@@ -828,7 +827,7 @@ QString Config::findFile(const Location &location, const QStringList &files,
if (file == firstComponent || file.endsWith(QLatin1Char('/') + firstComponent)) {
fileInfo.setFile(file);
if (!fileInfo.exists())
- location.fatal(tr("File '%1' does not exist").arg(file));
+ location.fatal(QStringLiteral("File '%1' does not exist").arg(file));
break;
}
}
@@ -892,7 +891,7 @@ QString Config::copyFile(const Location &location, const QString &sourceFilePath
{
QFile inFile(sourceFilePath);
if (!inFile.open(QFile::ReadOnly)) {
- location.warning(tr("Cannot open input file for copy: '%1': %2")
+ location.warning(QStringLiteral("Cannot open input file for copy: '%1': %2")
.arg(sourceFilePath)
.arg(inFile.errorString()));
return QString();
@@ -908,7 +907,7 @@ QString Config::copyFile(const Location &location, const QString &sourceFilePath
outFileName = targetDirPath + outFileName;
QFile outFile(outFileName);
if (!outFile.open(QFile::WriteOnly)) {
- location.warning(tr("Cannot open output file for copy: '%1': %2")
+ location.warning(QStringLiteral("Cannot open output file for copy: '%1': %2")
.arg(outFileName)
.arg(outFile.errorString()));
return QString();
@@ -991,7 +990,7 @@ QStringList Config::loadMaster(const QString &fileName)
+ fileName.right(fileName.length() - prefix));
}
if (!fin.open(QFile::ReadOnly | QFile::Text))
- location.fatal(tr("Cannot open master qdocconf file '%1': %2")
+ location.fatal(QStringLiteral("Cannot open master qdocconf file '%1': %2")
.arg(fileName)
.arg(fin.errorString()));
}
@@ -1038,7 +1037,7 @@ void Config::load(Location location, const QString &fileName)
SKIP_CHAR();
if (location.depth() > 16)
- location.fatal(tr("Too many nested includes"));
+ location.fatal(QStringLiteral("Too many nested includes"));
QFile fin(fileInfo.fileName());
if (!fin.open(QFile::ReadOnly | QFile::Text)) {
@@ -1048,7 +1047,9 @@ void Config::load(Location location, const QString &fileName)
+ fileName.right(fileName.length() - prefix));
}
if (!fin.open(QFile::ReadOnly | QFile::Text))
- location.fatal(tr("Cannot open file '%1': %2").arg(fileName).arg(fin.errorString()));
+ location.fatal(QStringLiteral("Cannot open file '%1': %2")
+ .arg(fileName)
+ .arg(fin.errorString()));
}
QTextStream stream(&fin);
@@ -1094,7 +1095,7 @@ void Config::load(Location location, const QString &fileName)
QString includeFile;
if (cc != '(')
- location.fatal(tr("Bad include syntax"));
+ location.fatal(QStringLiteral("Bad include syntax"));
SKIP_CHAR();
SKIP_SPACES();
@@ -1110,7 +1111,8 @@ void Config::load(Location location, const QString &fileName)
if (!var.isEmpty()) {
const QByteArray val = qgetenv(var.toLatin1().data());
if (val.isNull()) {
- location.fatal(tr("Environment variable '%1' undefined").arg(var));
+ location.fatal(QStringLiteral("Environment variable '%1' undefined")
+ .arg(var));
} else {
includeFile += QString::fromLatin1(val);
}
@@ -1122,11 +1124,11 @@ void Config::load(Location location, const QString &fileName)
}
SKIP_SPACES();
if (cc != ')')
- location.fatal(tr("Bad include syntax"));
+ location.fatal(QStringLiteral("Bad include syntax"));
SKIP_CHAR();
SKIP_SPACES();
if (cc != '#' && cc != '\n')
- location.fatal(tr("Trailing garbage"));
+ location.fatal(QStringLiteral("Trailing garbage"));
/*
Here is the recursive call.
@@ -1142,7 +1144,7 @@ void Config::load(Location location, const QString &fileName)
SKIP_CHAR();
}
if (cc != '=')
- location.fatal(tr("Expected '=' or '+=' after key"));
+ location.fatal(QStringLiteral("Expected '=' or '+=' after key"));
SKIP_CHAR();
SKIP_SPACES();
@@ -1166,7 +1168,7 @@ void Config::load(Location location, const QString &fileName)
} else if (c.isSpace() || cc == '#') {
if (inQuote) {
if (cc == '\n')
- location.fatal(tr("Unterminated string"));
+ location.fatal(QStringLiteral("Unterminated string"));
PUT_CHAR();
} else {
if (!word.isEmpty() || needsExpansion) {
@@ -1211,7 +1213,7 @@ void Config::load(Location location, const QString &fileName)
else if (delim == '}')
delim = QChar(); // null delimiter
else
- location.fatal(tr("Missing '}'"));
+ location.fatal(QStringLiteral("Missing '}'"));
}
if (!var.isEmpty()) {
const QByteArray val = qgetenv(var.toLatin1().constData());
@@ -1224,13 +1226,13 @@ void Config::load(Location location, const QString &fileName)
}
} else {
if (!inQuote && cc == '=')
- location.fatal(tr("Unexpected '='"));
+ location.fatal(QStringLiteral("Unexpected '='"));
PUT_CHAR();
}
}
for (const auto &key : keys) {
if (!keySyntax.match(key).hasMatch())
- keyLoc.fatal(tr("Invalid key '%1'").arg(key));
+ keyLoc.fatal(QStringLiteral("Invalid key '%1'").arg(key));
ConfigVar configVar(key, rhsValues, QDir::currentPath(), keyLoc, expandVars);
if (plus && m_configVars.contains(key)) {
@@ -1241,7 +1243,7 @@ void Config::load(Location location, const QString &fileName)
}
}
} else {
- location.fatal(tr("Unexpected character '%1' at beginning of line").arg(c));
+ location.fatal(QStringLiteral("Unexpected character '%1' at beginning of line").arg(c));
}
}
popWorkingDir();
diff --git a/src/qdoc/config.h b/src/qdoc/config.h
index fc3a621f8..aa0a05959 100644
--- a/src/qdoc/config.h
+++ b/src/qdoc/config.h
@@ -115,8 +115,6 @@ typedef QMap<QString, ConfigVar> ConfigVarMap;
class Config : public Singleton<Config>
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::Config)
-
public:
~Config();
diff --git a/src/qdoc/cppcodemarker.h b/src/qdoc/cppcodemarker.h
index 184c83f9e..6a7515134 100644
--- a/src/qdoc/cppcodemarker.h
+++ b/src/qdoc/cppcodemarker.h
@@ -35,8 +35,6 @@ QT_BEGIN_NAMESPACE
class CppCodeMarker : public CodeMarker
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::CppCodeMarker)
-
public:
CppCodeMarker() = default;
~CppCodeMarker() override = default;
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp
index 30ad23bb4..b69e9f743 100644
--- a/src/qdoc/cppcodeparser.cpp
+++ b/src/qdoc/cppcodeparser.cpp
@@ -207,7 +207,7 @@ Node *CppCodeParser::processTopicCommand(const Doc &doc, const QString &command,
if (node == nullptr) {
if (isWorthWarningAbout(doc)) {
doc.location().warning(
- tr("Cannot find '%1' specified with '\\%2' in any header file")
+ QStringLiteral("Cannot find '%1' specified with '\\%2' in any header file")
.arg(arg.first)
.arg(command));
}
@@ -366,11 +366,10 @@ bool CppCodeParser::splitQmlPropertyArg(const QString &arg, QString &type, QStri
name = colonSplit[1];
return true;
}
- QString msg = "Unrecognizable QML module/component qualifier for " + arg;
- location.warning(tr(msg.toLatin1().data()));
+ location.warning(
+ QStringLiteral("Unrecognizable QML module/component qualifier for %1").arg(arg));
} else {
- QString msg = "Missing property type for " + arg;
- location.warning(tr(msg.toLatin1().data()));
+ location.warning(QStringLiteral("Missing property type for %1").arg(arg));
}
return false;
}
@@ -412,14 +411,16 @@ void CppCodeParser::processQmlProperties(const Doc &doc, NodeList &nodes, DocLis
bool attached = cmd.contains(QLatin1String("attached"));
if (splitQmlPropertyArg(arg, type, module, qmlTypeName, property, doc.location())) {
if (qmlType != qdb_->findQmlType(module, qmlTypeName)) {
- QString msg = tr("All properties in a group must belong to the same type: '%1'")
- .arg(arg);
- doc.startLocation().warning(msg);
+ doc.startLocation().warning(
+ QStringLiteral(
+ "All properties in a group must belong to the same type: '%1'")
+ .arg(arg));
continue;
}
if (qmlType->hasQmlProperty(property, attached) != nullptr) {
- QString msg = tr("QML property documented multiple times: '%1'").arg(arg);
- doc.startLocation().warning(msg);
+ doc.startLocation().warning(
+ QStringLiteral("QML property documented multiple times: '%1'")
+ .arg(arg));
continue;
}
auto *qpn = new QmlPropertyNode(qmlType, property, type, attached);
@@ -431,7 +432,8 @@ void CppCodeParser::processQmlProperties(const Doc &doc, NodeList &nodes, DocLis
}
} else {
doc.startLocation().warning(
- tr("Command '\\%1'; not allowed with QML/JS property commands").arg(cmd));
+ QStringLiteral("Command '\\%1'; not allowed with QML/JS property commands")
+ .arg(cmd));
}
}
@@ -474,7 +476,7 @@ void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command,
if (node->isAggregate())
static_cast<Aggregate *>(node)->addIncludeFile(arg);
else
- doc.location().warning(tr("Ignored '\\%1'").arg(COMMAND_INHEADERFILE));
+ doc.location().warning(QStringLiteral("Ignored '\\%1'").arg(COMMAND_INHEADERFILE));
} else if (command == COMMAND_OVERLOAD) {
/*
Note that this might set the overload flag of the
@@ -487,7 +489,7 @@ void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command,
else if (node->isSharedCommentNode())
static_cast<SharedCommentNode *>(node)->setOverloadFlags();
else
- doc.location().warning(tr("Ignored '\\%1'").arg(COMMAND_OVERLOAD));
+ doc.location().warning(QStringLiteral("Ignored '\\%1'").arg(COMMAND_OVERLOAD));
} else if (command == COMMAND_REIMP) {
if (node->parent() && !node->parent()->isInternal()) {
if (node->isFunction()) {
@@ -497,17 +499,19 @@ void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command,
// If the name of the overridden function isn't
// set, issue a warning.
if (fn->overridesThis().isEmpty() && isWorthWarningAbout(doc)) {
- doc.location().warning(tr("Cannot find base function for '\\%1' in %2()")
- .arg(COMMAND_REIMP)
- .arg(node->name()),
- tr("The function either doesn't exist in any "
- "base class with the same signature or it "
- "exists but isn't virtual."));
+ doc.location().warning(
+ QStringLiteral("Cannot find base function for '\\%1' in %2()")
+ .arg(COMMAND_REIMP)
+ .arg(node->name()),
+ QStringLiteral("The function either doesn't exist in any "
+ "base class with the same signature or it "
+ "exists but isn't virtual."));
}
fn->setReimpFlag();
} else {
- doc.location().warning(
- tr("Ignored '\\%1' in %2").arg(COMMAND_REIMP).arg(node->name()));
+ doc.location().warning(QStringLiteral("Ignored '\\%1' in %2")
+ .arg(COMMAND_REIMP)
+ .arg(node->name()));
}
}
} else if (command == COMMAND_RELATES) {
@@ -517,16 +521,16 @@ void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command,
aggregate = new ProxyNode(node->root(), arg);
if (node->parent() == aggregate) { // node is already a child of aggregate
- doc.location().warning(
- tr("Invalid '\\%1' (already a member of '%2')").arg(COMMAND_RELATES, arg));
+ doc.location().warning(QStringLiteral("Invalid '\\%1' (already a member of '%2')")
+ .arg(COMMAND_RELATES, arg));
} else {
if (node->isAggregate()) {
- doc.location().warning(tr("Invalid '\\%1' not allowed in '\\%2'")
+ doc.location().warning(QStringLiteral("Invalid '\\%1' not allowed in '\\%2'")
.arg(COMMAND_RELATES, node->nodeTypeString()));
} else if (!node->isRelatedNonmember() &&
!node->parent()->isNamespace() && !node->parent()->isHeader()) {
if (!doc.isInternal()) {
- doc.location().warning(tr("Invalid '\\%1' ('%2' must be global)")
+ doc.location().warning(QStringLiteral("Invalid '\\%1' ('%2' must be global)")
.arg(COMMAND_RELATES, node->name()));
}
} else if (!node->isRelatedNonmember() && !node->parent()->isHeader()) {
@@ -540,8 +544,9 @@ void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command,
*/
Node *clone = node->clone(aggregate);
if (clone == nullptr) {
- doc.location().warning(tr("Invalid '\\%1' (multiple uses not allowed in '%2')")
- .arg(COMMAND_RELATES, node->nodeTypeString()));
+ doc.location().warning(
+ QStringLiteral("Invalid '\\%1' (multiple uses not allowed in '%2')")
+ .arg(COMMAND_RELATES, node->nodeTypeString()));
} else {
clone->setRelatedNonmember(true);
}
@@ -555,7 +560,7 @@ void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command,
setLink(node, Node::StartLink, arg);
} else if (command == COMMAND_QMLINHERITS) {
if (node->name() == arg)
- doc.location().warning(tr("%1 tries to inherit itself").arg(arg));
+ doc.location().warning(QStringLiteral("%1 tries to inherit itself").arg(arg));
else if (node->isQmlType() || node->isJsType()) {
auto *qmlType = static_cast<QmlTypeNode *>(node);
qmlType->setQmlBaseName(arg);
@@ -566,9 +571,10 @@ void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command,
if (classNode)
node->setClassNode(classNode);
else
- doc.location().warning(tr("C++ class %1 not found: \\instantiates %1").arg(arg));
+ doc.location().warning(
+ QStringLiteral("C++ class %1 not found: \\instantiates %1").arg(arg));
} else
- doc.location().warning(tr("\\instantiates is only allowed in \\qmltype"));
+ doc.location().warning(QStringLiteral("\\instantiates is only allowed in \\qmltype"));
} else if (command == COMMAND_QMLDEFAULT) {
node->markDefault();
} else if (command == COMMAND_QMLREADONLY) {
@@ -589,7 +595,7 @@ void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command,
qdb_->addToJsModule(arg, node);
} else if (command == COMMAND_MAINCLASS) {
node->doc().location().warning(
- tr("'\\mainclass' is deprecated. Consider '\\ingroup mainclasses'"));
+ QStringLiteral("'\\mainclass' is deprecated. Consider '\\ingroup mainclasses'"));
} else if (command == COMMAND_OBSOLETE) {
node->setStatus(Node::Obsolete);
} else if (command == COMMAND_NONREENTRANT) {
@@ -611,23 +617,25 @@ void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command,
node->setThreadSafeness(Node::ThreadSafe);
} else if (command == COMMAND_TITLE) {
if (!node->setTitle(arg))
- doc.location().warning(tr("Ignored '\\%1'").arg(COMMAND_TITLE));
+ doc.location().warning(QStringLiteral("Ignored '\\%1'").arg(COMMAND_TITLE));
else if (node->isExample())
qdb_->addExampleNode(static_cast<ExampleNode *>(node));
} else if (command == COMMAND_SUBTITLE) {
if (!node->setSubtitle(arg))
- doc.location().warning(tr("Ignored '\\%1'").arg(COMMAND_SUBTITLE));
+ doc.location().warning(QStringLiteral("Ignored '\\%1'").arg(COMMAND_SUBTITLE));
} else if (command == COMMAND_QTVARIABLE) {
node->setQtVariable(arg);
if (!node->isModule() && !node->isQmlModule())
doc.location().warning(
- tr("Command '\\%1' is only meaningful in '\\module' and '\\qmlmodule'.")
+ QStringLiteral(
+ "Command '\\%1' is only meaningful in '\\module' and '\\qmlmodule'.")
.arg(COMMAND_QTVARIABLE));
} else if (command == COMMAND_QTCMAKEPACKAGE) {
node->setQtCMakeComponent(arg);
if (!node->isModule())
- doc.location().warning(tr("Command '\\%1' is only meaningful in '\\module'.")
- .arg(COMMAND_QTCMAKEPACKAGE));
+ doc.location().warning(
+ QStringLiteral("Command '\\%1' is only meaningful in '\\module'.")
+ .arg(COMMAND_QTCMAKEPACKAGE));
} else if (command == COMMAND_NOAUTOLIST) {
node->setNoAutoList(true);
}
@@ -672,7 +680,7 @@ FunctionNode *CppCodeParser::parseOtherFuncArg(const QString &topic, const Locat
QStringList colonSplit(funcName.split("::"));
if (colonSplit.size() < 2) {
QString msg = "Unrecognizable QML module/component qualifier for " + funcArg;
- location.warning(tr(msg.toLatin1().data()));
+ location.warning(msg.toLatin1().data());
return nullptr;
}
QString moduleName;
@@ -755,8 +763,8 @@ FunctionNode *CppCodeParser::parseMacroArg(const Location &location, const QStri
macro->setReturnType(returnType);
macro->setParameters(params);
if (oldMacroNode && macro->compare(oldMacroNode)) {
- location.warning(tr("\\macro %1 documented more than once").arg(macroArg));
- oldMacroNode->doc().location().warning(tr("(The previous doc is here)"));
+ location.warning(QStringLiteral("\\macro %1 documented more than once").arg(macroArg));
+ oldMacroNode->doc().location().warning(QStringLiteral("(The previous doc is here)"));
}
return macro;
}
@@ -769,7 +777,8 @@ void CppCodeParser::setExampleFileLists(ExampleNode *en)
QString details = QLatin1String("Example directories: ")
+ config.getCanonicalPathList(CONFIG_EXAMPLEDIRS).join(QLatin1Char(' '));
en->location().warning(
- tr("Cannot find project file for example '%1'").arg(en->name()), details);
+ QStringLiteral("Cannot find project file for example '%1'").arg(en->name()),
+ details);
return;
}
@@ -962,7 +971,8 @@ bool CppCodeParser::hasTooManyTopics(const Doc &doc) const
Q_ASSERT(i >= 0); // we had at least two commas
topicList[i] = ' ';
topicList.insert(i + 1, "and");
- doc.location().warning(tr("Multiple topic commands found in comment:%1").arg(topicList));
+ doc.location().warning(
+ QStringLiteral("Multiple topic commands found in comment:%1").arg(topicList));
return true;
}
return false;
diff --git a/src/qdoc/cppcodeparser.h b/src/qdoc/cppcodeparser.h
index 42a8199a2..34b14838a 100644
--- a/src/qdoc/cppcodeparser.h
+++ b/src/qdoc/cppcodeparser.h
@@ -39,8 +39,6 @@ class Aggregate;
class CppCodeParser : public CodeParser
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::CppCodeParser)
-
struct ExtraFuncData
{
Aggregate *root; // Used as the parent.
diff --git a/src/qdoc/doc.cpp b/src/qdoc/doc.cpp
index 769b31ffb..def487f66 100644
--- a/src/qdoc/doc.cpp
+++ b/src/qdoc/doc.cpp
@@ -299,8 +299,8 @@ void Doc::initialize()
for (const auto &a : config.subVars(CONFIG_ALIAS)) {
QString alias = config.getString(CONFIG_ALIAS + Config::dot + a);
if (reverseAliasMap.contains(alias)) {
- config.lastLocation().warning(tr("Command name '\\%1' cannot stand"
- " for both '\\%2' and '\\%3'")
+ config.lastLocation().warning(QStringLiteral("Command name '\\%1' cannot stand"
+ " for both '\\%2' and '\\%3'")
.arg(alias)
.arg(reverseAliasMap[alias])
.arg(a));
@@ -330,13 +330,13 @@ void Doc::initialize()
macro.numParams = m;
else if (macro.numParams != m) {
if (!silent) {
- QString other = tr("default");
+ QString other = QStringLiteral("default");
if (macro.defaultDef.isEmpty())
other = macro.otherDefs.constBegin().key();
- config.lastLocation().warning(tr("Macro '\\%1' takes"
- " inconsistent number"
- " of arguments (%2"
- " %3, %4 %5)")
+ config.lastLocation().warning(QStringLiteral("Macro '\\%1' takes"
+ " inconsistent number"
+ " of arguments (%2"
+ " %3, %4 %5)")
.arg(macroName)
.arg(f)
.arg(m)
@@ -431,11 +431,13 @@ CodeMarker *Doc::quoteFromFile(const Location &location, Quoter &quoter, const Q
if (!DocParser::exampleFiles.isEmpty())
details += QLatin1String(", example files: ")
+ DocParser::exampleFiles.join(QLatin1Char(' '));
- location.warning(tr("Cannot find file to quote from: '%1'").arg(fileName), details);
+ location.warning(QStringLiteral("Cannot find file to quote from: '%1'").arg(fileName),
+ details);
} else {
QFile inFile(filePath);
if (!inFile.open(QFile::ReadOnly)) {
- location.warning(tr("Cannot open file to quote from: '%1'").arg(userFriendlyFilePath));
+ location.warning(QStringLiteral("Cannot open file to quote from: '%1'")
+ .arg(userFriendlyFilePath));
} else {
QTextStream inStream(&inFile);
code = DocParser::untabifyEtc(inStream.readAll());
diff --git a/src/qdoc/doc.h b/src/qdoc/doc.h
index c9a5650f6..c488e3a7e 100644
--- a/src/qdoc/doc.h
+++ b/src/qdoc/doc.h
@@ -57,8 +57,6 @@ typedef QMultiMap<QString, QString> QStringMultiMap;
class Doc
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::Doc)
-
public:
// the order is important
enum Sections {
diff --git a/src/qdoc/docbookgenerator.cpp b/src/qdoc/docbookgenerator.cpp
index 1bab8b572..71e12fb22 100644
--- a/src/qdoc/docbookgenerator.cpp
+++ b/src/qdoc/docbookgenerator.cpp
@@ -179,8 +179,9 @@ const Atom *DocBookGenerator::generateAtomList(const Atom *atom, const Node *rel
if (atom->type() == Atom::FormatEndif) {
if (generate && numAtoms0 == numAtoms) {
- relative->location().warning(
- tr("Output format %1 not handled %2").arg(format()).arg(outFileName()));
+ relative->location().warning(QStringLiteral("Output format %1 not handled %2")
+ .arg(format())
+ .arg(outFileName()));
Atom unhandledFormatAtom(Atom::UnhandledFormat, format());
generateAtomList(&unhandledFormatAtom, relative, generate, numAtoms);
}
@@ -793,7 +794,7 @@ int DocBookGenerator::generateAtom(const Atom *atom, const Node *relative, CodeM
if (args.size() % 2) {
// Problem...
relative->doc().location().warning(
- tr("Error when parsing attributes for the table: got \"%1\"")
+ QStringLiteral("Error when parsing attributes for the table: got \"%1\"")
.arg(atom->string()));
}
for (int i = 0; i + 1 < args.size(); i += 2)
@@ -2755,8 +2756,9 @@ void DocBookGenerator::generateDocBookSynopsis(const Node *node)
} else if (node->isTypedef()) {
writer->writeTextElement(dbNamespace, "type", node->plainName());
} else {
- node->doc().location().warning(tr("Unexpected node type in generateDocBookSynopsis: %1")
- .arg(node->nodeTypeString()));
+ node->doc().location().warning(
+ QStringLiteral("Unexpected node type in generateDocBookSynopsis: %1")
+ .arg(node->nodeTypeString()));
newLine();
}
diff --git a/src/qdoc/docparser.cpp b/src/qdoc/docparser.cpp
index 05171706f..713abc977 100644
--- a/src/qdoc/docparser.cpp
+++ b/src/qdoc/docparser.cpp
@@ -296,7 +296,7 @@ void DocParser::initialize(const Config &config)
m_utilities.cmdHash.insert(*cmds[i].alias, cmds[i].no);
if (cmds[i].no != i)
- Location::internalError(tr("command %1 missing").arg(i));
+ Location::internalError(QStringLiteral("command %1 missing").arg(i));
++i;
}
@@ -416,7 +416,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
append(Atom::BR);
break;
case CMD_BOLD:
- location().warning(tr("'\\bold' is deprecated. Use '\\b'"));
+ location().warning(QStringLiteral("'\\bold' is deprecated. Use '\\b'"));
Q_FALLTHROUGH();
case CMD_B:
startFormat(ATOM_FORMATTING_BOLD, cmd);
@@ -504,7 +504,8 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
if (numPreprocessorSkipping)
skipToNextPreprocessorCommand();
} else {
- location().warning(tr("Unexpected '\\%1'").arg(cmdName(CMD_ELSE)));
+ location().warning(
+ QStringLiteral("Unexpected '\\%1'").arg(cmdName(CMD_ELSE)));
}
break;
case CMD_ENDCODE:
@@ -534,7 +535,8 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
if (numPreprocessorSkipping)
skipToNextPreprocessorCommand();
} else {
- location().warning(tr("Unexpected '\\%1'").arg(cmdName(CMD_ENDIF)));
+ location().warning(
+ QStringLiteral("Unexpected '\\%1'").arg(cmdName(CMD_ENDIF)));
}
break;
case CMD_ENDLEGALESE:
@@ -576,7 +578,8 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
}
break;
case CMD_ENDRAW:
- location().warning(tr("Unexpected '\\%1'").arg(cmdName(CMD_ENDRAW)));
+ location().warning(
+ QStringLiteral("Unexpected '\\%1'").arg(cmdName(CMD_ENDRAW)));
break;
case CMD_ENDSECTION1:
endSection(Doc::Section1, cmd);
@@ -633,17 +636,17 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
m_inTableHeader = true;
} else {
if (m_openedCommands.contains(CMD_TABLE))
- location().warning(tr("Cannot use '\\%1' within '\\%2'")
+ location().warning(QStringLiteral("Cannot use '\\%1' within '\\%2'")
.arg(cmdName(CMD_HEADER))
.arg(cmdName(m_openedCommands.top())));
else
- location().warning(tr("Cannot use '\\%1' outside of '\\%2'")
+ location().warning(QStringLiteral("Cannot use '\\%1' outside of '\\%2'")
.arg(cmdName(CMD_HEADER))
.arg(cmdName(CMD_TABLE)));
}
break;
case CMD_I:
- location().warning(tr(
+ location().warning(QStringLiteral(
"'\\i' is deprecated. Use '\\e' for italic or '\\li' for list item"));
Q_FALLTHROUGH();
case CMD_E:
@@ -707,8 +710,9 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
append(p1, p2);
if (!p2.isEmpty() && !(m_private->text.lastAtom()->error().isEmpty()))
location().warning(
- tr("Check parameter in '[ ]' of '\\l' command: '%1', "
- "possible misspelling, or unrecognized module name")
+ QStringLiteral(
+ "Check parameter in '[ ]' of '\\l' command: '%1', "
+ "possible misspelling, or unrecognized module name")
.arg(m_private->text.lastAtom()->error()));
if (isLeftBraceAhead()) {
currentLinkAtom = m_private->text.lastAtom();
@@ -723,8 +727,9 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
append(p1, p2);
if (!p2.isEmpty() && !(m_private->text.lastAtom()->error().isEmpty()))
location().warning(
- tr("Check parameter in '[ ]' of '\\l' command: '%1', "
- "possible misspelling, or unrecognized module name")
+ QStringLiteral(
+ "Check parameter in '[ ]' of '\\l' command: '%1', "
+ "possible misspelling, or unrecognized module name")
.arg(m_private->text.lastAtom()->error()));
append(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
append(Atom::String, cleanLink(p1));
@@ -779,14 +784,15 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
m_private->extra->metaMap_.insert(p1, getArgument());
break;
case CMD_NEWCODE:
- location().warning(tr("Unexpected '\\%1'").arg(cmdName(CMD_NEWCODE)));
+ location().warning(
+ QStringLiteral("Unexpected '\\%1'").arg(cmdName(CMD_NEWCODE)));
break;
case CMD_NOTE:
leavePara();
enterPara(Atom::NoteLeft, Atom::NoteRight);
break;
case CMD_O:
- location().warning(tr("'\\o' is deprecated. Use '\\li'"));
+ location().warning(QStringLiteral("'\\o' is deprecated. Use '\\li'"));
Q_FALLTHROUGH();
case CMD_LI:
leavePara();
@@ -809,10 +815,11 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
}
if (!m_inTableHeader && !m_inTableRow) {
- location().warning(tr("Missing '\\%1' or '\\%2' before '\\%3'")
- .arg(cmdName(CMD_HEADER))
- .arg(cmdName(CMD_ROW))
- .arg(cmdName(CMD_LI)));
+ location().warning(
+ QStringLiteral("Missing '\\%1' or '\\%2' before '\\%3'")
+ .arg(cmdName(CMD_HEADER))
+ .arg(cmdName(CMD_ROW))
+ .arg(cmdName(CMD_LI)));
append(Atom::TableRowLeft);
m_inTableRow = true;
} else if (m_inTableItem) {
@@ -823,10 +830,11 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
append(Atom::TableItemLeft, p1, p2);
m_inTableItem = true;
} else
- location().warning(tr("Command '\\%1' outside of '\\%2' and '\\%3'")
- .arg(cmdName(cmd))
- .arg(cmdName(CMD_LIST))
- .arg(cmdName(CMD_TABLE)));
+ location().warning(
+ QStringLiteral("Command '\\%1' outside of '\\%2' and '\\%3'")
+ .arg(cmdName(cmd))
+ .arg(cmdName(CMD_LIST))
+ .arg(cmdName(CMD_TABLE)));
break;
case CMD_OLDCODE:
leavePara();
@@ -920,8 +928,8 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
leavePara();
p1 = getRestOfLine();
if (p1.isEmpty())
- location().warning(
- tr("Missing format name after '\\%1'").arg(cmdName(CMD_RAW)));
+ location().warning(QStringLiteral("Missing format name after '\\%1'")
+ .arg(cmdName(CMD_RAW)));
append(Atom::FormatIf, p1);
append(Atom::RawString, untabifyEtc(getUntilEnd(cmd)));
append(Atom::FormatElse);
@@ -937,11 +945,11 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
m_inTableRow = true;
} else {
if (m_openedCommands.contains(CMD_TABLE))
- location().warning(tr("Cannot use '\\%1' within '\\%2'")
+ location().warning(QStringLiteral("Cannot use '\\%1' within '\\%2'")
.arg(cmdName(CMD_ROW))
.arg(cmdName(m_openedCommands.top())));
else
- location().warning(tr("Cannot use '\\%1' outside of '\\%2'")
+ location().warning(QStringLiteral("Cannot use '\\%1' outside of '\\%2'")
.arg(cmdName(CMD_ROW))
.arg(cmdName(CMD_TABLE)));
}
@@ -1057,8 +1065,9 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
bool ok;
uint unicodeChar = p1.toUInt(&ok, 0);
if (!ok || (unicodeChar == 0x0000) || (unicodeChar > 0xFFFE))
- location().warning(tr("Invalid Unicode character '%1' specified with '%2'")
- .arg(p1, cmdName(CMD_UNICODE)));
+ location().warning(
+ QStringLiteral("Invalid Unicode character '%1' specified with '%2'")
+ .arg(p1, cmdName(CMD_UNICODE)));
else
append(Atom::String, QChar(unicodeChar));
break;
@@ -1162,9 +1171,10 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
if (!macro.defaultDef.isEmpty()) {
if (numFormatDefs > 0) {
- macro.defaultDefLocation.warning(tr("Macro cannot have both "
- "format-specific and qdoc-"
- "syntax definitions"));
+ macro.defaultDefLocation.warning(
+ QStringLiteral("Macro cannot have both "
+ "format-specific and qdoc-"
+ "syntax definitions"));
} else {
QString expanded = expandMacroToString(cmdStr, macro.defaultDef,
macro.numParams, matchExpr);
@@ -1180,7 +1190,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
if (!cmdStr.endsWith("propertygroup")) {
// The QML and JS property group commands are no longer required
// for grouping QML and JS properties. They are allowed but ignored.
- location().warning(tr("Unknown command '\\%1'").arg(cmdStr),
+ location().warning(QStringLiteral("Unknown command '\\%1'").arg(cmdStr),
detailsUnknownCommand(metaCommandSet, cmdStr));
}
enterPara();
@@ -1300,9 +1310,10 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
}
if (m_openedCommands.top() != CMD_OMIT) {
- location().warning(tr("Missing '\\%1'").arg(endCmdName(m_openedCommands.top())));
+ location().warning(
+ QStringLiteral("Missing '\\%1'").arg(endCmdName(m_openedCommands.top())));
} else if (preprocessorSkipping.count() > 0) {
- location().warning(tr("Missing '\\%1'").arg(cmdName(CMD_ENDIF)));
+ location().warning(QStringLiteral("Missing '\\%1'").arg(cmdName(CMD_ENDIF)));
}
if (m_currentSection > Doc::NoSection) {
@@ -1339,22 +1350,22 @@ QString DocParser::detailsUnknownCommand(const QSet<QString> &metaCommandSet, co
}
if (m_utilities.aliasMap.contains(str))
- return tr("The command '\\%1' was renamed '\\%2' by the configuration"
- " file. Use the new name.")
+ return QStringLiteral("The command '\\%1' was renamed '\\%2' by the configuration"
+ " file. Use the new name.")
.arg(str)
.arg(m_utilities.aliasMap[str]);
QString best = nearestName(str, commandSet);
if (best.isEmpty())
return QString();
- return tr("Maybe you meant '\\%1'?").arg(best);
+ return QStringLiteral("Maybe you meant '\\%1'?").arg(best);
}
void DocParser::insertTarget(const QString &target, bool keyword)
{
if (m_targetMap.contains(target)) {
- location().warning(tr("Duplicate target name '%1'").arg(target));
- m_targetMap[target].warning(tr("(The previous occurrence is here)"));
+ location().warning(QStringLiteral("Duplicate target name '%1'").arg(target));
+ m_targetMap[target].warning(QStringLiteral("(The previous occurrence is here)"));
} else {
m_targetMap.insert(target, location());
m_private->constructExtra();
@@ -1371,16 +1382,17 @@ void DocParser::insertTarget(const QString &target, bool keyword)
void DocParser::include(const QString &fileName, const QString &identifier)
{
if (location().depth() > 16)
- location().fatal(tr("Too many nested '\\%1's").arg(cmdName(CMD_INCLUDE)));
+ location().fatal(QStringLiteral("Too many nested '\\%1's").arg(cmdName(CMD_INCLUDE)));
QString userFriendlyFilePath;
QString filePath = Config::instance().getIncludeFilePath(fileName);
if (filePath.isEmpty()) {
- location().warning(tr("Cannot find qdoc include file '%1'").arg(fileName));
+ location().warning(QStringLiteral("Cannot find qdoc include file '%1'").arg(fileName));
} else {
QFile inFile(filePath);
if (!inFile.open(QFile::ReadOnly)) {
- location().warning(tr("Cannot open qdoc include file '%1'").arg(userFriendlyFilePath));
+ location().warning(
+ QStringLiteral("Cannot open qdoc include file '%1'").arg(userFriendlyFilePath));
} else {
location().push(userFriendlyFilePath);
@@ -1406,7 +1418,7 @@ void DocParser::include(const QString &fileName, const QString &identifier)
++i;
}
if (startLine < 0) {
- location().warning(tr("Cannot find '%1' in '%2'")
+ location().warning(QStringLiteral("Cannot find '%1' in '%2'")
.arg(identifier)
.arg(userFriendlyFilePath));
return;
@@ -1425,7 +1437,7 @@ void DocParser::include(const QString &fileName, const QString &identifier)
++i;
} while (i < lineBuffer.size());
if (result.isEmpty()) {
- location().warning(tr("Empty qdoc snippet '%1' in '%2'")
+ location().warning(QStringLiteral("Empty qdoc snippet '%1' in '%2'")
.arg(identifier)
.arg(userFriendlyFilePath));
} else {
@@ -1444,7 +1456,7 @@ void DocParser::startFormat(const QString &format, int cmd)
for (const auto &item : qAsConst(m_pendingFormats)) {
if (item == format) {
- location().warning(tr("Cannot nest '\\%1' commands").arg(cmdName(cmd)));
+ location().warning(QStringLiteral("Cannot nest '\\%1' commands").arg(cmdName(cmd)));
return;
}
}
@@ -1491,7 +1503,8 @@ bool DocParser::openCommand(int cmd)
if (ok) {
m_openedCommands.push(cmd);
} else {
- location().warning(tr("Can't use '\\%1' in '\\%2'").arg(cmdName(cmd)).arg(cmdName(outer)));
+ location().warning(
+ QStringLiteral("Can't use '\\%1' in '\\%2'").arg(cmdName(cmd)).arg(cmdName(outer)));
}
return ok;
}
@@ -1571,13 +1584,13 @@ bool DocParser::closeCommand(int endCmd)
if (contains) {
while (endCmdFor(m_openedCommands.top()) != endCmd && m_openedCommands.size() > 1) {
- location().warning(tr("Missing '\\%1' before '\\%2'")
+ location().warning(QStringLiteral("Missing '\\%1' before '\\%2'")
.arg(endCmdName(m_openedCommands.top()))
.arg(cmdName(endCmd)));
m_openedCommands.pop();
}
} else {
- location().warning(tr("Unexpected '\\%1'").arg(cmdName(endCmd)));
+ location().warning(QStringLiteral("Unexpected '\\%1'").arg(cmdName(endCmd)));
}
return false;
}
@@ -1649,7 +1662,7 @@ void DocParser::parseAlso()
m_position++;
skipSpacesOrOneEndl();
} else if (m_position >= m_inputLength || m_input[m_position] != '\n') {
- location().warning(tr("Missing comma in '\\%1'").arg(cmdName(CMD_SA)));
+ location().warning(QStringLiteral("Missing comma in '\\%1'").arg(cmdName(CMD_SA)));
}
}
}
@@ -1759,7 +1772,7 @@ void DocParser::leavePara()
{
if (m_paragraphState != OutsideParagraph) {
if (!m_pendingFormats.isEmpty()) {
- location().warning(tr("Missing '}'"));
+ location().warning(QStringLiteral("Missing '}'"));
m_pendingFormats.clear();
}
@@ -1859,10 +1872,11 @@ bool DocParser::expandMacro()
m_position = backslashPos;
return true;
} else {
- location().warning(tr("Macro '%1' does not have a default definition").arg(cmdStr));
+ location().warning(QStringLiteral("Macro '%1' does not have a default definition")
+ .arg(cmdStr));
}
} else {
- location().warning(tr("Unknown macro '%1'").arg(cmdStr));
+ location().warning(QStringLiteral("Unknown macro '%1'").arg(cmdStr));
m_position = ++backslashPos;
}
} else if (m_input[m_position].isSpace()) {
@@ -1887,8 +1901,8 @@ void DocParser::expandMacro(const QString &name, const QString &def, int numPara
if (numParams == 1 || isLeftBraceAhead()) {
args << getArgument();
} else {
- location().warning(tr("Macro '\\%1' invoked with too few"
- " arguments (expected %2, got %3)")
+ location().warning(QStringLiteral("Macro '\\%1' invoked with too few"
+ " arguments (expected %2, got %3)")
.arg(name)
.arg(numParams)
.arg(i));
@@ -1929,8 +1943,8 @@ QString DocParser::expandMacroToString(const QString &name, const QString &def,
if (numParams == 1 || isLeftBraceAhead()) {
args << getArgument(true);
} else {
- location().warning(tr("Macro '\\%1' invoked with too few"
- " arguments (expected %2, got %3)")
+ location().warning(QStringLiteral("Macro '\\%1' invoked with too few"
+ " arguments (expected %2, got %3)")
.arg(name)
.arg(numParams)
.arg(i));
@@ -1982,7 +1996,7 @@ Doc::Sections DocParser::getSectioningUnit()
} else if (name.isEmpty()) {
return Doc::NoSection;
} else {
- location().warning(tr("Invalid section '%1'").arg(name));
+ location().warning(QStringLiteral("Invalid section '%1'").arg(name));
return Doc::NoSection;
}
}
@@ -2028,7 +2042,7 @@ QString DocParser::getBracedArgument(bool verbatim)
}
}
if (delimDepth > 0)
- location().warning(tr("Missing '}'"));
+ location().warning(QStringLiteral("Missing '}'"));
}
m_endPosition = m_position;
return arg;
@@ -2133,7 +2147,7 @@ QString DocParser::getBracketedArgument()
}
}
if (delimDepth > 0)
- location().warning(tr("Missing ']'"));
+ location().warning(QStringLiteral("Missing ']'"));
}
return arg;
}
@@ -2211,7 +2225,7 @@ QString DocParser::getMetaCommandArgument(const QString &cmdStr)
}
if (m_position == m_input.size() && parenDepth > 0) {
m_position = begin;
- location().warning(tr("Unbalanced parentheses in '%1'").arg(cmdStr));
+ location().warning(QStringLiteral("Unbalanced parentheses in '%1'").arg(cmdStr));
}
QString t = m_input.mid(begin, m_position - begin).simplified();
@@ -2227,7 +2241,7 @@ QString DocParser::getUntilEnd(int cmd)
auto match = rx.match(m_input, m_position);
if (!match.hasMatch()) {
- location().warning(tr("Missing '\\%1'").arg(cmdName(endCmd)));
+ location().warning(QStringLiteral("Missing '\\%1'").arg(cmdName(endCmd)));
m_position = m_input.length();
} else {
int end = match.capturedStart();
diff --git a/src/qdoc/docparser.h b/src/qdoc/docparser.h
index 2222dec9a..4bc585fa8 100644
--- a/src/qdoc/docparser.h
+++ b/src/qdoc/docparser.h
@@ -49,8 +49,6 @@ class CodeMarker;
class DocParser
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::DocParser)
-
public:
void parse(const QString &source, DocPrivate *docPrivate, const QSet<QString> &metaCommandSet,
const QSet<QString> &possibleTopics);
diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp
index 2bdf89267..7168b3dac 100644
--- a/src/qdoc/generator.cpp
+++ b/src/qdoc/generator.cpp
@@ -256,11 +256,12 @@ QFile *Generator::openSubPageFile(const Node *node, const QString &fileName)
auto outPath = redirectDocumentationToDevNull_ ? QStringLiteral("/dev/null") : path;
auto outFile = new QFile(outPath);
if (!redirectDocumentationToDevNull_ && outFile->exists()) {
- node->location().error(
- tr("Output file already exists; overwriting %1").arg(outFile->fileName()));
+ node->location().error(QStringLiteral("Output file already exists; overwriting %1")
+ .arg(outFile->fileName()));
}
if (!outFile->open(QFile::WriteOnly)) {
- node->location().fatal(tr("Cannot open output file '%1'").arg(outFile->fileName()));
+ node->location().fatal(
+ QStringLiteral("Cannot open output file '%1'").arg(outFile->fileName()));
}
qCDebug(lcQdoc, "Writing: %s", qPrintable(path));
outFileNames_ << fileName;
@@ -731,8 +732,9 @@ const Atom *Generator::generateAtomList(const Atom *atom, const Node *relative,
if (atom->type() == Atom::FormatEndif) {
if (generate && numAtoms0 == numAtoms) {
- relative->location().warning(
- tr("Output format %1 not handled %2").arg(format()).arg(outFileName()));
+ relative->location().warning(QStringLiteral("Output format %1 not handled %2")
+ .arg(format())
+ .arg(outFileName()));
Atom unhandledFormatAtom(Atom::UnhandledFormat, format());
generateAtomList(&unhandledFormatAtom, relative, marker, generate, numAtoms);
}
@@ -808,14 +810,14 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
out() << "</p>";
} else if (!node->isWrapper() && !node->isMarkedReimp()) {
if (!fn->isIgnored()) // undocumented functions added by Q_OBJECT
- node->location().warning(
- tr("No documentation for '%1'").arg(node->plainSignature()));
+ node->location().warning(QStringLiteral("No documentation for '%1'")
+ .arg(node->plainSignature()));
}
} else if (!node->isWrapper() && !node->isMarkedReimp()) {
// Don't require documentation of things defined in Q_GADGET
if (node->name() != QLatin1String("QtGadgetHelper"))
node->location().warning(
- tr("No documentation for '%1'").arg(node->plainSignature()));
+ QStringLiteral("No documentation for '%1'").arg(node->plainSignature()));
}
} else if (!node->isSharingComment()) {
// Reimplements clause and type alias info precede body text
@@ -859,16 +861,18 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
QString details;
QString best = nearestName(it, definedItems);
if (!best.isEmpty() && !documentedItems.contains(best))
- details = tr("Maybe you meant '%1'?").arg(best);
+ details = QStringLiteral("Maybe you meant '%1'?").arg(best);
- node->doc().location().warning(tr("No such enum item '%1' in %2")
- .arg(it)
- .arg(node->plainFullName()),
- details);
+ node->doc().location().warning(
+ QStringLiteral("No such enum item '%1' in %2")
+ .arg(it)
+ .arg(node->plainFullName()),
+ details);
} else if (!documentedItems.contains(it)) {
- node->doc().location().warning(tr("Undocumented enum item '%1' in %2")
- .arg(it)
- .arg(node->plainFullName()));
+ node->doc().location().warning(
+ QStringLiteral("Undocumented enum item '%1' in %2")
+ .arg(it)
+ .arg(node->plainFullName()));
}
}
}
@@ -880,9 +884,10 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
if (!documentedNames.contains(name)) {
if (fn->isActive() || fn->isPreliminary()) {
if (!fn->isMarkedReimp() && !fn->isOverload()) {
- fn->doc().location().warning(tr("Undocumented parameter '%1' in %2")
- .arg(name)
- .arg(node->plainFullName()));
+ fn->doc().location().warning(
+ QStringLiteral("Undocumented parameter '%1' in %2")
+ .arg(name)
+ .arg(node->plainFullName()));
}
}
}
@@ -892,8 +897,8 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
QString best = nearestName(name, declaredNames);
QString details;
if (!best.isEmpty())
- details = tr("Maybe you meant '%1'?").arg(best);
- fn->doc().location().warning(tr("No such parameter '%1' in %2")
+ details = QStringLiteral("Maybe you meant '%1'?").arg(best);
+ fn->doc().location().warning(QStringLiteral("No such parameter '%1' in %2")
.arg(name)
.arg(fn->plainFullName()),
details);
@@ -909,8 +914,8 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
&& !fn->isOverload()) {
if (!fn->doc().body().contains("return"))
node->doc().location().warning(
- tr("Undocumented return value "
- "(hint: use 'return' or 'returns' in the text"));
+ QStringLiteral("Undocumented return value "
+ "(hint: use 'return' or 'returns' in the text"));
}
}
}
@@ -998,7 +1003,7 @@ void Generator::addImageToCopy(const ExampleNode *en, const QString &file)
userFriendlyFilePath.truncate(userFriendlyFilePath.lastIndexOf('/'));
QString imgOutDir = outDir_ + prefix + userFriendlyFilePath;
if (!dirInfo.mkpath(imgOutDir))
- en->location().fatal(tr("Cannot create output directory '%1'").arg(imgOutDir));
+ en->location().fatal(QStringLiteral("Cannot create output directory '%1'").arg(imgOutDir));
Config::copyFile(en->location(), srcPath, file, imgOutDir);
}
@@ -1275,7 +1280,7 @@ void Generator::generateReimplementsClause(const FunctionNode *fn, CodeMarker *m
generateText(text, fn, marker);
} else {
fn->doc().location().warning(
- tr("Illegal \\reimp; no documented virtual function for %1")
+ QStringLiteral("Illegal \\reimp; no documented virtual function for %1")
.arg(overrides->plainSignature()));
}
return;
@@ -1777,16 +1782,16 @@ void Generator::initialize()
int numParams = Config::numParams(def);
int numOccs = def.count("\1");
if (numParams != 1) {
- config.lastLocation().warning(tr("Formatting '%1' must "
- "have exactly one "
- "parameter (found %2)")
+ config.lastLocation().warning(QStringLiteral("Formatting '%1' must "
+ "have exactly one "
+ "parameter (found %2)")
.arg(n)
.arg(numParams));
} else if (numOccs > 1) {
- config.lastLocation().fatal(tr("Formatting '%1' must "
- "contain exactly one "
- "occurrence of '\\1' "
- "(found %2)")
+ config.lastLocation().fatal(QStringLiteral("Formatting '%1' must "
+ "contain exactly one "
+ "occurrence of '\\1' "
+ "(found %2)")
.arg(n)
.arg(numOccs));
} else {
@@ -1833,7 +1838,7 @@ void Generator::copyTemplateFiles(const QString &configVar, const QString &subDi
QString templateDir = outDir_ + QLatin1Char('/') + subDir;
if (!dirInfo.exists(templateDir) && !dirInfo.mkdir(templateDir)) {
config.lastLocation().fatal(
- tr("Cannot create %1 directory '%2'").arg(subDir, templateDir));
+ QStringLiteral("Cannot create %1 directory '%2'").arg(subDir, templateDir));
} else {
for (const auto &file : files) {
if (!file.isEmpty())
@@ -1861,8 +1866,8 @@ void Generator::initializeFormat()
outDir_ = config.getOutputDir(format());
if (outDir_.isEmpty()) {
- config.lastLocation().fatal(tr("No output directory specified in "
- "configuration file or on the command line"));
+ config.lastLocation().fatal(QStringLiteral("No output directory specified in "
+ "configuration file or on the command line"));
} else {
outSubdir_ = outDir_.mid(outDir_.lastIndexOf('/') + 1);
}
@@ -1871,10 +1876,12 @@ void Generator::initializeFormat()
if (dirInfo.exists(outDir_)) {
if (!config.generating() && Generator::useOutputSubdirs()) {
if (!Config::removeDirContents(outDir_))
- config.lastLocation().error(tr("Cannot empty output directory '%1'").arg(outDir_));
+ config.lastLocation().error(
+ QStringLiteral("Cannot empty output directory '%1'").arg(outDir_));
}
} else if (!dirInfo.mkpath(outDir_)) {
- config.lastLocation().fatal(tr("Cannot create output directory '%1'").arg(outDir_));
+ config.lastLocation().fatal(
+ QStringLiteral("Cannot create output directory '%1'").arg(outDir_));
}
// Output directory exists, which is enough for prepare phase.
@@ -1883,7 +1890,7 @@ void Generator::initializeFormat()
if (!dirInfo.exists(outDir_ + "/images") && !dirInfo.mkdir(outDir_ + "/images"))
config.lastLocation().fatal(
- tr("Cannot create images directory '%1'").arg(outDir_ + "/images"));
+ QStringLiteral("Cannot create images directory '%1'").arg(outDir_ + "/images"));
copyTemplateFiles(format() + Config::dot + CONFIG_STYLESHEETS, "style");
copyTemplateFiles(format() + Config::dot + CONFIG_SCRIPTS, "scripts");
@@ -2238,8 +2245,9 @@ QString Generator::typeString(const Node *node)
void Generator::unknownAtom(const Atom *atom)
{
- Location::internalError(
- tr("unknown atom type '%1' in %2 generator").arg(atom->typeString()).arg(format()));
+ Location::internalError(QStringLiteral("unknown atom type '%1' in %2 generator")
+ .arg(atom->typeString())
+ .arg(format()));
}
QT_END_NAMESPACE
diff --git a/src/qdoc/generator.h b/src/qdoc/generator.h
index 4920c1d72..355dce242 100644
--- a/src/qdoc/generator.h
+++ b/src/qdoc/generator.h
@@ -49,8 +49,6 @@ class QDocDatabase;
class Generator
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::Generator)
-
public:
enum ListType { Generic, Obsolete };
enum Addendum { Invokable, PrivateSignal, QmlSignalHandler, AssociatedProperties, TypeAlias };
diff --git a/src/qdoc/helpprojectwriter.cpp b/src/qdoc/helpprojectwriter.cpp
index 603c06362..8e6698ae1 100644
--- a/src/qdoc/helpprojectwriter.cpp
+++ b/src/qdoc/helpprojectwriter.cpp
@@ -297,7 +297,8 @@ bool HelpProjectWriter::generateSection(HelpProject &project, QXmlStreamWriter &
project.keywords.append(details);
} else
node->doc().location().warning(
- tr("Bad keyword in %1").arg(gen_->fullDocumentLocation(node, false)));
+ QStringLiteral("Bad keyword in %1")
+ .arg(gen_->fullDocumentLocation(node, false)));
}
}
project.keywords.append(keywordDetails(node));
@@ -347,7 +348,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project, QXmlStreamWriter &
project.keywords.append(details);
} else
cn->doc().location().warning(
- tr("Bad keyword in %1")
+ QStringLiteral("Bad keyword in %1")
.arg(gen_->fullDocumentLocation(node, false)));
}
}
@@ -422,7 +423,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project, QXmlStreamWriter &
project.keywords.append(details);
} else {
QString loc = gen_->fullDocumentLocation(node, false);
- pn->doc().location().warning(tr("Bad keyword in %1").arg(loc));
+ pn->doc().location().warning(QStringLiteral("Bad keyword in %1").arg(loc));
}
}
}
@@ -537,11 +538,11 @@ void HelpProjectWriter::addMembers(HelpProject &project, QXmlStreamWriter &write
&& (derivedClass || node->isQmlType() || node->isJsType()
|| !project.memberStatus[node].isEmpty())) {
QString membersPath = href + QStringLiteral("-members.html");
- writeSection(writer, membersPath, tr("List of all members"));
+ writeSection(writer, membersPath, QStringLiteral("List of all members"));
}
if (project.memberStatus[node].contains(Node::Obsolete)) {
QString obsoletePath = href + QStringLiteral("-obsolete.html");
- writeSection(writer, obsoletePath, tr("Obsolete members"));
+ writeSection(writer, obsoletePath, QStringLiteral("Obsolete members"));
}
}
@@ -565,10 +566,14 @@ void HelpProjectWriter::writeNode(HelpProject &project, QXmlStreamWriter &writer
writer.writeStartElement("section");
writer.writeAttribute("ref", href);
if (node->parent() && !node->parent()->name().isEmpty())
- writer.writeAttribute(
- "title", tr("%1::%2 %3 Reference").arg(node->parent()->name()).arg(objName).arg(typeStr));
+ writer.writeAttribute("title",
+ QStringLiteral("%1::%2 %3 Reference")
+ .arg(node->parent()->name())
+ .arg(objName)
+ .arg(typeStr));
else
- writer.writeAttribute("title", tr("%1 %2 Reference").arg(objName).arg(typeStr));
+ writer.writeAttribute("title",
+ QStringLiteral("%1 %2 Reference").arg(objName).arg(typeStr));
addMembers(project, writer, node);
writer.writeEndElement(); // section
@@ -719,7 +724,7 @@ void HelpProjectWriter::generateProject(HelpProject &project)
}
} else
rootNode->doc().location().warning(
- tr("Failed to find index: %1").arg(subproject.indexTitle));
+ QStringLiteral("Failed to find index: %1").arg(subproject.indexTitle));
} else {
diff --git a/src/qdoc/helpprojectwriter.h b/src/qdoc/helpprojectwriter.h
index 31b8f009d..4dc50e045 100644
--- a/src/qdoc/helpprojectwriter.h
+++ b/src/qdoc/helpprojectwriter.h
@@ -77,8 +77,6 @@ struct HelpProject
class HelpProjectWriter
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::HelpProjectWriter)
-
public:
HelpProjectWriter(const QString &defaultFileName, Generator *g);
void reset(const QString &defaultFileName, Generator *g);
diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp
index b451d2831..1c94a2dce 100644
--- a/src/qdoc/htmlgenerator.cpp
+++ b/src/qdoc/htmlgenerator.cpp
@@ -322,7 +322,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
if (link.isEmpty()) {
if (autolinkErrors())
relative->doc().location().warning(
- tr("Can't autolink to '%1'").arg(atom->string()));
+ QStringLiteral("Can't autolink to '%1'").arg(atom->string()));
} else if (node && node->isObsolete()) {
if ((relative->parent() != node) && !relative->isObsolete())
link.clear();
@@ -616,7 +616,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
if (atom->type() == Atom::Image)
out() << "<p class=\"centerAlign\">";
if (fileName.isEmpty()) {
- relative->location().warning(tr("Missing image: %1").arg(protectEnc(atom->string())));
+ relative->location().warning(
+ QStringLiteral("Missing image: %1").arg(protectEnc(atom->string())));
out() << "<font color=\"red\">[Missing image " << protectEnc(atom->string())
<< "]</font>";
} else {
@@ -668,7 +669,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
const Node *node = nullptr;
QString link = getLink(atom, relative, &node);
if (link.isEmpty() && (node != relative) && !noLinkErrors()) {
- relative->doc().location().warning(tr("Can't link to '%1'").arg(atom->string()));
+ relative->doc().location().warning(
+ QStringLiteral("Can't link to '%1'").arg(atom->string()));
} else {
node = nullptr;
}
@@ -678,14 +680,16 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
case Atom::ExampleFileLink: {
QString link = linkForExampleFile(atom->string(), relative);
if (link.isEmpty() && !noLinkErrors())
- relative->doc().location().warning(tr("Can't link to '%1'").arg(atom->string()));
+ relative->doc().location().warning(
+ QStringLiteral("Can't link to '%1'").arg(atom->string()));
beginLink(link);
skipAhead = 1;
} break;
case Atom::ExampleImageLink: {
QString link = atom->string();
if (link.isEmpty() && !noLinkErrors())
- relative->doc().location().warning(tr("Can't link to '%1'").arg(atom->string()));
+ relative->doc().location().warning(
+ QStringLiteral("Can't link to '%1'").arg(atom->string()));
link = "images/used-in-examples/" + link;
beginLink(link);
skipAhead = 1;
@@ -1112,7 +1116,7 @@ void HtmlGenerator::generateCppReferencePage(Aggregate *aggregate, CodeMarker *m
if (aggregate->isClassNode())
command = "\'\\class\' comment";
aggregate->location().warning(
- tr("No %1 for '%2'").arg(command).arg(aggregate->plainSignature()));
+ QStringLiteral("No %1 for '%2'").arg(command).arg(aggregate->plainSignature()));
} else {
generateExtractionMark(aggregate, DetailedDescriptionMark);
out() << "<div class=\"descr\">\n" // QTBUG-9504
@@ -1731,7 +1735,8 @@ void HtmlGenerator::generateHeader(const QString &title, const Node *node, CodeM
linkPair = node->links()[Node::PreviousLink];
linkNode = qdb_->findNodeForTarget(linkPair.first, node);
if (linkNode == nullptr)
- node->doc().location().warning(tr("Cannot link to '%1'").arg(linkPair.first));
+ node->doc().location().warning(
+ QStringLiteral("Cannot link to '%1'").arg(linkPair.first));
if (linkNode == nullptr || linkNode == node)
anchorPair = linkPair;
else
@@ -1751,7 +1756,8 @@ void HtmlGenerator::generateHeader(const QString &title, const Node *node, CodeM
linkPair = node->links()[Node::NextLink];
linkNode = qdb_->findNodeForTarget(linkPair.first, node);
if (linkNode == nullptr)
- node->doc().location().warning(tr("Cannot link to '%1'").arg(linkPair.first));
+ node->doc().location().warning(
+ QStringLiteral("Cannot link to '%1'").arg(linkPair.first));
if (linkNode == nullptr || linkNode == node)
anchorPair = linkPair;
else
@@ -1773,7 +1779,8 @@ void HtmlGenerator::generateHeader(const QString &title, const Node *node, CodeM
linkPair = node->links()[Node::StartLink];
linkNode = qdb_->findNodeForTarget(linkPair.first, node);
if (linkNode == nullptr)
- node->doc().location().warning(tr("Cannot link to '%1'").arg(linkPair.first));
+ node->doc().location().warning(
+ QStringLiteral("Cannot link to '%1'").arg(linkPair.first));
if (linkNode == nullptr || linkNode == node)
anchorPair = linkPair;
else
@@ -2053,11 +2060,11 @@ void HtmlGenerator::generateQmlRequisites(QmlTypeNode *qcn, CodeMarker *marker)
collection ? collection->logicalModuleVersion() : qcn->logicalModuleVersion();
if (logicalModuleVersion.isEmpty() || qcn->logicalModuleName().isEmpty())
- qcn->doc().location().warning(tr("Could not resolve QML import "
- "statement for type '%1'")
+ qcn->doc().location().warning(QStringLiteral("Could not resolve QML import "
+ "statement for type '%1'")
.arg(qcn->name()),
- tr("Maybe you forgot to use the "
- "'\\%1' command?")
+ QStringLiteral("Maybe you forgot to use the "
+ "'\\%1' command?")
.arg(COMMAND_INQMLMODULE));
text.clear();
@@ -2144,7 +2151,7 @@ void HtmlGenerator::generateBrief(const Node *node, CodeMarker *marker, const No
if (!brief.lastAtom()->string().endsWith('.')) {
brief << Atom(Atom::String, ".");
node->doc().location().warning(
- tr("'\\brief' statement does not end with a full stop."));
+ QStringLiteral("'\\brief' statement does not end with a full stop."));
}
generateExtractionMark(node, BriefMark);
out() << "<p>";
@@ -2896,9 +2903,10 @@ void HtmlGenerator::generateList(const Node *relative, CodeMarker *marker, const
\qmlmodule, or \jsmodule
*/
if (relative && !relative->isCollectionNode()) {
- relative->doc().location().warning(tr("\\generatelist {%1} is only allowed in \\group, "
- "\\module, \\qmlmodule, and \\jsmodule comments.")
- .arg(selector));
+ relative->doc().location().warning(
+ QStringLiteral("\\generatelist {%1} is only allowed in \\group, "
+ "\\module, \\qmlmodule, and \\jsmodule comments.")
+ .arg(selector));
return;
}
Node *n = const_cast<Node *>(relative);
diff --git a/src/qdoc/htmlgenerator.h b/src/qdoc/htmlgenerator.h
index 80c43b022..1391080f8 100644
--- a/src/qdoc/htmlgenerator.h
+++ b/src/qdoc/htmlgenerator.h
@@ -43,8 +43,6 @@ class HelpProjectWriter;
class HtmlGenerator : public XmlGenerator
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::HtmlGenerator)
-
public:
HtmlGenerator();
~HtmlGenerator() override;
diff --git a/src/qdoc/jscodemarker.cpp b/src/qdoc/jscodemarker.cpp
index 23d9b4a53..b28b5a464 100644
--- a/src/qdoc/jscodemarker.cpp
+++ b/src/qdoc/jscodemarker.cpp
@@ -123,16 +123,18 @@ QString JsCodeMarker::addMarkUp(const QString &code, const Node * /* relative */
QmlMarkupVisitor visitor(code, pragmas, &engine);
QQmlJS::AST::Node::accept(ast, &visitor);
if (visitor.hasError()) {
- location.warning(location.fileName()
- + tr("Unable to analyze JavaScript. The output is incomplete."));
+ location.warning(
+ location.fileName()
+ + QStringLiteral("Unable to analyze JavaScript. The output is incomplete."));
}
output = visitor.markedUpCode();
} else {
- location.warning(location.fileName()
- + tr("Unable to parse JavaScript: \"%1\" at line %2, column %3")
- .arg(parser.errorMessage())
- .arg(parser.errorLineNumber())
- .arg(parser.errorColumnNumber()));
+ location.warning(
+ location.fileName()
+ + QStringLiteral("Unable to parse JavaScript: \"%1\" at line %2, column %3")
+ .arg(parser.errorMessage())
+ .arg(parser.errorLineNumber())
+ .arg(parser.errorColumnNumber()));
output = protect(code);
}
return output;
diff --git a/src/qdoc/jscodemarker.h b/src/qdoc/jscodemarker.h
index 3473cd09b..ed0ec6b9b 100644
--- a/src/qdoc/jscodemarker.h
+++ b/src/qdoc/jscodemarker.h
@@ -39,8 +39,6 @@ QT_BEGIN_NAMESPACE
class JsCodeMarker : public QmlCodeMarker
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::JsCodeMarker)
-
public:
JsCodeMarker();
~JsCodeMarker() override;
diff --git a/src/qdoc/location.cpp b/src/qdoc/location.cpp
index 5cc0fb115..a94c8b7e4 100644
--- a/src/qdoc/location.cpp
+++ b/src/qdoc/location.cpp
@@ -283,7 +283,7 @@ int Location::exitCode()
Location().emitMessage(
Error,
- tr("Documentation warnings (%1) exceeded the limit (%2) for '%3'.")
+ QStringLiteral("Documentation warnings (%1) exceeded the limit (%2) for '%3'.")
.arg(QString::number(warningCount), QString::number(warningLimit), project),
QString());
return warningCount;
@@ -333,7 +333,8 @@ void Location::initialize()
if (regExp.isValid()) {
spuriousRegExp = new QRegularExpression(regExp);
} else {
- config.lastLocation().warning(tr("Invalid regular expression '%1'").arg(regExp.pattern()));
+ config.lastLocation().warning(
+ QStringLiteral("Invalid regular expression '%1'").arg(regExp.pattern()));
}
}
@@ -362,9 +363,9 @@ void Location::information(const QString &message)
*/
void Location::internalError(const QString &hint)
{
- Location().fatal(tr("Internal error (%1)").arg(hint),
- tr("There is a bug in %1. Seek advice from your local"
- " %2 guru.")
+ Location().fatal(QStringLiteral("Internal error (%1)").arg(hint),
+ QStringLiteral("There is a bug in %1. Seek advice from your local"
+ " %2 guru.")
.arg(programName)
.arg(programName));
}
@@ -388,16 +389,16 @@ void Location::emitMessage(MessageType type, const QString &message, const QStri
result.replace("\n", "\n ");
if (isEmpty()) {
if (type == Error)
- result.prepend(tr(": error: "));
+ result.prepend(QStringLiteral(": error: "));
else if (type == Warning) {
- result.prepend(tr(": warning: "));
+ result.prepend(QStringLiteral(": warning: "));
++warningCount;
}
} else {
if (type == Error)
- result.prepend(tr(": (qdoc) error: "));
+ result.prepend(QStringLiteral(": (qdoc) error: "));
else if (type == Warning) {
- result.prepend(tr(": (qdoc) warning: "));
+ result.prepend(QStringLiteral(": (qdoc) warning: "));
++warningCount;
}
}
@@ -422,19 +423,17 @@ QString Location::toString() const
loc2.setEtc(false);
loc2.pop();
if (!loc2.isEmpty()) {
- QString blah = tr("In file included from ");
+ QString blah = QStringLiteral("In file included from ");
for (;;) {
str += blah;
str += loc2.top();
loc2.pop();
if (loc2.isEmpty())
break;
- str += tr(",");
- str += QLatin1Char('\n');
+ str += QStringLiteral(",\n");
blah.fill(' ');
}
- str += tr(":");
- str += QLatin1Char('\n');
+ str += QStringLiteral(":\n");
}
str += top();
}
diff --git a/src/qdoc/location.h b/src/qdoc/location.h
index 2f2352c95..7effa191b 100644
--- a/src/qdoc/location.h
+++ b/src/qdoc/location.h
@@ -42,8 +42,6 @@ class QRegularExpression;
class Location
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::Location)
-
public:
Location();
explicit Location(const QString &filePath);
diff --git a/src/qdoc/node.cpp b/src/qdoc/node.cpp
index ffa4397c2..412034fa0 100644
--- a/src/qdoc/node.cpp
+++ b/src/qdoc/node.cpp
@@ -680,8 +680,8 @@ bool Node::match(const QVector<int> &types) const
void Node::setDoc(const Doc &doc, bool replace)
{
if (!doc_.isEmpty() && !replace && !doc.isMarkedReimp()) {
- doc.location().warning(tr("Overrides a previous doc"));
- doc_.location().warning(tr("(The previous doc is here)"));
+ doc.location().warning(QStringLiteral("Overrides a previous doc"));
+ doc_.location().warning(QStringLiteral("(The previous doc is here)"));
}
doc_ = doc;
}
@@ -3069,12 +3069,15 @@ void NamespaceNode::reportDocumentedChildrenInUndocumentedNamespace() const
QString msg1 = node->name();
if (node->isFunction())
msg1 += "()";
- msg1 += tr(" is documented, but namespace %1 is not documented in any module.")
+ msg1 += QStringLiteral(
+ " is documented, but namespace %1 is not documented in any module.")
+ .arg(name());
+ QString msg2 =
+ QStringLiteral(
+ "Add /*! '\\%1 %2' ... */ or remove the qdoc comment marker (!) at "
+ "that line number.")
+ .arg(COMMAND_NAMESPACE)
.arg(name());
- QString msg2 = tr("Add /*! '\\%1 %2' ... */ or remove the qdoc comment marker (!) at "
- "that line number.")
- .arg(COMMAND_NAMESPACE)
- .arg(name());
node->doc().location().warning(msg1, msg2);
}
@@ -4644,16 +4647,17 @@ bool QmlPropertyNode::isWritable()
return pn->isWritable();
else
defLocation().warning(
- tr("No Q_PROPERTY for QML property %1::%2::%3 "
- "in C++ class documented as QML type: "
- "(property not found in the C++ class or its base classes)")
+ QStringLiteral(
+ "No Q_PROPERTY for QML property %1::%2::%3 "
+ "in C++ class documented as QML type: "
+ "(property not found in the C++ class or its base classes)")
.arg(logicalModuleName())
.arg(qmlTypeName())
.arg(name()));
} else
- defLocation().warning(tr("No Q_PROPERTY for QML property %1::%2::%3 "
- "in C++ class documented as QML type: "
- "(C++ class not specified or not found).")
+ defLocation().warning(QStringLiteral("No Q_PROPERTY for QML property %1::%2::%3 "
+ "in C++ class documented as QML type: "
+ "(C++ class not specified or not found).")
.arg(logicalModuleName())
.arg(qmlTypeName())
.arg(name()));
diff --git a/src/qdoc/node.h b/src/qdoc/node.h
index fbe2afaec..cc2a73147 100644
--- a/src/qdoc/node.h
+++ b/src/qdoc/node.h
@@ -70,8 +70,6 @@ typedef QVector<CollectionNode *> CollectionList;
class Node
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::Node)
-
public:
enum NodeType : unsigned char {
NoType,
@@ -810,8 +808,6 @@ public:
class QmlPropertyNode : public Node
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::QmlPropertyNode)
-
public:
QmlPropertyNode(Aggregate *parent, const QString &name, const QString &type, bool attached);
diff --git a/src/qdoc/openedlist.cpp b/src/qdoc/openedlist.cpp
index 4e58b1b37..94fa5613a 100644
--- a/src/qdoc/openedlist.cpp
+++ b/src/qdoc/openedlist.cpp
@@ -66,7 +66,7 @@ OpenedList::OpenedList(const Location &location, const QString &hint) : sty(Bull
pref = match.captured(1);
suff = match.captured(3);
} else if (!hint.isEmpty()) {
- location.warning(tr("Unrecognized list style '%1'").arg(hint));
+ location.warning(QStringLiteral("Unrecognized list style '%1'").arg(hint));
}
nex = ini - 1;
}
diff --git a/src/qdoc/openedlist.h b/src/qdoc/openedlist.h
index 604eabb6f..c41a4adf7 100644
--- a/src/qdoc/openedlist.h
+++ b/src/qdoc/openedlist.h
@@ -41,8 +41,6 @@ QT_BEGIN_NAMESPACE
class OpenedList
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::OpenedList)
-
public:
enum ListStyle { Bullet, Tag, Value, Numeric, UpperAlpha, LowerAlpha, UpperRoman, LowerRoman };
diff --git a/src/qdoc/puredocparser.cpp b/src/qdoc/puredocparser.cpp
index 61694ddc6..2fefe8b52 100644
--- a/src/qdoc/puredocparser.cpp
+++ b/src/qdoc/puredocparser.cpp
@@ -60,7 +60,9 @@ void PureDocParser::parseSourceFile(const Location &location, const QString &fil
QFile in(filePath);
currentFile_ = filePath;
if (!in.open(QIODevice::ReadOnly)) {
- location.error(tr("Can't open source file '%1' (%2)").arg(filePath).arg(strerror(errno)));
+ location.error(QStringLiteral("Can't open source file '%1' (%2)")
+ .arg(filePath)
+ .arg(strerror(errno)));
currentFile_.clear();
return;
}
@@ -103,8 +105,8 @@ bool PureDocParser::processQdocComments()
Doc doc(start_loc, end_loc, comment, commands, topicCommands());
const TopicList &topics = doc.topicsUsed();
if (topics.isEmpty()) {
- doc.location().warning(tr("This qdoc comment contains no topic command "
- "(e.g., '\\%1', '\\%2').")
+ doc.location().warning(QStringLiteral("This qdoc comment contains no topic command "
+ "(e.g., '\\%1', '\\%2').")
.arg(COMMAND_MODULE)
.arg(COMMAND_PAGE));
continue;
diff --git a/src/qdoc/puredocparser.h b/src/qdoc/puredocparser.h
index 67824f399..20791ae1c 100644
--- a/src/qdoc/puredocparser.h
+++ b/src/qdoc/puredocparser.h
@@ -37,8 +37,6 @@ class Location;
class PureDocParser : public CppCodeParser
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::PureDocParser)
-
public:
PureDocParser() : tokenizer_(nullptr), tok_(0) { pureParser_ = this; }
~PureDocParser() override { pureParser_ = nullptr; }
diff --git a/src/qdoc/qdocdatabase.cpp b/src/qdoc/qdocdatabase.cpp
index 92d47445a..f19ee45c6 100644
--- a/src/qdoc/qdocdatabase.cpp
+++ b/src/qdoc/qdocdatabase.cpp
@@ -1192,8 +1192,9 @@ void QDocDatabase::resolveNamespaces()
NamespaceNode *NS = static_cast<NamespaceNode *>(node);
if (NS->hadDoc() && NS != ns) {
ns->doc().location().warning(
- tr("Namespace %1 documented more than once").arg(NS->name()));
- NS->doc().location().warning(tr("...also seen here"));
+ QStringLiteral("Namespace %1 documented more than once")
+ .arg(NS->name()));
+ NS->doc().location().warning(QStringLiteral("...also seen here"));
}
}
@@ -1642,9 +1643,9 @@ void QDocDatabase::updateNavigation()
atom = atom->next();
}
} else {
- Config::instance().lastLocation()
- .warning(tr("Failed to find table of contents with title '%1'")
- .arg(tocTitle));
+ Config::instance().lastLocation().warning(
+ QStringLiteral("Failed to find table of contents with title '%1'")
+ .arg(tocTitle));
}
}
diff --git a/src/qdoc/qdocdatabase.h b/src/qdoc/qdocdatabase.h
index 4844f1009..65f6adf81 100644
--- a/src/qdoc/qdocdatabase.h
+++ b/src/qdoc/qdocdatabase.h
@@ -205,8 +205,6 @@ private:
class QDocDatabase
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::QDocDatabase)
-
public:
static QDocDatabase *qdocDB();
static void destroyQdocDB();
diff --git a/src/qdoc/qmlcodemarker.cpp b/src/qdoc/qmlcodemarker.cpp
index f2fc8d11c..e61fb3eb6 100644
--- a/src/qdoc/qmlcodemarker.cpp
+++ b/src/qdoc/qmlcodemarker.cpp
@@ -177,12 +177,13 @@ QString QmlCodeMarker::addMarkUp(const QString &code, const Node * /* relative *
QmlMarkupVisitor visitor(code, pragmas, &engine);
QQmlJS::AST::Node::accept(ast, &visitor);
if (visitor.hasError()) {
- location.warning(location.fileName()
- + tr("Unable to analyze QML snippet. The output is incomplete."));
+ location.warning(
+ location.fileName()
+ + QStringLiteral("Unable to analyze QML snippet. The output is incomplete."));
}
output = visitor.markedUpCode();
} else {
- location.warning(tr("Unable to parse QML snippet: \"%1\" at line %2, column %3")
+ location.warning(QStringLiteral("Unable to parse QML snippet: \"%1\" at line %2, column %3")
.arg(parser.errorMessage())
.arg(parser.errorLineNumber())
.arg(parser.errorColumnNumber()));
diff --git a/src/qdoc/qmlcodemarker.h b/src/qdoc/qmlcodemarker.h
index 67b1a9be7..75aff955d 100644
--- a/src/qdoc/qmlcodemarker.h
+++ b/src/qdoc/qmlcodemarker.h
@@ -52,8 +52,6 @@ namespace QQmlJS {
class QmlCodeMarker : public CppCodeMarker
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::QmlCodeMarker)
-
public:
QmlCodeMarker();
~QmlCodeMarker() override;
diff --git a/src/qdoc/qmlcodeparser.cpp b/src/qdoc/qmlcodeparser.cpp
index a0a6bc5f0..e69ea12a4 100644
--- a/src/qdoc/qmlcodeparser.cpp
+++ b/src/qdoc/qmlcodeparser.cpp
@@ -113,7 +113,7 @@ void QmlCodeParser::parseSourceFile(const Location &location, const QString &fil
QFile in(filePath);
currentFile_ = filePath;
if (!in.open(QIODevice::ReadOnly)) {
- location.error(tr("Cannot open QML file '%1'").arg(filePath));
+ location.error(QStringLiteral("Cannot open QML file '%1'").arg(filePath));
currentFile_.clear();
return;
}
diff --git a/src/qdoc/qmlcodeparser.h b/src/qdoc/qmlcodeparser.h
index ca34dc111..67ba628f9 100644
--- a/src/qdoc/qmlcodeparser.h
+++ b/src/qdoc/qmlcodeparser.h
@@ -50,8 +50,6 @@ class QString;
class QmlCodeParser : public CodeParser
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::QmlCodeParser)
-
public:
QmlCodeParser();
~QmlCodeParser() override;
diff --git a/src/qdoc/qmlvisitor.cpp b/src/qdoc/qmlvisitor.cpp
index 925ac04a5..104c4575d 100644
--- a/src/qdoc/qmlvisitor.cpp
+++ b/src/qdoc/qmlvisitor.cpp
@@ -407,11 +407,10 @@ bool QmlDocVisitor::splitQmlPropertyArg(const Doc &doc, const QString &arg, QmlP
qpa.name_ = colonSplit[0];
return true;
}
- QString msg = "Unrecognizable QML module/component qualifier for " + arg;
- doc.location().warning(tr(msg.toLatin1().data()));
+ doc.location().warning(
+ QStringLiteral("Unrecognizable QML module/component qualifier for %1.").arg(arg));
} else {
- QString msg = "Missing property type for " + arg;
- doc.location().warning(tr(msg.toLatin1().data()));
+ doc.location().warning(QStringLiteral("Missing property type for %1.").arg(arg));
}
return false;
}
@@ -437,7 +436,8 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::SourceLocation, Node *node, Doc &d
qdb->addToQmlModule(args[0].first, node);
} else if (command == COMMAND_QMLINHERITS) {
if (node->name() == args[0].first)
- doc.location().warning(tr("%1 tries to inherit itself").arg(args[0].first));
+ doc.location().warning(
+ QStringLiteral("%1 tries to inherit itself").arg(args[0].first));
else if (node->isQmlType() || node->isJsType()) {
QmlTypeNode *qmlType = static_cast<QmlTypeNode *>(node);
qmlType->setQmlBaseName(args[0].first);
@@ -461,7 +461,8 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::SourceLocation, Node *node, Doc &d
} else if (command == COMMAND_WRAPPER) {
node->setWrapper();
} else {
- doc.location().warning(tr("The \\%1 command is ignored in QML files").arg(command));
+ doc.location().warning(
+ QStringLiteral("The \\%1 command is ignored in QML files").arg(command));
}
}
}
diff --git a/src/qdoc/qmlvisitor.h b/src/qdoc/qmlvisitor.h
index c0fe51251..d46bdfb7f 100644
--- a/src/qdoc/qmlvisitor.h
+++ b/src/qdoc/qmlvisitor.h
@@ -68,8 +68,6 @@ struct QmlPropArgs
#ifndef QT_NO_DECLARATIVE
class QmlDocVisitor : public QQmlJS::AST::Visitor
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::QmlDocVisitor)
-
public:
QmlDocVisitor(const QString &filePath, const QString &code, QQmlJS::Engine *engine,
const QSet<QString> &commands, const QSet<QString> &topics);
diff --git a/src/qdoc/quoter.cpp b/src/qdoc/quoter.cpp
index 3e1ac5762..edef4f9fa 100644
--- a/src/qdoc/quoter.cpp
+++ b/src/qdoc/quoter.cpp
@@ -168,7 +168,8 @@ void Quoter::quoteFromFile(const QString &userFriendlyFilePath, const QString &p
plainLines = splitLines(plainCode);
markedLines = splitLines(markedCode);
if (markedLines.count() != plainLines.count()) {
- codeLocation.warning(tr("Something is wrong with qdoc's handling of marked code"));
+ codeLocation.warning(
+ QStringLiteral("Something is wrong with qdoc's handling of marked code"));
markedLines = plainLines;
}
@@ -189,7 +190,7 @@ QString Quoter::quoteLine(const Location &docLocation, const QString &command,
}
if (pattern.isEmpty()) {
- docLocation.warning(tr("Missing pattern after '\\%1'").arg(command));
+ docLocation.warning(QStringLiteral("Missing pattern after '\\%1'").arg(command));
return QString();
}
@@ -197,8 +198,8 @@ QString Quoter::quoteLine(const Location &docLocation, const QString &command,
return getLine();
if (!silent) {
- docLocation.warning(tr("Command '\\%1' failed").arg(command));
- codeLocation.warning(tr("Pattern '%1' didn't match here").arg(pattern));
+ docLocation.warning(QStringLiteral("Command '\\%1' failed").arg(command));
+ codeLocation.warning(QStringLiteral("Pattern '%1' didn't match here").arg(pattern));
silent = true;
}
return QString();
@@ -305,7 +306,8 @@ bool Quoter::match(const Location &docLocation, const QString &pattern0, const Q
&& pattern.length() > 2) {
QRegularExpression rx(pattern.mid(1, pattern.length() - 2));
if (!silent && !rx.isValid()) {
- docLocation.warning(tr("Invalid regular expression '%1'").arg(rx.pattern()));
+ docLocation.warning(
+ QStringLiteral("Invalid regular expression '%1'").arg(rx.pattern()));
silent = true;
}
return str.indexOf(rx) != -1;
@@ -319,9 +321,9 @@ void Quoter::failedAtEnd(const Location &docLocation, const QString &command)
{
if (!silent && !command.isEmpty()) {
if (codeLocation.filePath().isEmpty()) {
- docLocation.warning(tr("Unexpected '\\%1'").arg(command));
+ docLocation.warning(QStringLiteral("Unexpected '\\%1'").arg(command));
} else {
- docLocation.warning(tr("Command '\\%1' failed at end of file '%2'")
+ docLocation.warning(QStringLiteral("Command '\\%1' failed at end of file '%2'")
.arg(command)
.arg(codeLocation.filePath()));
}
diff --git a/src/qdoc/quoter.h b/src/qdoc/quoter.h
index ed21828cf..44f3ee18a 100644
--- a/src/qdoc/quoter.h
+++ b/src/qdoc/quoter.h
@@ -42,8 +42,6 @@ QT_BEGIN_NAMESPACE
class Quoter
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::Quoter)
-
public:
Quoter();
diff --git a/src/qdoc/tokenizer.cpp b/src/qdoc/tokenizer.cpp
index 8359313aa..dd2282995 100644
--- a/src/qdoc/tokenizer.cpp
+++ b/src/qdoc/tokenizer.cpp
@@ -235,8 +235,9 @@ int Tokenizer::getToken()
yyCh = getChar();
if (yyCh == EOF)
- yyTokLoc.warning(tr("Unterminated C++ string literal"),
- tr("Maybe you forgot '/*!' at the beginning of the file?"));
+ yyTokLoc.warning(
+ QStringLiteral("Unterminated C++ string literal"),
+ QStringLiteral("Maybe you forgot '/*!' at the beginning of the file?"));
else
return Tok_String;
break;
@@ -270,7 +271,7 @@ int Tokenizer::getToken()
} while (yyCh != EOF && yyCh != '\'');
if (yyCh == EOF) {
- yyTokLoc.warning(tr("Unterminated C++ character literal"));
+ yyTokLoc.warning(QStringLiteral("Unterminated C++ character literal"));
} else {
yyCh = getChar();
return Tok_Number;
@@ -365,7 +366,7 @@ int Tokenizer::getToken()
while (!metAsterSlash) {
if (yyCh == EOF) {
- yyTokLoc.warning(tr("Unterminated C++ comment"));
+ yyTokLoc.warning(QStringLiteral("Unterminated C++ comment"));
break;
} else {
if (yyCh == '*') {
@@ -479,8 +480,8 @@ int Tokenizer::getToken()
if (yyNumPreprocessorSkipping == 0
&& !(yyTokLoc.fileName().endsWith(".qdoc")
|| yyTokLoc.fileName().endsWith(".js"))) {
- yyTokLoc.warning(
- tr("Hostile character 0x%1 in C++ source").arg((uchar)yyCh, 1, 16));
+ yyTokLoc.warning(QStringLiteral("Hostile character 0x%1 in C++ source")
+ .arg((uchar)yyCh, 1, 16));
}
yyCh = getChar();
}
@@ -488,7 +489,7 @@ int Tokenizer::getToken()
}
if (yyPreprocessorSkipping.count() > 1) {
- yyTokLoc.warning(tr("Expected #endif before end of file"));
+ yyTokLoc.warning(QStringLiteral("Expected #endif before end of file"));
// clear it out or we get an infinite loop!
while (!yyPreprocessorSkipping.isEmpty()) {
popSkipping();
@@ -721,7 +722,7 @@ void Tokenizer::pushSkipping(bool skip)
bool Tokenizer::popSkipping()
{
if (yyPreprocessorSkipping.isEmpty()) {
- yyTokLoc.warning(tr("Unexpected #elif, #else or #endif"));
+ yyTokLoc.warning(QStringLiteral("Unexpected #elif, #else or #endif"));
return true;
}
diff --git a/src/qdoc/tokenizer.h b/src/qdoc/tokenizer.h
index 64f188f07..9842b6761 100644
--- a/src/qdoc/tokenizer.h
+++ b/src/qdoc/tokenizer.h
@@ -148,8 +148,6 @@ enum {
class Tokenizer
{
- Q_DECLARE_TR_FUNCTIONS(QDoc::Tokenizer)
-
public:
Tokenizer(const Location &loc, const QByteArray &in);
Tokenizer(const Location &loc, QFile &file);
diff --git a/src/qdoc/xmlgenerator.cpp b/src/qdoc/xmlgenerator.cpp
index a04c24464..f5866d121 100644
--- a/src/qdoc/xmlgenerator.cpp
+++ b/src/qdoc/xmlgenerator.cpp
@@ -322,8 +322,9 @@ QString XmlGenerator::linkForNode(const Node *node, const Node *relative)
if (Generator::qmlTypeContext()->inherits(node->parent())) {
fn = fileName(Generator::qmlTypeContext());
} else if (node->parent()->isInternal()) {
- node->doc().location().warning(tr("Cannot link to property in internal type '%1'")
- .arg(node->parent()->name()));
+ node->doc().location().warning(
+ QStringLiteral("Cannot link to property in internal type '%1'")
+ .arg(node->parent()->name()));
return QString();
}
}