diff options
author | David Boddie <david.boddie@nokia.com> | 2011-03-24 13:58:20 (GMT) |
---|---|---|
committer | David Boddie <david.boddie@nokia.com> | 2011-03-24 13:58:20 (GMT) |
commit | 62c5e8af8fce057cd9a62f1829d82b658b0c944c (patch) | |
tree | faefcbed3000cd8e5153eb5c0a237e1a0dde5e77 /tools | |
parent | 04ca1382baae8fddc353bfba8ae7e11bf76e0319 (diff) | |
download | Qt-62c5e8af8fce057cd9a62f1829d82b658b0c944c.zip Qt-62c5e8af8fce057cd9a62f1829d82b658b0c944c.tar.gz Qt-62c5e8af8fce057cd9a62f1829d82b658b0c944c.tar.bz2 |
Avoided the use of hard-coded file names.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 104 |
1 files changed, 70 insertions, 34 deletions
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 2019e85..d1d1561 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1595,75 +1595,111 @@ QString HtmlGenerator::fileExtension(const Node * /* node */) const /*! Output breadcrumb list in the html file. */ -void HtmlGenerator::generateBreadCrumbs(const QString& title, +void HtmlGenerator::generateBreadCrumbs(const QString &title, const Node *node, CodeMarker *marker) { - Text breadcrumb; + Text breadcrumbs; + if (node->type() == Node::Class) { - const ClassNode* cn = static_cast<const ClassNode*>(node); + const ClassNode *cn = static_cast<const ClassNode *>(node); QString name = node->moduleName(); - out() << " <li><a href=\"modules.html\">Modules</a></li>"; - if (!name.isEmpty()) { - out() << " <li>"; - breadcrumb << Atom(Atom::AutoLink,name); - generateText(breadcrumb, node, marker); - out() << "</li>\n"; - } + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::AutoLink, QLatin1String("Modules")) + << Atom(Atom::ListItemRight); + if (!name.isEmpty()) + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::AutoLink, name) + << Atom(Atom::ListItemRight); if (!cn->name().isEmpty()) - out() << " <li>" << protectEnc(cn->name()) << "</li>\n"; + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::String, protectEnc(cn->name())) + << Atom(Atom::ListItemRight); } else if (node->type() == Node::Fake) { const FakeNode* fn = static_cast<const FakeNode*>(node); if (node->subType() == Node::Module) { - out() << " <li><a href=\"modules.html\">Modules</a></li>"; + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::AutoLink, QLatin1String("Modules")) + << Atom(Atom::ListItemRight); QString name = node->name(); if (!name.isEmpty()) - out() << " <li>" << protectEnc(name) << "</li>\n"; + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::String, protectEnc(name)) + << Atom(Atom::ListItemRight); } else if (node->subType() == Node::Group) { if (fn->name() == QString("modules")) - out() << " <li>Modules</li>"; - else { - out() << " <li>" << protectEnc(title) << "</li>"; - } + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::AutoLink, QLatin1String("Modules")) + << Atom(Atom::ListItemRight); + else + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::String, protectEnc(title)) + << Atom(Atom::ListItemRight); } else if (node->subType() == Node::Page) { if (fn->name() == QString("qdeclarativeexamples.html")) { - out() << " <li><a href=\"all-examples.html\">Examples</a></li>"; - out() << " <li>QML Examples & Demos</li>"; + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::AutoLink, QLatin1String("Examples")) + << Atom(Atom::ListItemRight); + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::AutoLink, QLatin1String("QML Examples & Demos")) + << Atom(Atom::ListItemRight); } else if (fn->name().startsWith("examples-")) { - out() << " <li><a href=\"all-examples.html\">Examples</a></li>"; - out() << " <li>" << protectEnc(title) << "</li>"; - } - else if (fn->name() == QString("namespaces.html")) { - out() << " <li>Namespaces</li>"; - } - else { - out() << " <li>" << protectEnc(title) << "</li>"; + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::AutoLink, QLatin1String("Examples")) + << Atom(Atom::ListItemRight); + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::String, protectEnc(title)) + << Atom(Atom::ListItemRight); } + else if (fn->name() == QString("namespaces.html")) + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::AutoLink, QLatin1String("Namespaces")) + << Atom(Atom::ListItemRight); + else + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::String, protectEnc(title)) + << Atom(Atom::ListItemRight); } else if (node->subType() == Node::QmlClass) { - out() << " <li><a href=\"qdeclarativeelements.html\">QML Elements</a></li>"; - out() << " <li>" << protectEnc(title) << "</li>"; + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::AutoLink, QLatin1String("QML Elements")) + << Atom(Atom::ListItemRight); + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::String, protectEnc(title)) + << Atom(Atom::ListItemRight); } else if (node->subType() == Node::Example) { - out() << " <li><a href=\"all-examples.html\">Examples</a></li>"; + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::AutoLink, QLatin1String("Examples")) + << Atom(Atom::ListItemRight); QStringList sl = fn->name().split('/'); if (sl.contains("declarative")) - out() << " <li><a href=\"qdeclarativeexamples.html\">QML Examples & Demos</a></li>"; + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::AutoLink, QLatin1String("QML Examples & Demos")) + << Atom(Atom::ListItemRight); else { QString name = protectEnc("examples-" + sl.at(0) + ".html"); // this generates an empty link QString t = CodeParser::titleFromName(name); } - out() << " <li>" << protectEnc(title) << "</li>"; + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::String, protectEnc(title)) + << Atom(Atom::ListItemRight); } } else if (node->type() == Node::Namespace) { - out() << " <li><a href=\"namespaces.html\">Namespaces</a></li>"; - out() << " <li>" << protectEnc(title) << "</li>"; + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::AutoLink, QLatin1String("Namespaces")) + << Atom(Atom::ListItemRight); + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::String, protectEnc(title)) + << Atom(Atom::ListItemRight); } + + generateText(breadcrumbs, node, marker); } void HtmlGenerator::generateHeader(const QString& title, |