diff options
Diffstat (limited to 'tools/qdoc3')
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 45 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.h | 4 |
2 files changed, 39 insertions, 10 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,§ions); 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"); diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index ec96c34..559c968 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -153,7 +153,9 @@ class HtmlGenerator : public PageGenerator Doc::SectioningUnit sectioningUnit, int numColumns, const Node *relative = 0); - void generateTableOfContents(const Node *node, CodeMarker *marker); + void generateTableOfContents(const Node *node, + CodeMarker *marker, + QList<Section>* sections = 0); QString generateListOfAllMemberFile(const InnerNode *inner, CodeMarker *marker); QString generateLowStatusMemberFile(const InnerNode *inner, CodeMarker *marker, |