summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Smith <msmith@trolltech.com>2010-04-13 08:19:26 (GMT)
committerMartin Smith <msmith@trolltech.com>2010-04-13 08:19:26 (GMT)
commit1055099e331af3b10d0b81b1a965e7d3db5f272d (patch)
tree781840932860e63ce09fe421fdb8de3acbaee0d1
parent9eab27889b1e14385f9428417e048da960ca06de (diff)
downloadQt-1055099e331af3b10d0b81b1a965e7d3db5f272d.zip
Qt-1055099e331af3b10d0b81b1a965e7d3db5f272d.tar.gz
Qt-1055099e331af3b10d0b81b1a965e7d3db5f272d.tar.bz2
qdoc: Added new table of contents for non-class ref pages
This feature is not complete in this commit.
-rw-r--r--doc/src/frameworks-technologies/eventsandfilters.qdoc2
-rw-r--r--doc/src/modules.qdoc4
-rw-r--r--doc/src/qt4-intro.qdoc14
-rw-r--r--tools/qdoc3/htmlgenerator.cpp76
-rw-r--r--tools/qdoc3/htmlgenerator.h1
-rw-r--r--tools/qdoc3/pagegenerator.cpp2
6 files changed, 76 insertions, 23 deletions
diff --git a/doc/src/frameworks-technologies/eventsandfilters.qdoc b/doc/src/frameworks-technologies/eventsandfilters.qdoc
index 29d8709..96ee18c 100644
--- a/doc/src/frameworks-technologies/eventsandfilters.qdoc
+++ b/doc/src/frameworks-technologies/eventsandfilters.qdoc
@@ -67,8 +67,6 @@
document describes how events are delivered and handled in a typical
application.
- \tableofcontents
-
\section1 How Events are Delivered
When an event occurs, Qt creates an event object to represent it by
diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc
index 8731d57..1ab1c00 100644
--- a/doc/src/modules.qdoc
+++ b/doc/src/modules.qdoc
@@ -297,8 +297,6 @@
QtScriptTools module provides additional Qt Script-related
components that application developers may find useful.
- \tableofcontents
-
To include the definitions of the module's classes, use the
following directive:
@@ -355,8 +353,6 @@
\brief The QtScriptTools module provides additional components for applications that use Qt Script.
- \tableofcontents
-
\section1 Configuring the Build Process
Applications that use the Qt Script Tools classes need to
diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc
index ba9821a..f1b5d41 100644
--- a/doc/src/qt4-intro.qdoc
+++ b/doc/src/qt4-intro.qdoc
@@ -52,8 +52,6 @@
issues that you may encounter. It also explains how to turn on Qt
3 compatibility support.
- \tableofcontents
-
\section1 New Technologies in Qt 4
Qt 4 introduces the following core technologies:
@@ -467,10 +465,6 @@
A list of other Qt 4 features can be found on the \bold{\l{What's
New in Qt 4}} page.
- \bold{Highlights}
-
- \tableofcontents
-
\section1 Declarative UI development with Qt Quick
\image quick_screens.png
@@ -549,10 +543,6 @@
A list of other Qt 4 features can be found on the \bold{\l{What's
New in Qt 4}} page.
- \bold{Highlights}
-
- \tableofcontents
-
\section1 Support for Symbian
Qt 4.6 is the first release to include support for the Symbian
@@ -762,10 +752,6 @@
A list of other Qt 4 features can be found on the
\bold{\l{What's New in Qt 4}} page.
- \bold{Highlights}
-
- \tableofcontents
-
\section1 Qt WebKit Integration
\image webkit-netscape-plugin.png
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index ad678a9..d80e8b4 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -1469,6 +1469,14 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker)
}
generateHeader(htmlTitle, fake, marker, true);
+
+ /*
+ Generate the TOC for the new doc format.
+ Don't generate a TOC for the home page.
+ */
+ if (fake->name() != QString("index.html"))
+ generateTableOfContents(fake,marker);
+
generateTitle(fullTitle,
Text() << fake->subTitle(),
subTitleSize,
@@ -2014,6 +2022,72 @@ void HtmlGenerator::generateTableOfContents(const Node *node,
inLink = false;
}
+/*!
+ Revised for the new doc format.
+ Generates a table of contents begining at \a node.
+ */
+void HtmlGenerator::generateTableOfContents(const Node *node, CodeMarker *marker)
+{
+ if (!node->doc().hasTableOfContents())
+ return;
+ QList<Atom *> toc = node->doc().tableOfContents();
+ if (toc.isEmpty())
+ return;
+
+ Doc::SectioningUnit sectioningUnit = Doc::Section4;
+ QString nodeName = node->name();
+
+ QStringList sectionNumber;
+ int columnSize = 0;
+
+ // disable nested links in table of contents
+ inContents = true;
+ inLink = true;
+
+ out() << "<div class=\"toc\">\n";
+
+ for (int i = 0; i < toc.size(); ++i) {
+ Atom *atom = toc.at(i);
+
+ int nextLevel = atom->string().toInt();
+ if (nextLevel > (int)sectioningUnit)
+ continue;
+
+ if (sectionNumber.size() < nextLevel) {
+ do {
+ out() << "<ul>\n";
+ sectionNumber.append("1");
+ } while (sectionNumber.size() < nextLevel);
+ }
+ else {
+ while (sectionNumber.size() > nextLevel) {
+ out() << "</ul>\n";
+ sectionNumber.removeLast();
+ }
+ sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1);
+ }
+ int numAtoms;
+ Text headingText = Text::sectionHeading(atom);
+ out() << "<li>";
+ out() << "<a href=\""
+ << nodeName
+ << "#"
+ << Doc::canonicalTitle(headingText.toString())
+ << "\">";
+ generateAtomList(headingText.firstAtom(), node, marker, true, numAtoms);
+ out() << "</a></li>\n";
+
+ ++columnSize;
+ }
+ while (!sectionNumber.isEmpty()) {
+ out() << "</ul>\n";
+ sectionNumber.removeLast();
+ }
+ out() << "</div>\n";
+ inContents = false;
+ inLink = false;
+}
+
#if 0
void HtmlGenerator::generateNavigationBar(const NavigationBar& bar,
const Node *node,
@@ -2248,7 +2322,7 @@ void HtmlGenerator::generateCompactList(const Node *relative,
QString commonPrefix)
{
const int NumParagraphs = 37; // '0' to '9', 'A' to 'Z', '_'
- const int NumColumns = 2; // number of columns in the result
+ const int NumColumns = 3; // number of columns in the result
if (classMap.isEmpty())
return;
diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h
index 8fe0331..ec96c34 100644
--- a/tools/qdoc3/htmlgenerator.h
+++ b/tools/qdoc3/htmlgenerator.h
@@ -153,6 +153,7 @@ class HtmlGenerator : public PageGenerator
Doc::SectioningUnit sectioningUnit,
int numColumns,
const Node *relative = 0);
+ void generateTableOfContents(const Node *node, CodeMarker *marker);
QString generateListOfAllMemberFile(const InnerNode *inner, CodeMarker *marker);
QString generateLowStatusMemberFile(const InnerNode *inner,
CodeMarker *marker,
diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp
index b701565..f0f14fe 100644
--- a/tools/qdoc3/pagegenerator.cpp
+++ b/tools/qdoc3/pagegenerator.cpp
@@ -217,8 +217,6 @@ void PageGenerator::generateInnerNode(const InnerNode *node,
if (node->parent() != 0) {
beginSubPage(node->location(), fileName(node));
- // <!--Put all your content here-->
- //generateTableOfContents(node,marker,Doc::Section4,1,relative);
if (node->type() == Node::Namespace || node->type() == Node::Class) {
generateClassLikeNode(node, marker);
}