diff options
author | Martin Smith <martin.smith@digia.com> | 2014-10-28 14:25:44 +0100 |
---|---|---|
committer | Martin Smith <martin.smith@digia.com> | 2014-11-11 15:35:33 +0100 |
commit | 17472a2ba329a0d329aa21c9ffef62fec0de46c5 (patch) | |
tree | c3d98829b5568de4b033ca518b4dbe972d55abde /src/tools/qdoc/tree.cpp | |
parent | 894b579e3492dfa33832841fc9115d40d5b7595c (diff) |
qdoc: Generate cross-module links-to-links pages
The cross-module link report is modified so that each module
listed in the table is a link to a subpage on which all the
links from the current module to that module are listed. To
check that these links go to the correct place, click on one
to be taken to the actual link. The actual link is marked
with red asterisks. Click on that link to check that the link
goes to the correct page. Repeat this process for all the
links in the table.
Change-Id: Ifddf7108ed7ef090c4063909fdbd10dac1f2566b
Task-number: QTBUG-41850
Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
Diffstat (limited to 'src/tools/qdoc/tree.cpp')
-rw-r--r-- | src/tools/qdoc/tree.cpp | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/src/tools/qdoc/tree.cpp b/src/tools/qdoc/tree.cpp index f3a6ed78da..6610bd0db4 100644 --- a/src/tools/qdoc/tree.cpp +++ b/src/tools/qdoc/tree.cpp @@ -71,10 +71,14 @@ Tree::Tree(const QString& module, QDocDatabase* qdb) linkCount_(0), module_(module), qdb_(qdb), - root_(0, QString()) + root_(0, QString()), + targetListMap_(0) { root_.setModuleName(module_); root_.setTree(this); + if (Generator::writeQaPages()) { + targetListMap_ = new TargetListMap; + } } /*! @@ -100,6 +104,18 @@ Tree::~Tree() } nodesByTargetRef_.clear(); nodesByTargetTitle_.clear(); + if (Generator::writeQaPages() && targetListMap_) { + TargetListMap::iterator i = targetListMap_->begin(); + while (i != targetListMap_->end()) { + TargetList* tlist = i.value(); + if (tlist) { + foreach (TargetLoc* tloc, *tlist) + delete tloc; + } + delete tlist; + ++i; + } + } } /* API members */ @@ -1399,4 +1415,45 @@ const Node* Tree::checkForCollision(const QString& name) return findNode(QStringList(name), 0, 0, Node::DontCare); } +/*! + Generate a target of the form link-nnn, where the nnn is + the current link count for this tree. This target string + is returned. It will be output as an HTML anchor just before + an HTML link to the node \a t. + + The node \a t + */ +QString Tree::getNewLinkTarget(const Node* t, const QString& fileName, QString& text) +{ + QString target; + if (t) { + Tree* tree = t->tree(); + incrementLinkCount(); + if (tree != this) + tree->incrementLinkCount(); + target = QString("qa-target-%1").arg(-(linkCount())); + QString moduleName = tree->moduleName(); + TargetLoc* tloc = new TargetLoc(target, fileName, text); + TargetList* tList = 0; + TargetListMap::iterator i = targetListMap_->find(moduleName); + if (i == targetListMap_->end()) { + tList = new TargetList; + i = targetListMap_->insert(moduleName, tList); + } + else + tList = i.value(); + tList->append(tloc); + } + return target; +} + +/*! + Look up the target list for the specified \a module + and return a pointer to it. + */ +TargetList* Tree::getTargetList(const QString& module) +{ + return targetListMap_->value(module); +} + QT_END_NAMESPACE |