summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3/htmlgenerator.cpp
diff options
context:
space:
mode:
authorMartin Smith <msmith@trolltech.com>2010-04-16 08:48:45 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2010-04-18 02:33:58 (GMT)
commit71b8213a10587569c8d378b155e342f24d89bc38 (patch)
tree78e11af54ef6c016c83d0bacb6f1feeeedff1679 /tools/qdoc3/htmlgenerator.cpp
parent25d8481d062d5b25f8fdf87f0384f186591a1ddd (diff)
downloadQt-71b8213a10587569c8d378b155e342f24d89bc38.zip
Qt-71b8213a10587569c8d378b155e342f24d89bc38.tar.gz
Qt-71b8213a10587569c8d378b155e342f24d89bc38.tar.bz2
qdoc: Improved TOC for class ref pages.
(cherry picked from commit 8c942f6d2998ffcd024437e408f92d38750dd025)
Diffstat (limited to 'tools/qdoc3/htmlgenerator.cpp')
-rw-r--r--tools/qdoc3/htmlgenerator.cpp45
1 files changed, 36 insertions, 9 deletions
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index 8beedb0..6922ef8 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -1256,7 +1256,8 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner,
}
generateHeader(title, inner, marker, true);
- generateTableOfContents(inner,marker);
+ sections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay);
+ generateTableOfContents(inner,marker,&sections);
generateTitle(title, subtitleText, SmallSubTitle, inner, marker);
#ifdef QDOC_QML
@@ -1300,7 +1301,9 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner,
bool needOtherSection = false;
- sections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay);
+ /*
+ sections is built above for the call to generateTableOfContents().
+ */
s = sections.begin();
while (s != sections.end()) {
if (s->members.isEmpty() && s->reimpMembers.isEmpty()) {
@@ -2026,7 +2029,9 @@ void HtmlGenerator::generateTableOfContents(const Node *node,
Revised for the new doc format.
Generates a table of contents begining at \a node.
*/
-void HtmlGenerator::generateTableOfContents(const Node *node, CodeMarker *marker)
+void HtmlGenerator::generateTableOfContents(const Node *node,
+ CodeMarker *marker,
+ QList<Section>* sections)
{
if (!node->doc().hasTableOfContents()) {
if (node->subType() != Node::Module)
@@ -2038,14 +2043,15 @@ void HtmlGenerator::generateTableOfContents(const Node *node, CodeMarker *marker
return;
}
- Doc::SectioningUnit sectioningUnit = Doc::Section4;
QStringList sectionNumber;
+ int detailsBase = 0;
// disable nested links in table of contents
inContents = true;
inLink = true;
out() << "<div class=\"toc\">\n";
+ out() << "<h3>Table of Contents</h3>\n";
sectionNumber.append("1");
out() << "<ul class=\"level" << sectionNumber.size() << "\">\n";
@@ -2057,15 +2063,36 @@ void HtmlGenerator::generateTableOfContents(const Node *node, CodeMarker *marker
out() << "<li><a href=\"#" << registerRef("classes") << "\">Classes</a></li>\n";
}
out() << "<li><a href=\"#" << registerRef("details") << "\">Detailed Description</a></li>\n";
+ for (int i = 0; i < toc.size(); ++i) {
+ if (toc.at(i)->string().toInt() == 1) {
+ detailsBase = 1;
+ break;
+ }
+ }
+ }
+ else if (sections && (node->type() == Node::Class)) {
+ QList<Section>::ConstIterator s = sections->begin();
+ while (s != sections->end()) {
+ if (!s->members.isEmpty() || !s->reimpMembers.isEmpty()) {
+ out() << "<li><a href=\"#"
+ << registerRef((*s).pluralMember)
+ << "\">" << (*s).name
+ << "</a></li>\n";
+ }
+ ++s;
+ }
+ out() << "<li><a href=\"#" << registerRef("details") << "\">Detailed Description</a></li>\n";
+ for (int i = 0; i < toc.size(); ++i) {
+ if (toc.at(i)->string().toInt() == 1) {
+ detailsBase = 1;
+ break;
+ }
+ }
}
for (int i = 0; i < toc.size(); ++i) {
Atom *atom = toc.at(i);
-
- int nextLevel = atom->string().toInt();
- if (nextLevel > (int)sectioningUnit)
- continue;
-
+ int nextLevel = atom->string().toInt() + detailsBase;
if (sectionNumber.size() < nextLevel) {
do {
sectionNumber.append("1");