summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMartin Smith <msmith@trolltech.com>2010-04-29 11:49:43 (GMT)
committerMartin Smith <msmith@trolltech.com>2010-04-29 11:49:43 (GMT)
commit04925d40d960a394345f83ef51cce7b547431b92 (patch)
treedd0acdf9524026f29a3c88731d93c8fdc6b83744 /tools
parent229251d0bc0024b78a8c0669a09836289c02a7cd (diff)
downloadQt-04925d40d960a394345f83ef51cce7b547431b92.zip
Qt-04925d40d960a394345f83ef51cce7b547431b92.tar.gz
Qt-04925d40d960a394345f83ef51cce7b547431b92.tar.bz2
qdoc: Added breadcrumbs to examples. Coolio.
Doesn't work in a few cases because of non-standard naming of things.
Diffstat (limited to 'tools')
-rw-r--r--tools/qdoc3/codeparser.cpp12
-rw-r--r--tools/qdoc3/codeparser.h2
-rw-r--r--tools/qdoc3/htmlgenerator.cpp23
3 files changed, 37 insertions, 0 deletions
diff --git a/tools/qdoc3/codeparser.cpp b/tools/qdoc3/codeparser.cpp
index a717ff1..78804eb 100644
--- a/tools/qdoc3/codeparser.cpp
+++ b/tools/qdoc3/codeparser.cpp
@@ -70,6 +70,7 @@ QT_BEGIN_NAMESPACE
QList<CodeParser *> CodeParser::parsers;
bool CodeParser::showInternal = false;
+QMap<QString,QString> CodeParser::nameToTitle;
/*!
The constructor adds this code parser to the static
@@ -250,10 +251,21 @@ void CodeParser::processCommonMetaCommand(const Location &location,
if (node->type() == Node::Fake) {
FakeNode *fake = static_cast<FakeNode *>(node);
fake->setTitle(arg);
+ nameToTitle.insert(fake->name(),arg);
+ qDebug() << "NAME TO TITLE:" << fake->name() << arg;
}
else
location.warning(tr("Ignored '\\%1'").arg(COMMAND_TITLE));
}
}
+/*!
+ Find the page title given the page \a name and return it.
+ */
+const QString CodeParser::titleFromName(const QString& name)
+{
+ const QString t = nameToTitle.value(name);
+ return t;
+}
+
QT_END_NAMESPACE
diff --git a/tools/qdoc3/codeparser.h b/tools/qdoc3/codeparser.h
index 7b0d0eb..ebba601 100644
--- a/tools/qdoc3/codeparser.h
+++ b/tools/qdoc3/codeparser.h
@@ -78,6 +78,7 @@ class CodeParser
static void initialize(const Config& config);
static void terminate();
static CodeParser *parserForLanguage(const QString& language);
+ static const QString titleFromName(const QString& name);
protected:
QSet<QString> commonMetaCommands();
@@ -88,6 +89,7 @@ class CodeParser
private:
static QList<CodeParser *> parsers;
static bool showInternal;
+ static QMap<QString,QString> nameToTitle;
};
QT_END_NAMESPACE
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index f8b1d59..9aa8a9a 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -44,6 +44,7 @@
*/
#include "codemarker.h"
+#include "codeparser.h"
#include "helpprojectwriter.h"
#include "htmlgenerator.h"
#include "node.h"
@@ -1674,6 +1675,9 @@ QString HtmlGenerator::fileExtension(const Node * /* node */) const
return "html";
}
+/*!
+ Output breadcrumb list in the html file.
+ */
void HtmlGenerator::generateBreadCrumbs(const QString& title,
const Node *node,
CodeMarker *marker)
@@ -1713,9 +1717,28 @@ void HtmlGenerator::generateBreadCrumbs(const QString& title,
if (fn->name() == QString("modules"))
out() << " <li><a href=\"modules.html\">All Modules</a></li>";
}
+ else if (node->subType() == Node::Page) {
+ if (fn->name() == QString("examples.html")) {
+ out() << " <li><a href=\"examples.html\">All Examples</a></li>";
+ }
+ else if (fn->name().startsWith("examples-")) {
+ out() << " <li><a href=\"examples.html\">All Examples</a></li>";
+ out() << " <li><a href=\"" << fn->name() << "\">" << title
+ << "</a></li>";
+ }
+ }
else if (node->subType() == Node::QmlClass) {
}
else if (node->subType() == Node::Example) {
+ out() << " <li><a href=\"examples.html\">All Examples</a></li>";
+ QStringList sl = fn->name().split('/');
+ QString name = "examples-" + sl.at(0) + ".html";
+ QString t = CodeParser::titleFromName(name);
+ out() << " <li><a href=\"" << name << "\">"
+ << t << "</a></li>";
+ out() << " <li><a href=\"" << sl.at(0)
+ << "-" << sl.at(sl.size()-1) << ".html\">"
+ << title << "</a></li>";
}
}
else if (node->type() == Node::Namespace) {