From 62c5e8af8fce057cd9a62f1829d82b658b0c944c Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 24 Mar 2011 14:58:20 +0100 Subject: Avoided the use of hard-coded file names. --- tools/qdoc3/htmlgenerator.cpp | 104 ++++++++++++++++++++++++++++-------------- 1 file 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(node); + const ClassNode *cn = static_cast(node); QString name = node->moduleName(); - out() << "
  • Modules
  • "; - if (!name.isEmpty()) { - out() << "
  • "; - breadcrumb << Atom(Atom::AutoLink,name); - generateText(breadcrumb, node, marker); - out() << "
  • \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() << "
  • " << protectEnc(cn->name()) << "
  • \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(node); if (node->subType() == Node::Module) { - out() << "
  • Modules
  • "; + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::AutoLink, QLatin1String("Modules")) + << Atom(Atom::ListItemRight); QString name = node->name(); if (!name.isEmpty()) - out() << "
  • " << protectEnc(name) << "
  • \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() << "
  • Modules
  • "; - else { - out() << "
  • " << protectEnc(title) << "
  • "; - } + 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() << "
  • Examples
  • "; - out() << "
  • QML Examples & Demos
  • "; + 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() << "
  • Examples
  • "; - out() << "
  • " << protectEnc(title) << "
  • "; - } - else if (fn->name() == QString("namespaces.html")) { - out() << "
  • Namespaces
  • "; - } - else { - out() << "
  • " << protectEnc(title) << "
  • "; + 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() << "
  • QML Elements
  • "; - out() << "
  • " << protectEnc(title) << "
  • "; + 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() << "
  • Examples
  • "; + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::AutoLink, QLatin1String("Examples")) + << Atom(Atom::ListItemRight); QStringList sl = fn->name().split('/'); if (sl.contains("declarative")) - out() << "
  • QML Examples & Demos
  • "; + 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() << "
  • " << protectEnc(title) << "
  • "; + breadcrumbs << Atom(Atom::ListItemLeft) + << Atom(Atom::String, protectEnc(title)) + << Atom(Atom::ListItemRight); } } else if (node->type() == Node::Namespace) { - out() << "
  • Namespaces
  • "; - out() << "
  • " << protectEnc(title) << "
  • "; + 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, -- cgit v0.12