diff options
Diffstat (limited to 'src/tools/qdoc')
-rw-r--r-- | src/tools/qdoc/codemarker.cpp | 7 | ||||
-rw-r--r-- | src/tools/qdoc/codemarker.h | 2 | ||||
-rw-r--r-- | src/tools/qdoc/config.cpp | 6 | ||||
-rw-r--r-- | src/tools/qdoc/cppcodemarker.cpp | 20 | ||||
-rw-r--r-- | src/tools/qdoc/cppcodeparser.cpp | 2 | ||||
-rw-r--r-- | src/tools/qdoc/doc/examples/examples.qdoc | 6 | ||||
-rw-r--r-- | src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc | 2 | ||||
-rw-r--r-- | src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc | 6 | ||||
-rw-r--r-- | src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc | 6 | ||||
-rw-r--r-- | src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc | 2 | ||||
-rw-r--r-- | src/tools/qdoc/generator.cpp | 6 | ||||
-rw-r--r-- | src/tools/qdoc/htmlgenerator.cpp | 22 | ||||
-rw-r--r-- | src/tools/qdoc/node.h | 2 | ||||
-rw-r--r-- | src/tools/qdoc/puredocparser.cpp | 2 | ||||
-rw-r--r-- | src/tools/qdoc/qdocdatabase.cpp | 14 | ||||
-rw-r--r-- | src/tools/qdoc/qdocindexfiles.cpp | 108 | ||||
-rw-r--r-- | src/tools/qdoc/qdocindexfiles.h | 3 | ||||
-rw-r--r-- | src/tools/qdoc/qmlvisitor.cpp | 2 |
18 files changed, 128 insertions, 90 deletions
diff --git a/src/tools/qdoc/codemarker.cpp b/src/tools/qdoc/codemarker.cpp index 458799fc27..a668205a66 100644 --- a/src/tools/qdoc/codemarker.cpp +++ b/src/tools/qdoc/codemarker.cpp @@ -210,7 +210,7 @@ void CodeMarker::appendProtectedString(QString *output, const QStringRef &str) } } -QString CodeMarker::typified(const QString &string) +QString CodeMarker::typified(const QString &string, bool trailingSpace) { QString result; QString pendingWord; @@ -254,6 +254,11 @@ QString CodeMarker::typified(const QString &string) } } } + if (trailingSpace && string.size()) { + if (!string.endsWith(QLatin1Char('*')) + && !string.endsWith(QLatin1Char('&'))) + result += QLatin1Char(' '); + } return result; } diff --git a/src/tools/qdoc/codemarker.h b/src/tools/qdoc/codemarker.h index 31a9f3a254..011c8623dd 100644 --- a/src/tools/qdoc/codemarker.h +++ b/src/tools/qdoc/codemarker.h @@ -159,7 +159,7 @@ public: static const Node *nodeForString(const QString& string); static QString stringForNode(const Node *node); - QString typified(const QString &string); + QString typified(const QString &string, bool trailingSpace = false); protected: virtual QString sortName(const Node *node, const QString* name = 0); diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp index ae6bbaf5da..6c47b86d22 100644 --- a/src/tools/qdoc/config.cpp +++ b/src/tools/qdoc/config.cpp @@ -493,7 +493,7 @@ QStringList Config::getCanonicalPathList(const QString& var, bool validate) cons QDir dir(sl[i].simplified()); QString path = dir.path(); if (dir.isRelative()) - dir.setPath(d + "/" + path); + dir.setPath(d + QLatin1Char('/') + path); if (validate && !QFileInfo::exists(dir.path())) lastLocation_.warning(tr("Cannot find file or directory: %1").arg(path)); else @@ -889,7 +889,7 @@ QStringList Config::loadMaster(const QString& fileName) if (!fin.open(QFile::ReadOnly | QFile::Text)) { if (!Config::installDir.isEmpty()) { int prefix = location.filePath().length() - location.fileName().length(); - fin.setFileName(Config::installDir + "/" + fileName.right(fileName.length() - prefix)); + fin.setFileName(Config::installDir + QLatin1Char('/') + fileName.right(fileName.length() - prefix)); } if (!fin.open(QFile::ReadOnly | QFile::Text)) location.fatal(tr("Cannot open master qdocconf file '%1': %2").arg(fileName).arg(fin.errorString())); @@ -945,7 +945,7 @@ void Config::load(Location location, const QString& fileName) if (!fin.open(QFile::ReadOnly | QFile::Text)) { if (!Config::installDir.isEmpty()) { int prefix = location.filePath().length() - location.fileName().length(); - fin.setFileName(Config::installDir + "/" + fileName.right(fileName.length() - prefix)); + fin.setFileName(Config::installDir + QLatin1Char('/') + 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())); diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp index 774ff115b9..01ff827d58 100644 --- a/src/tools/qdoc/cppcodemarker.cpp +++ b/src/tools/qdoc/cppcodemarker.cpp @@ -150,18 +150,18 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node, case Node::QmlSignalHandler: case Node::QmlMethod: func = (const FunctionNode *) node; + if (style != Subpage && !func->returnType().isEmpty()) - synopsis = typified(func->returnType()) + QLatin1Char(' '); + synopsis = typified(func->returnType(), true); synopsis += name; if (func->metaness() != FunctionNode::MacroWithoutParams) { - synopsis += "("; + synopsis += QLatin1Char('('); if (!func->parameters().isEmpty()) { - //synopsis += QLatin1Char(' '); QVector<Parameter>::ConstIterator p = func->parameters().constBegin(); while (p != func->parameters().constEnd()) { if (p != func->parameters().constBegin()) synopsis += ", "; - synopsis += typified((*p).dataType()); + synopsis += typified((*p).dataType(), true); if (style != Subpage && !(*p).name().isEmpty()) synopsis += "<@param>" + protect((*p).name()) + "</@param>"; @@ -170,7 +170,6 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node, synopsis += " = " + protect((*p).defaultValue()); ++p; } - //synopsis += QLatin1Char(' '); } synopsis += QLatin1Char(')'); } @@ -273,7 +272,7 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node, synopsis = name + " : " + typified(variable->dataType()); } else { - synopsis = typified(variable->leftType()) + QLatin1Char(' ') + + synopsis = typified(variable->leftType(), true) + name + protect(variable->rightType()); } break; @@ -323,7 +322,7 @@ QString CppCodeMarker::markedUpQmlItem(const Node* node, bool summary) (node->type() == Node::QmlSignalHandler)) { const FunctionNode* func = static_cast<const FunctionNode*>(node); if (!func->returnType().isEmpty()) - synopsis = typified(func->returnType()) + QLatin1Char(' ') + name; + synopsis = typified(func->returnType(), true) + name; else synopsis = name; synopsis += QLatin1Char('('); @@ -332,12 +331,9 @@ QString CppCodeMarker::markedUpQmlItem(const Node* node, bool summary) while (p != func->parameters().constEnd()) { if (p != func->parameters().constBegin()) synopsis += ", "; - synopsis += typified((*p).dataType()); - if (!(*p).name().isEmpty()) { - if (!synopsis.endsWith(QLatin1Char('('))) - synopsis += QLatin1Char(' '); + synopsis += typified((*p).dataType(), true); + if (!(*p).name().isEmpty()) synopsis += "<@param>" + protect((*p).name()) + "</@param>"; - } synopsis += protect((*p).rightType()); ++p; } diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp index 5d2a2c90d0..f20b998cc4 100644 --- a/src/tools/qdoc/cppcodeparser.cpp +++ b/src/tools/qdoc/cppcodeparser.cpp @@ -2321,7 +2321,7 @@ bool CppCodeParser::matchDocsAndStuff() QString topics; QSet<QString>::ConstIterator t = topicCommandsUsed.constBegin(); while (t != topicCommandsUsed.constEnd()) { - topics += " \\" + *t + ","; + topics += " \\" + *t + QLatin1Char(','); ++t; } topics[topics.lastIndexOf(',')] = '.'; diff --git a/src/tools/qdoc/doc/examples/examples.qdoc b/src/tools/qdoc/doc/examples/examples.qdoc index ce67dea20e..28810e30da 100644 --- a/src/tools/qdoc/doc/examples/examples.qdoc +++ b/src/tools/qdoc/doc/examples/examples.qdoc @@ -89,9 +89,9 @@ \title UI Components \brief Basic set of UI components - This is a listing of a list of UI components implemented by QML types. - These files are available for general import and they are based off the - \e {Qt Quick Code Samples}. + This is a listing of a list of UI components implemented by QML types. These + files are available for general import and they are based on the + \l{Qt Quick Examples and Tutorials}{Qt Quick Code Samples}. This module is part of the \l{componentset}{UIComponents} example. */ diff --git a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc index a2e851293c..d707c77cfb 100644 --- a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc @@ -269,7 +269,7 @@ library.} It is provided to keep old source code working. We strongly advise against using it in new code. See the \l - {http://doc.qt.digia.com/4.0/porting4.html} {Porting + {http://doc.qt.io/qt-4.8/porting4.html} {Porting Guide} for more information. \endquotation diff --git a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc index d490f8549a..69980c1e18 100644 --- a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc @@ -1392,8 +1392,8 @@ \endcode The complete variable entry in \l qtgui.qdocconf provides the - standard header of the \l {http://doc.qt.digia.com/} - {Qt Reference Documentation}. + standard header of the \l {http://doc.qt.io/qt-5/qtgui-index.html} + {Qt GUI Documentation}. \target HTML.style-variable \section1 HTML.style @@ -1521,7 +1521,7 @@ This makes sure that whenever \c qt.index is used to generate references to for example Qt classes, the base URL is \c - http://doc.qt.digia.com/4.7. + http://doc.qt.io/qt-4.8/. See also \l indexes. diff --git a/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc index 306fc40cb8..1dfd031633 100644 --- a/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc @@ -812,7 +812,7 @@ <tr valign="top" bgcolor="#d0d0d0"> <td><b> - <a href="http://doc.qt.digia.com/4.0/qftp.html">QFtp</a> + <a href="http://doc.qt.io/archives/qt-4.7/qftp.html">QFtp</a> </b></td> <td> Implementation of the FTP protocol @@ -885,7 +885,7 @@ <pre>#include <Qt></pre> <ul> <li> - <a href="http://doc.qt.digia.com/4.0/qt-qt3.html"> + <a href="http://doc.qt.io/archives/qt-4.7/qt-qt3.html"> Qt 3 support members</a></li> </ul> @@ -893,7 +893,7 @@ <h3>Types</h3> <ul> <li>flags - <a href="http://doc.qt.digia.com/4.0/qt.html#AlignmentFlag-enum">Alignment</a></b></li> + <a href="http://doc.qt.io/archives/qt-4.7/qt.html#AlignmentFlag-enum">Alignment</a></b></li> <li>...</li></ul> <hr /> \endraw diff --git a/src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc b/src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc index 66ceed4a3d..1fcd23a0f8 100644 --- a/src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc +++ b/src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! \page qdoc-minimum-qdocconf.html -\target minimal-qdocconf +\keyword minimal-qdocconf \title A Minimal qdocconf File \brief Describes a minimal .qdocconf file diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 5037d95640..3ce5bf99d0 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -1500,7 +1500,7 @@ void Generator::generateOverloadedSignal(const Node* node, CodeMarker* marker) // We have an overloaded signal, show an example QString code = "connect(" + objectName + ", static_cast<" + func->returnType() - + "(" + func->parent()->name() + "::*)("; + + QLatin1Char('(') + func->parent()->name() + "::*)("; for (int i = 0; i < func->parameters().size(); ++i) { if (i != 0) code += ", "; @@ -1508,7 +1508,7 @@ void Generator::generateOverloadedSignal(const Node* node, CodeMarker* marker) code += p.dataType() + p.rightType(); } - code += ")"; + code += QLatin1Char(')'); if (func->isConst()) code += " const"; code += ">(&" + func->parent()->name() + "::" + func->name() + "),\n [=]("; @@ -1519,7 +1519,7 @@ void Generator::generateOverloadedSignal(const Node* node, CodeMarker* marker) const Parameter &p = func->parameters().at(i); code += p.dataType(); if (code[code.size()-1].isLetterOrNumber()) - code += " "; + code += QLatin1Char(' '); code += p.name() + p.rightType(); } diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index eaa6de42ef..90f8ab2046 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -1191,7 +1191,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark if (unit < 3) { out() << "id=\"" << Doc::canonicalTitle(Text::sectionHeading(atom).toString()) << "\""; } - out() << ">"; + out() << '>'; inSectionHeading_ = true; break; } @@ -1228,18 +1228,18 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark if (!p1.isEmpty()) { if (p1 == QLatin1String("borderless")) attr = p1; - else if (p1.contains("%")) + else if (p1.contains(QLatin1Char('%'))) width = p1; } if (!p2.isEmpty()) { if (p2 == QLatin1String("borderless")) attr = p2; - else if (p2.contains("%")) + else if (p2.contains(QLatin1Char('%'))) width = p2; } - out() << "<div class=\"table\"><table class=\"" << attr << "\""; + out() << "<div class=\"table\"><table class=\"" << attr << '"'; if (!width.isEmpty()) - out() << " width=\"" << width << "\""; + out() << " width=\"" << width << '"'; out() << ">\n "; numTableRows_ = 0; } @@ -1288,7 +1288,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark out() << p; } else { - QStringList spans = p.split(","); + QStringList spans = p.split(QLatin1Char(',')); if (spans.size() == 2) { if (spans.at(0) != "1") out() << " colspan=\"" << spans.at(0) << '"'; @@ -2216,7 +2216,7 @@ void HtmlGenerator::generateRequisites(Aggregate *inner, CodeMarker *marker) out() << "<tr>" << "<td class=\"memItemLeft rightAlign topAlign\"> " << *i << ":" - << "</td><td class=\"memItemRight bottomAlign\"> "; + "</td><td class=\"memItemRight bottomAlign\"> "; if (*i == headerText) out() << requisites.value(*i).toString(); @@ -2262,7 +2262,7 @@ void HtmlGenerator::generateQmlRequisites(QmlTypeNode *qcn, CodeMarker *marker) else logicalModuleVersion = qcn->logicalModuleVersion(); text.clear(); - text << "import " + qcn->logicalModuleName() + " " + logicalModuleVersion; + text << "import " + qcn->logicalModuleName() + QLatin1Char(' ') + logicalModuleVersion; requisites.insert(importText, text); //add the since and project into the map @@ -3150,7 +3150,7 @@ void HtmlGenerator::generateQmlItem(const Node *node, } marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"), "<i>\\1<sub>\\2</sub></i>"); - marked.replace("<@param>", "<i> "); + marked.replace("<@param>", "<i>"); marked.replace("</@param>", "</i>"); if (summary) @@ -3390,7 +3390,7 @@ void HtmlGenerator::generateSynopsis(const Node *node, } marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"), "<i>\\1<sub>\\2</sub></i>"); - marked.replace("<@param>", "<i> "); + marked.replace("<@param>", "<i>"); marked.replace("</@param>", "</i>"); if (style == CodeMarker::Summary) { @@ -3820,7 +3820,7 @@ QString HtmlGenerator::getAutoLink(const Atom *atom, const Node *relative, const int hashtag = link.lastIndexOf(QChar('#')); if (hashtag != -1) link.truncate(hashtag); - link += "#" + ref; + link += QLatin1Char('#') + ref; } return link; } diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h index 6262cee0ab..6b1032805f 100644 --- a/src/tools/qdoc/node.h +++ b/src/tools/qdoc/node.h @@ -1134,7 +1134,7 @@ class CollectionNode : public Aggregate virtual QString logicalModuleName() const Q_DECL_OVERRIDE { return logicalModuleName_; } virtual QString logicalModuleVersion() const Q_DECL_OVERRIDE { - return logicalModuleVersionMajor_ + "." + logicalModuleVersionMinor_; + return logicalModuleVersionMajor_ + QLatin1Char('.') + logicalModuleVersionMinor_; } virtual QString logicalModuleIdentifier() const Q_DECL_OVERRIDE { return logicalModuleName_ + logicalModuleVersionMajor_; diff --git a/src/tools/qdoc/puredocparser.cpp b/src/tools/qdoc/puredocparser.cpp index 80a7ec4bf5..b47f1fc453 100644 --- a/src/tools/qdoc/puredocparser.cpp +++ b/src/tools/qdoc/puredocparser.cpp @@ -173,7 +173,7 @@ bool PureDocParser::processQdocComments() QString topics; QSet<QString>::ConstIterator t = topicCommandsUsed.constBegin(); while (t != topicCommandsUsed.constEnd()) { - topics += " \\" + *t + ","; + topics += " \\" + *t + QLatin1Char(','); ++t; } topics[topics.lastIndexOf(',')] = '.'; diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index ca1648ec2f..d48804d566 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -340,10 +340,10 @@ void QDocForest::printLinkCounts(const QString& project) while (i != m.end()) { QString line = " " + i.value(); if (i.value() != module) - depends += " " + i.value(); + depends += QLatin1Char(' ') + i.value(); int pad = 30 - line.length(); for (int k=0; k<pad; ++k) - line += " "; + line += QLatin1Char(' '); line += "%1"; Location::null.report(line.arg(-(i.key()))); ++i; @@ -370,7 +370,7 @@ QString QDocForest::getLinkCounts(QStringList& strings, QVector<int>& counts) if (i.value() != module) { counts.append(-(i.key())); strings.append(i.value()); - depends += " " + i.value(); + depends += QLatin1Char(' ') + i.value(); } ++i; } @@ -1296,6 +1296,8 @@ void QDocDatabase::resolveIssues() { QDocIndexFiles::qdocIndexFiles()->resolveRelates(); QDocIndexFiles::destroyQDocIndexFiles(); } + if (Generator::generating()) + resolveNamespaces(); } void QDocDatabase::resolveStuff() @@ -1326,8 +1328,10 @@ void QDocDatabase::resolveNamespaces() int count = nmm_.remove(s); if (count > 1) { foreach (Node* n, nodes) { - if (n->isNamespace() && n->wasSeen()) { + // Treat public namespaces from index trees as 'seen' + if (n->isNamespace() && (n->wasSeen() || (n->isIndexNode() && n->access() == Node::Public))) { ns = static_cast<NamespaceNode*>(n); + ns->markSeen(); break; } } @@ -1670,7 +1674,7 @@ const Node* QDocDatabase::findNodeForAtom(const Atom* a, const Node* relative, Q const Node* node = 0; Atom* atom = const_cast<Atom*>(a); - QStringList targetPath = atom->string().split("#"); + QStringList targetPath = atom->string().split(QLatin1Char('#')); QString first = targetPath.first().trimmed(); Tree* domain = 0; diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp index fc262d9834..ef86d782c7 100644 --- a/src/tools/qdoc/qdocindexfiles.cpp +++ b/src/tools/qdoc/qdocindexfiles.cpp @@ -463,10 +463,15 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader, location = Location(parent->name().toLower() + ".html"); while (reader.readNextStartElement()) { + QXmlStreamAttributes childAttributes = reader.attributes(); if (reader.name() == QLatin1String("value")) { - QXmlStreamAttributes childAttributes = reader.attributes(); + EnumItem item(childAttributes.value(QLatin1String("name")).toString(), childAttributes.value(QLatin1String("value")).toString()); enumNode->addItem(item); + } else if (reader.name() == QLatin1String("keyword")) { + insertTarget(TargetRec::Keyword, childAttributes, enumNode); + } else if (reader.name() == QLatin1String("target")) { + insertTarget(TargetRec::Target, childAttributes, enumNode); } reader.skipCurrentElement(); } @@ -552,8 +557,8 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader, */ while (reader.readNextStartElement()) { + QXmlStreamAttributes childAttributes = reader.attributes(); if (reader.name() == QLatin1String("parameter")) { - QXmlStreamAttributes childAttributes = reader.attributes(); // Do not use the default value for the parameter; it is not // required, and has been known to cause problems. Parameter parameter(childAttributes.value(QLatin1String("left")).toString(), @@ -561,6 +566,10 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader, childAttributes.value(QLatin1String("name")).toString(), QString()); // childAttributes.value(QLatin1String("default")) functionNode->addParameter(parameter); + } else if (reader.name() == QLatin1String("keyword")) { + insertTarget(TargetRec::Keyword, childAttributes, functionNode); + } else if (reader.name() == QLatin1String("target")) { + insertTarget(TargetRec::Target, childAttributes, functionNode); } reader.skipCurrentElement(); } @@ -581,18 +590,15 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader, location = Location(parent->name().toLower() + ".html"); } else if (elementName == QLatin1String("keyword")) { - QString title = attributes.value(QLatin1String("title")).toString(); - qdb_->insertTarget(name, title, TargetRec::Keyword, current, 1); + insertTarget(TargetRec::Keyword, attributes, current); goto done; } else if (elementName == QLatin1String("target")) { - QString title = attributes.value(QLatin1String("title")).toString(); - qdb_->insertTarget(name, title, TargetRec::Target, current, 2); + insertTarget(TargetRec::Target, attributes, current); goto done; } else if (elementName == QLatin1String("contents")) { - QString title = attributes.value(QLatin1String("title")).toString(); - qdb_->insertTarget(name, title, TargetRec::Contents, current, 3); + insertTarget(TargetRec::Contents, attributes, current); goto done; } else @@ -660,7 +666,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader, QString groupsAttr = attributes.value(QLatin1String("groups")).toString(); if (!groupsAttr.isEmpty()) { - QStringList groupNames = groupsAttr.split(","); + QStringList groupNames = groupsAttr.split(QLatin1Char(',')); foreach (const QString &name, groupNames) { qdb_->addToGroup(name, node); } @@ -702,6 +708,30 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader, } } +void QDocIndexFiles::insertTarget(TargetRec::TargetType type, + const QXmlStreamAttributes &attributes, + Node *node) +{ + int priority; + switch (type) { + case TargetRec::Keyword: + priority = 1; + break; + case TargetRec::Target: + priority = 2; + break; + case TargetRec::Contents: + priority = 3; + break; + default: + return; + } + + QString name = attributes.value(QLatin1String("name")).toString(); + QString title = attributes.value(QLatin1String("title")).toString(); + qdb_->insertTarget(name, title, type, node, priority); +} + /*! This function tries to resolve class inheritance immediately after the index file is read. It is not always possible to @@ -946,27 +976,27 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, } writer.writeAttribute("name", objName); - if (node->isQmlModule()) { - logicalModuleName = node->logicalModuleName(); - logicalModuleVersion = node->logicalModuleVersion(); - if (!logicalModuleName.isEmpty()) { - writer.writeAttribute("qml-module-name", logicalModuleName); - if (node->isQmlModule()) - writer.writeAttribute("qml-module-version", logicalModuleVersion); - if (!qmlFullBaseName.isEmpty()) - writer.writeAttribute("qml-base-type", qmlFullBaseName); + + // Write module and base type info for QML/JS types + if (node->type() == Node::QmlType || node->type() == Node::QmlModule) { + QString baseNameAttr("qml-base-type"); + QString moduleNameAttr("qml-module-name"); + QString moduleVerAttr("qml-module-version"); + if (node->isJsNode()) { + baseNameAttr = "js-base-type"; + moduleNameAttr = "js-module-name"; + moduleVerAttr = "js-module-version"; } - } - else if (node->isJsModule()) { - logicalModuleName = node->logicalModuleName(); - logicalModuleVersion = node->logicalModuleVersion(); - if (!logicalModuleName.isEmpty()) { - writer.writeAttribute("js-module-name", logicalModuleName); - if (node->isQmlModule()) - writer.writeAttribute("js-module-version", logicalModuleVersion); - if (!qmlFullBaseName.isEmpty()) - writer.writeAttribute("js-base-type", qmlFullBaseName); + if (node->type() == Node::QmlModule) { + logicalModuleName = node->logicalModuleName(); + logicalModuleVersion = node->logicalModuleVersion(); } + if (!logicalModuleName.isEmpty()) + writer.writeAttribute(moduleNameAttr, logicalModuleName); + if (!logicalModuleVersion.isEmpty()) + writer.writeAttribute(moduleVerAttr, logicalModuleVersion); + if (!qmlFullBaseName.isEmpty()) + writer.writeAttribute(baseNameAttr, qmlFullBaseName); } QString href; @@ -1029,11 +1059,11 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, baseStrings.insert(n->fullName()); } if (!baseStrings.isEmpty()) - writer.writeAttribute("bases", QStringList(baseStrings.toList()).join(",")); + writer.writeAttribute("bases", QStringList(baseStrings.toList()).join(QLatin1Char(','))); if (!node->physicalModuleName().isEmpty()) writer.writeAttribute("module", node->physicalModuleName()); if (!classNode->groupNames().isEmpty()) - writer.writeAttribute("groups", classNode->groupNames().join(",")); + writer.writeAttribute("groups", classNode->groupNames().join(QLatin1Char(','))); if (!brief.isEmpty()) writer.writeAttribute("brief", brief); } @@ -1044,7 +1074,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, if (!namespaceNode->physicalModuleName().isEmpty()) writer.writeAttribute("module", namespaceNode->physicalModuleName()); if (!namespaceNode->groupNames().isEmpty()) - writer.writeAttribute("groups", namespaceNode->groupNames().join(",")); + writer.writeAttribute("groups", namespaceNode->groupNames().join(QLatin1Char(','))); if (!brief.isEmpty()) writer.writeAttribute("brief", brief); } @@ -1056,7 +1086,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, writer.writeAttribute("fulltitle", qcn->fullTitle()); writer.writeAttribute("subtitle", qcn->subTitle()); if (!qcn->groupNames().isEmpty()) - writer.writeAttribute("groups", qcn->groupNames().join(",")); + writer.writeAttribute("groups", qcn->groupNames().join(QLatin1Char(','))); if (!brief.isEmpty()) writer.writeAttribute("brief", brief); } @@ -1098,7 +1128,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, writer.writeAttribute("module", node->physicalModuleName()); } if (!docNode->groupNames().isEmpty()) - writer.writeAttribute("groups", docNode->groupNames().join(",")); + writer.writeAttribute("groups", docNode->groupNames().join(QLatin1Char(','))); if (!brief.isEmpty()) writer.writeAttribute("brief", brief); } @@ -1113,7 +1143,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, if (!cn->physicalModuleName().isEmpty()) writer.writeAttribute("module", cn->physicalModuleName()); if (!cn->groupNames().isEmpty()) - writer.writeAttribute("groups", cn->groupNames().join(",")); + writer.writeAttribute("groups", cn->groupNames().join(QLatin1Char(','))); /* This is not read back in, so it probably shouldn't be written out in the first place. @@ -1122,7 +1152,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, QStringList names; foreach (const Node* member, cn->members()) names.append(member->name()); - writer.writeAttribute("members", names.join(",")); + writer.writeAttribute("members", names.join(QLatin1Char(','))); } if (!brief.isEmpty()) writer.writeAttribute("brief", brief); @@ -1138,7 +1168,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, if (!cn->physicalModuleName().isEmpty()) writer.writeAttribute("module", cn->physicalModuleName()); if (!cn->groupNames().isEmpty()) - writer.writeAttribute("groups", cn->groupNames().join(",")); + writer.writeAttribute("groups", cn->groupNames().join(QLatin1Char(','))); /* This is not read back in, so it probably shouldn't be written out in the first place. @@ -1147,7 +1177,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, QStringList names; foreach (const Node* member, cn->members()) names.append(member->name()); - writer.writeAttribute("members", names.join(",")); + writer.writeAttribute("members", names.join(QLatin1Char(','))); } if (!brief.isEmpty()) writer.writeAttribute("brief", brief); @@ -1163,7 +1193,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, if (!cn->physicalModuleName().isEmpty()) writer.writeAttribute("module", cn->physicalModuleName()); if (!cn->groupNames().isEmpty()) - writer.writeAttribute("groups", cn->groupNames().join(",")); + writer.writeAttribute("groups", cn->groupNames().join(QLatin1Char(','))); /* This is not read back in, so it probably shouldn't be written out in the first place. @@ -1172,7 +1202,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, QStringList names; foreach (const Node* member, cn->members()) names.append(member->name()); - writer.writeAttribute("members", names.join(",")); + writer.writeAttribute("members", names.join(QLatin1Char(','))); } if (!brief.isEmpty()) writer.writeAttribute("brief", brief); diff --git a/src/tools/qdoc/qdocindexfiles.h b/src/tools/qdoc/qdocindexfiles.h index 67a7e7226e..9873322b3b 100644 --- a/src/tools/qdoc/qdocindexfiles.h +++ b/src/tools/qdoc/qdocindexfiles.h @@ -35,6 +35,7 @@ #define QDOCINDEXFILES_H #include "node.h" +#include "tree.h" QT_BEGIN_NAMESPACE @@ -43,6 +44,7 @@ class Generator; class QStringList; class QDocDatabase; class QXmlStreamWriter; +class QXmlStreamAttributes; class QDocIndexFiles { @@ -64,6 +66,7 @@ class QDocIndexFiles void readIndexFile(const QString& path); void readIndexSection(QXmlStreamReader &reader, Node* current, const QString& indexUrl); + void insertTarget(TargetRec::TargetType type, const QXmlStreamAttributes &attributes, Node *node); void resolveIndex(); void resolveRelates(); bool generateIndexSection(QXmlStreamWriter& writer, Node* node, bool generateInternalNodes = false); diff --git a/src/tools/qdoc/qmlvisitor.cpp b/src/tools/qdoc/qmlvisitor.cpp index 155e1de054..0cb4d84513 100644 --- a/src/tools/qdoc/qmlvisitor.cpp +++ b/src/tools/qdoc/qmlvisitor.cpp @@ -624,7 +624,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiImport *import) QString version = document.mid(import->versionToken.offset, import->versionToken.length); QString importId = document.mid(import->importIdToken.offset, import->importIdToken.length); QString importUri = getFullyQualifiedId(import->importUri); - QString reconstructed = importUri + QString(" ") + version; + QString reconstructed = importUri + QLatin1Char(' ') + version; importList.append(ImportRec(name, version, importId, importUri)); return true; |