diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-09-25 14:02:04 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-09-25 14:02:04 +0200 |
commit | a1ad9a74ebb3c556c5f70f7e03be68b09598ac53 (patch) | |
tree | 615a96db418219a57a745a5899e39a9ac90744ec /src/tools | |
parent | 6d78b7a0c46ea04f4bb771d960e2f7dff1362341 (diff) | |
parent | 462f355e4fb16cc7a1838fa2dda0f763eee58c84 (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
src/corelib/io/io.pri
src/corelib/io/qdatastream.cpp
src/corelib/io/qdatastream.h
src/network/socket/qabstractsocket.cpp
src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h
src/widgets/styles/qgtkstyle.cpp
tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/qmimedatabase-cache.pro
tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/qmimedatabase-xml.pro
tests/auto/dbus/qdbusconnection/qdbusconnection.pro
tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp
tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
Change-Id: I347549a024eb5bfa986699e0a11f96cc55c797a7
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/qdoc/config.cpp | 2 | ||||
-rw-r--r-- | src/tools/qdoc/config.h | 4 | ||||
-rw-r--r-- | src/tools/qdoc/cppcodeparser.cpp | 15 | ||||
-rw-r--r-- | src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc | 19 | ||||
-rw-r--r-- | src/tools/qdoc/generator.cpp | 6 | ||||
-rw-r--r-- | src/tools/qdoc/generator.h | 4 | ||||
-rw-r--r-- | src/tools/qdoc/htmlgenerator.cpp | 17 | ||||
-rw-r--r-- | src/tools/qdoc/htmlgenerator.h | 2 | ||||
-rw-r--r-- | src/tools/qdoc/main.cpp | 4 | ||||
-rw-r--r-- | src/tools/qdoc/node.cpp | 119 | ||||
-rw-r--r-- | src/tools/qdoc/node.h | 3 | ||||
-rw-r--r-- | src/tools/qdoc/qdocdatabase.cpp | 40 | ||||
-rw-r--r-- | src/tools/qdoc/qdocindexfiles.cpp | 31 | ||||
-rw-r--r-- | src/tools/qdoc/qdocindexfiles.h | 1 | ||||
-rw-r--r-- | src/tools/qdoc/tree.cpp | 11 |
15 files changed, 197 insertions, 81 deletions
diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp index beb0bae291..ae6bbaf5da 100644 --- a/src/tools/qdoc/config.cpp +++ b/src/tools/qdoc/config.cpp @@ -53,6 +53,8 @@ QString ConfigStrings::BASE = QStringLiteral("base"); QString ConfigStrings::BASEDIR = QStringLiteral("basedir"); QString ConfigStrings::BUILDVERSION = QStringLiteral("buildversion"); QString ConfigStrings::CODEINDENT = QStringLiteral("codeindent"); +QString ConfigStrings::CODEPREFIX = QStringLiteral("codeprefix"); +QString ConfigStrings::CODESUFFIX = QStringLiteral("codesuffix"); QString ConfigStrings::CPPCLASSESPAGE = QStringLiteral("cppclassespage"); QString ConfigStrings::DEFINES = QStringLiteral("defines"); QString ConfigStrings::DEPENDS = QStringLiteral("depends"); diff --git a/src/tools/qdoc/config.h b/src/tools/qdoc/config.h index 8d6a124bd1..740568ca0c 100644 --- a/src/tools/qdoc/config.h +++ b/src/tools/qdoc/config.h @@ -165,6 +165,8 @@ struct ConfigStrings static QString BASEDIR; static QString BUILDVERSION; static QString CODEINDENT; + static QString CODEPREFIX; + static QString CODESUFFIX; static QString CPPCLASSESPAGE; static QString DEFINES; static QString DEPENDS; @@ -241,6 +243,8 @@ struct ConfigStrings #define CONFIG_BASEDIR ConfigStrings::BASEDIR #define CONFIG_BUILDVERSION ConfigStrings::BUILDVERSION #define CONFIG_CODEINDENT ConfigStrings::CODEINDENT +#define CONFIG_CODEPREFIX ConfigStrings::CODEPREFIX +#define CONFIG_CODESUFFIX ConfigStrings::CODESUFFIX #define CONFIG_CPPCLASSESPAGE ConfigStrings::CPPCLASSESPAGE #define CONFIG_DEFINES ConfigStrings::DEFINES #define CONFIG_DEPENDS ConfigStrings::DEPENDS diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp index 0f70777256..5d2a2c90d0 100644 --- a/src/tools/qdoc/cppcodeparser.cpp +++ b/src/tools/qdoc/cppcodeparser.cpp @@ -924,10 +924,19 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc, else if (command == COMMAND_RELATES) { QStringList path = arg.split("::"); Node* n = qdb_->findRelatesNode(path); - if (!n) - doc.location().warning(tr("Cannot find '%1' in '\\%2'").arg(arg).arg(COMMAND_RELATES)); - else + if (!n) { + // Store just a string to write to the index file + if (Generator::preparing()) + node->setRelates(arg); + else + doc.location().warning(tr("Cannot find '%1' in '\\%2'").arg(arg).arg(COMMAND_RELATES)); + + } + else if (node->parent() != n) node->setRelates(static_cast<Aggregate*>(n)); + else + doc.location().warning(tr("Invalid use of '\\%1' (already a member of '%2')") + .arg(COMMAND_RELATES, arg)); } else if (command == COMMAND_CONTENTSPAGE) { setLink(node, Node::ContentsLink, arg); diff --git a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc index 2472b0f4fb..d490f8549a 100644 --- a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc @@ -185,6 +185,13 @@ to adjust the appearance of certain types of HTML elements, this level of indentation is not always required. + \target codeprefix-variable + \target codesuffix-variable + \section1 codeprefix, codesuffix + + The \c codeprefix and \c codesuffix variables specify a pair of + strings that each code snippet is enclosed in. + \target defines-variable \section1 defines @@ -727,6 +734,18 @@ command to render a superscript asterisk, but only when generating HTML. + A macro can also take up to seven parameters: + + \badcode + macro.hello = "Hello \1!" + \endcode + + Parameters are passed to macros the same way as to other commands: + + \badcode + \hello World + \endcode + See also \l {alias-variable} {alias}. \target manifestmeta-variable diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 7dfbbb1cb8..5037d95640 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -807,6 +807,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) QVector<Parameter>::ConstIterator p = func->parameters().constBegin(); while (p != func->parameters().constEnd()) { if ((*p).name().isEmpty() && (*p).dataType() != QLatin1String("...") + && (*p).dataType() != QLatin1String("void") && func->name() != QLatin1String("operator++") && func->name() != QLatin1String("operator--")) { node->doc().location().warning(tr("Missing parameter name")); @@ -2114,11 +2115,14 @@ void Generator::terminateGenerator() Trims trailing whitespace off the \a string and returns the trimmed string. */ -QString Generator::trimmedTrailing(const QString& string) +QString Generator::trimmedTrailing(const QString& string, const QString &prefix, const QString &suffix) { QString trimmed = string; while (trimmed.length() > 0 && trimmed[trimmed.length() - 1].isSpace()) trimmed.truncate(trimmed.length() - 1); + + trimmed.append(suffix); + trimmed.prepend(prefix); return trimmed; } diff --git a/src/tools/qdoc/generator.h b/src/tools/qdoc/generator.h index 6c44cd189c..025f516986 100644 --- a/src/tools/qdoc/generator.h +++ b/src/tools/qdoc/generator.h @@ -139,7 +139,9 @@ protected: static QString outputSuffix(const Node* node); static void singularPlural(Text& text, const NodeList& nodes); static void supplementAlsoList(const Node *node, QList<Text> &alsoList); - static QString trimmedTrailing(const QString &string); + static QString trimmedTrailing(const QString &string, + const QString &prefix, + const QString &suffix); static QString sinceTitles[]; void initializeTextOutput(); diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 18d2af5810..eaa6de42ef 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -220,8 +220,9 @@ void HtmlGenerator::initializeGenerator(const Config &config) ++edition; } - // The following line was changed to fix QTBUG-27798 - //codeIndent = config.getInt(CONFIG_CODEINDENT); + codeIndent = config.getInt(CONFIG_CODEINDENT); // QTBUG-27798 + codePrefix = config.getString(CONFIG_CODEPREFIX); + codeSuffix = config.getString(CONFIG_CODESUFFIX); /* The help file write should be allocated once and only once @@ -584,23 +585,23 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark break; case Atom::Code: out() << "<pre class=\"cpp\">" - << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),relative)) + << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),relative), codePrefix, codeSuffix) << "</pre>\n"; break; case Atom::Qml: out() << "<pre class=\"qml\">" - << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),relative)) + << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),relative), codePrefix, codeSuffix) << "</pre>\n"; break; case Atom::JavaScript: out() << "<pre class=\"js\">" - << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),relative)) + << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),relative), codePrefix, codeSuffix) << "</pre>\n"; break; case Atom::CodeNew: out() << "<p>you can rewrite it as</p>\n" << "<pre class=\"cpp\">" - << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),relative)) + << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),relative), codePrefix, codeSuffix) << "</pre>\n"; break; case Atom::CodeOld: @@ -608,7 +609,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark // fallthrough case Atom::CodeBad: out() << "<pre class=\"cpp\">" - << trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string())))) + << trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string()))), codePrefix, codeSuffix) << "</pre>\n"; break; case Atom::DivLeft: @@ -2370,7 +2371,7 @@ void HtmlGenerator::generateIncludes(const Aggregate *inner, CodeMarker *marker) out() << "<pre class=\"cpp\">" << trimmedTrailing(highlightedCode(indent(codeIndent, marker->markedUpIncludes(inner->includes())), - inner)) + inner), codePrefix, codeSuffix) << "</pre>"; } } diff --git a/src/tools/qdoc/htmlgenerator.h b/src/tools/qdoc/htmlgenerator.h index d46fc9ebee..bbb8f12e3e 100644 --- a/src/tools/qdoc/htmlgenerator.h +++ b/src/tools/qdoc/htmlgenerator.h @@ -233,6 +233,8 @@ private: QHash<QString, QString> refMap; int codeIndent; + QString codePrefix; + QString codeSuffix; HelpProjectWriter *helpProjectWriter; bool inObsoleteLink; QRegExp funcLeftParen; diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp index 3833cbb5dd..d6e00b4833 100644 --- a/src/tools/qdoc/main.cpp +++ b/src/tools/qdoc/main.cpp @@ -729,7 +729,7 @@ int main(int argc, char **argv) Location::startLoggingProgress(); /* - The default indent for code is 4. + The default indent for code is 0. The default value for false is 0. The default supported file extensions are cpp, h, qdoc and qml. The default language is c++. @@ -738,7 +738,7 @@ int main(int argc, char **argv) And those are all the default values for configuration variables. */ if (defaults.isEmpty()) { - defaults.insert(CONFIG_CODEINDENT, QLatin1String("4")); + defaults.insert(CONFIG_CODEINDENT, QLatin1String("0")); defaults.insert(CONFIG_FALSEHOODS, QLatin1String("0")); defaults.insert(CONFIG_FILEEXTENSIONS, QLatin1String("*.cpp *.h *.qdoc *.qml")); defaults.insert(CONFIG_LANGUAGE, QLatin1String("Cpp")); diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp index 2e9e7e76be..9740f984f5 100644 --- a/src/tools/qdoc/node.cpp +++ b/src/tools/qdoc/node.cpp @@ -106,8 +106,27 @@ Node::~Node() { if (parent_) parent_->removeChild(this); + if (relatesTo_) + removeRelates(); +} + +/*! + Removes this node from the aggregate's list of related + nodes, or if this node has created a dummy "relates" + aggregate, deletes it. +*/ +void Node::removeRelates() +{ + if (!relatesTo_) + return; + + if (relatesTo_->isDocumentNode() && !relatesTo_->parent()) { + delete relatesTo_; + relatesTo_ = 0; + } else { relatesTo_->removeRelated(this); + } } /*! @@ -463,11 +482,22 @@ bool Node::fromFlagValue(FlagValue fv, bool defaultValue) */ void Node::setRelates(Aggregate *pseudoParent) { - if (relatesTo_) { - relatesTo_->removeRelated(this); - } + if (pseudoParent == parent()) + return; + + removeRelates(); relatesTo_ = pseudoParent; - pseudoParent->related_.append(this); + pseudoParent->addRelated(this); +} + +/*! + Sets the (unresolved) entity \a name that this node relates to. + */ +void Node::setRelates(const QString& name) +{ + removeRelates(); + // Create a dummy aggregate for writing the name into the index + relatesTo_ = new DocumentNode(0, name, Node::NoSubtype, Node::NoPageType); } /*! @@ -711,8 +741,8 @@ void Node::setLocation(const Location& t) */ Aggregate::~Aggregate() { - deleteChildren(); removeFromRelated(); + deleteChildren(); } /*! @@ -945,8 +975,9 @@ void Aggregate::makeUndocumentedChildrenInternal() } /*! - This is where we should set the overload numbers, including - the related non-members. + This is where we set the overload numbers for function nodes. + \note Overload numbers for related non-members are handled + separately. */ void Aggregate::normalizeOverloads() { @@ -1018,23 +1049,6 @@ void Aggregate::normalizeOverloads() ++p; } /* - Add the related non-members here. - */ - if (!related_.isEmpty()) { - foreach (Node* n, related_) { - if (n->isFunction()) { - FunctionNode* fn = static_cast<FunctionNode*>(n); - QMap<QString, Node *>::Iterator p = primaryFunctionMap_.find(fn->name()); - if (p != primaryFunctionMap_.end()) { - secondaryFunctionMap_[fn->name()].append(fn); - fn->setOverloadNumber(secondaryFunctionMap_[fn->name()].size()); - } - else - fn->setOverloadNumber(0); - } - } - } - /* Recursive part. */ NodeList::ConstIterator c = childNodes().constBegin(); @@ -1061,7 +1075,13 @@ void Aggregate::removeFromRelated() */ void Aggregate::deleteChildren() { - NodeList childrenCopy = children_; // `children_` will be changed in ~Node() + NodeList childrenCopy = children_; + // Clear internal collections before deleting child nodes + children_.clear(); + childMap_.clear(); + enumChildren_.clear(); + primaryFunctionMap_.clear(); + secondaryFunctionMap_.clear(); qDeleteAll(childrenCopy); } @@ -1188,7 +1208,9 @@ bool Aggregate::isSameSignature(const FunctionNode *f1, const FunctionNode *f2) void Aggregate::addChild(Node *child) { children_.append(child); - if ((child->type() == Function) || (child->type() == QmlMethod)) { + if (child->type() == Function + || child->type() == QmlMethod + || child->type() == QmlSignal) { FunctionNode *func = static_cast<FunctionNode*>(child); QString name = func->name(); if (!primaryFunctionMap_.contains(name)) { @@ -1233,7 +1255,9 @@ void Aggregate::removeChild(Node *child) { children_.removeAll(child); enumChildren_.removeAll(child); - if (child->type() == Function) { + if (child->type() == Function + || child->type() == QmlMethod + || child->type() == QmlSignal) { QMap<QString, Node *>::Iterator primary = primaryFunctionMap_.find(child->name()); NodeList& overloads = secondaryFunctionMap_[child->name()]; if (primary != primaryFunctionMap_.end() && *primary == child) { @@ -1333,10 +1357,49 @@ QString Node::physicalModuleName() const } /*! + Removes a node from the list of nodes related to this one. + If it is a function node, also remove from the primary/ + secondary function maps. */ void Aggregate::removeRelated(Node *pseudoChild) { related_.removeAll(pseudoChild); + + if (pseudoChild->isFunction()) { + QMap<QString, Node *>::Iterator p = primaryFunctionMap_.find(pseudoChild->name()); + while (p != primaryFunctionMap_.end()) { + if (p.value() == pseudoChild) { + primaryFunctionMap_.erase(p); + break; + } + ++p; + } + NodeList& overloads = secondaryFunctionMap_[pseudoChild->name()]; + overloads.removeAll(pseudoChild); + } +} + +/*! + Adds \a pseudoChild to the list of nodes related to this one. Resolve a correct + overload number for a related non-member function. + */ +void Aggregate::addRelated(Node *pseudoChild) +{ + related_.append(pseudoChild); + + if (pseudoChild->isFunction()) { + FunctionNode* fn = static_cast<FunctionNode*>(pseudoChild); + if (primaryFunctionMap_.contains(pseudoChild->name())) { + secondaryFunctionMap_[pseudoChild->name()].append(pseudoChild); + fn->setOverloadNumber(secondaryFunctionMap_[pseudoChild->name()].size()); + fn->setOverloadFlag(true); + } + else { + primaryFunctionMap_.insert(pseudoChild->name(), pseudoChild); + fn->setOverloadNumber(0); + fn->setOverloadFlag(false); + } + } } /*! @@ -2096,7 +2159,7 @@ QString FunctionNode::signature(bool values) const PropertyNode::FunctionRole PropertyNode::role(const FunctionNode* fn) const { for (int i=0; i<4; i++) { - if (functions_[i].contains((Node*)fn)) + if (functions_[i].contains(const_cast<FunctionNode*>(fn))) return (FunctionRole) i; } return Notifier; diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h index 596a71b6d5..6262cee0ab 100644 --- a/src/tools/qdoc/node.h +++ b/src/tools/qdoc/node.h @@ -178,6 +178,7 @@ public: void setThreadSafeness(ThreadSafeness t) { safeness_ = (unsigned char) t; } void setSince(const QString &since); void setRelates(Aggregate* pseudoParent); + void setRelates(const QString &name); void setPhysicalModuleName(const QString &name) { physicalModuleName_ = name; } void setUrl(const QString& url) { url_ = url; } void setTemplateStuff(const QString &t) { templateStuff_ = t; } @@ -336,6 +337,7 @@ public: protected: Node(NodeType type, Aggregate* parent, const QString& name); + void removeRelates(); private: @@ -421,6 +423,7 @@ private: static bool isSameSignature(const FunctionNode* f1, const FunctionNode* f2); void removeRelated(Node* pseudoChild); + void addRelated(Node* pseudoChild); QString outputFileName_; QStringList pageKeywds; diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index aef785f30e..ca1648ec2f 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -276,7 +276,7 @@ const QVector<Tree*>& QDocForest::indexSearchOrder() NamespaceNode* QDocForest::newIndexTree(const QString& module) { primaryTree_ = new Tree(module, qdb_); - forest_.insert(module, primaryTree_); + forest_.insert(module.toLower(), primaryTree_); return primaryTree_->root(); } @@ -306,15 +306,12 @@ const Node* QDocForest::findNodeForTarget(QStringList& targetPath, { int flags = SearchBaseClasses | SearchEnumValues; - QString entity = targetPath.at(0); - targetPath.removeFirst(); + QString entity = targetPath.takeFirst(); QStringList entityPath = entity.split("::"); QString target; - if (!targetPath.isEmpty()) { - target = targetPath.at(0); - targetPath.removeFirst(); - } + if (!targetPath.isEmpty()) + target = targetPath.takeFirst(); foreach (Tree* t, searchOrder()) { const Node* n = t->findNodeForTarget(entityPath, target, relative, flags, genus, ref); @@ -1295,6 +1292,10 @@ void QDocDatabase::resolveIssues() { resolveQmlInheritance(primaryTreeRoot()); primaryTree()->resolveTargets(primaryTreeRoot()); primaryTree()->resolveCppToQmlLinks(); + if (!Generator::singleExec()) { + QDocIndexFiles::qdocIndexFiles()->resolveRelates(); + QDocIndexFiles::destroyQDocIndexFiles(); + } } void QDocDatabase::resolveStuff() @@ -1305,7 +1306,6 @@ void QDocDatabase::resolveStuff() primaryTree()->resolveCppToQmlLinks(); primaryTree()->resolveUsingClauses(); resolveNamespaces(); - primaryTreeRoot()->normalizeOverloads(); } /*! @@ -1495,7 +1495,6 @@ void QDocDatabase::readIndexes(const QStringList& t) qDebug() << "This index file is already in memory:" << f; } QDocIndexFiles::qdocIndexFiles()->readIndexes(indexFiles); - QDocIndexFiles::destroyQDocIndexFiles(); } /*! @@ -1699,35 +1698,26 @@ const Node* QDocDatabase::findNodeForAtom(const Atom* a, const Node* relative, Q function = first.left(position); node = domain->findFunctionNode(function, params, 0, genus); } - else { + if (!node) { int flags = SearchBaseClasses | SearchEnumValues; QStringList nodePath = first.split("::"); QString target; targetPath.removeFirst(); - if (!targetPath.isEmpty()) { - target = targetPath.at(0); - targetPath.removeFirst(); - } + if (!targetPath.isEmpty()) + target = targetPath.takeFirst(); if (relative && relative->tree()->physicalModuleName() != domain->physicalModuleName()) relative = 0; - node = domain->findNodeForTarget(nodePath, target, relative, flags, genus, ref); - return node; + return domain->findNodeForTarget(nodePath, target, relative, flags, genus, ref); } } else { - if (first.endsWith(".html")) { + if (first.endsWith(".html")) node = findNodeByNameAndType(QStringList(first), Node::Document); - // the path may also refer to an example file with .html extension - if (!node && first.contains("/")) - return findNodeForTarget(targetPath, relative, genus, ref); - } else if (first.endsWith(QChar(')'))) { node = findFunctionNode(first, relative, genus); } - else { - node = findNodeForTarget(targetPath, relative, genus, ref); - return node; - } + if (!node) + return findNodeForTarget(targetPath, relative, genus, ref); } if (node && ref.isEmpty()) { diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp index 8db901bbc7..fc262d9834 100644 --- a/src/tools/qdoc/qdocindexfiles.cpp +++ b/src/tools/qdoc/qdocindexfiles.cpp @@ -100,6 +100,7 @@ void QDocIndexFiles::destroyQDocIndexFiles() */ void QDocIndexFiles::readIndexes(const QStringList& indexFiles) { + relatedList_.clear(); foreach (const QString& indexFile, indexFiles) { QString msg = "Loading index file: " + indexFile; Location::logToStdErr(msg); @@ -146,9 +147,7 @@ void QDocIndexFiles::readIndexFile(const QString& path) indexUrl = installDir.relativeFilePath(path).section('/', 0, -2); } project_ = attrs.value(QLatin1String("project")).toString(); - basesList_.clear(); - relatedList_.clear(); NamespaceNode* root = qdb_->newIndexTree(project_); @@ -730,17 +729,37 @@ void QDocIndexFiles::resolveIndex() pair.first->addUnresolvedBaseClass(Node::Public, basePath, QString()); } } + // No longer needed. + basesList_.clear(); +} + +/* + Goes though the list of nodes that are related to other aggregates + that were read from all index files, and tries to find the aggregate + nodes from the database. Calls the node's setRelates() for each + aggregate that is found in the local module (primary tree). + + This function is meant to be called before starting the doc generation, + after all the index files are read. + */ +void QDocIndexFiles::resolveRelates() +{ + if (relatedList_.isEmpty()) + return; + + // Restrict searching only to the local (primary) tree + QVector<Tree*> searchOrder = qdb_->searchOrder(); + qdb_->setLocalSearch(); QPair<FunctionNode*,QString> relatedPair; foreach (relatedPair, relatedList_) { QStringList path = relatedPair.second.split("::"); Node* n = qdb_->findRelatesNode(path); if (n) - relatedPair.first->setRelates(static_cast<ClassNode*>(n)); + relatedPair.first->setRelates(static_cast<Aggregate*>(n)); } - - // No longer needed. - basesList_.clear(); + // Restore original search order + qdb_->setSearchOrder(searchOrder); relatedList_.clear(); } diff --git a/src/tools/qdoc/qdocindexfiles.h b/src/tools/qdoc/qdocindexfiles.h index 1b9b6afc40..67a7e7226e 100644 --- a/src/tools/qdoc/qdocindexfiles.h +++ b/src/tools/qdoc/qdocindexfiles.h @@ -65,6 +65,7 @@ class QDocIndexFiles void readIndexFile(const QString& path); void readIndexSection(QXmlStreamReader &reader, Node* current, const QString& indexUrl); void resolveIndex(); + void resolveRelates(); bool generateIndexSection(QXmlStreamWriter& writer, Node* node, bool generateInternalNodes = false); void generateIndexSections(QXmlStreamWriter& writer, Node* node, bool generateInternalNodes = false); diff --git a/src/tools/qdoc/tree.cpp b/src/tools/qdoc/tree.cpp index d64903e61e..f8f88e6b91 100644 --- a/src/tools/qdoc/tree.cpp +++ b/src/tools/qdoc/tree.cpp @@ -721,12 +721,8 @@ const Node* Tree::findNodeForTarget(const QStringList& path, QString& ref) const { const Node* node = 0; - QString p; - if (path.size() > 1) - p = path.join(QString("::")); - else if ((genus == Node::DontCare) || (genus == Node::DOC)) { - p = path.at(0); - node = findDocumentNodeByTitle(p); + if ((genus == Node::DontCare) || (genus == Node::DOC)) { + node = findDocumentNodeByTitle(path.at(0)); if (node) { if (!target.isEmpty()) { ref = getRef(target, node); @@ -737,7 +733,8 @@ const Node* Tree::findNodeForTarget(const QStringList& path, return node; } } - node = findUnambiguousTarget(p, ref); + + node = findUnambiguousTarget(path.join(QStringLiteral("::")), ref); if (node) { if (!target.isEmpty()) { ref = getRef(target, node); |