From bc0328e334f456c789a18eb254af4427ea730187 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 18 Aug 2010 13:31:55 +0200 Subject: qdoc: Reorganized the QML elements table to be a dictionary... ...and a set of functional group pages. --- tools/qdoc3/htmlgenerator.cpp | 107 +++++++++++++++++++++++++++++------------- tools/qdoc3/node.cpp | 23 ++++++++- 2 files changed, 95 insertions(+), 35 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 50f8b56..8215ddc 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -4422,57 +4422,98 @@ bool HtmlGenerator::generatePageElement(QXmlStreamWriter& writer, return true; if (node->access() == Node::Private) return false; - if (!node->isInnerNode()) - return false; + QString t; + QString url = PageGenerator::fileName(node); QString title; QString rawTitle; QString fullTitle; - const InnerNode* inner = static_cast(node); - - writer.writeStartElement("page"); + QStringList pageWords; QXmlStreamAttributes attributes; - QString t; + + writer.writeStartElement("page"); t.setNum(id++); - switch (node->type()) { - case Node::Fake: - { - const FakeNode* fake = static_cast(node); - title = fake->fullTitle(); - break; - } - case Node::Class: - { - title = node->name() + " Class Reference"; + + if (node->isInnerNode()) { + const InnerNode* inner = static_cast(node); + switch (node->type()) { + case Node::Fake: + { + const FakeNode* fake = static_cast(node); + title = fake->fullTitle(); + pageWords << title; + break; + } + case Node::Class: + { + title = node->name() + " Class Reference"; + pageWords << node->name() << "class" << "reference"; + break; + } + case Node::Namespace: + { + rawTitle = marker->plainName(inner); + fullTitle = marker->plainFullName(inner); + title = rawTitle + " Namespace Reference"; + pageWords << rawTitle << "namespace" << "reference"; + break; + } + default: + title = node->name(); + pageWords << title; break; } - case Node::Namespace: - { - rawTitle = marker->plainName(inner); - fullTitle = marker->plainFullName(inner); - title = rawTitle + " Namespace Reference"; + + if (!inner->pageKeywords().isEmpty()) + pageWords << inner->pageKeywords(); + } + else { + switch (node->type()) { + case Node::Enum: + { + title = node->name() + " Enum Reference"; + pageWords << node->name() << "enum" << "type"; + url += "#" + node->name() + "-enum"; + break; + } + case Node::Function: + { + title = node->name() + " Function Reference"; + pageWords << node->name() << "function"; + url += "#" + node->name(); + break; + } + case Node::Property: + { + title = node->name() + " Property Reference"; + pageWords << node->name() << "property"; + url += "#" + node->name() + "-prop"; + break; + } + case Node::Typedef: + { + title = node->name() + " Type Reference"; + pageWords << node->name() << "typedef" << "type"; + url += "#" + node->name(); + break; + } + default: + title = node->name(); + pageWords << title; break; } - default: - title = node->name(); - break; } + writer.writeAttribute("id",t); writer.writeStartElement("pageWords"); - writer.writeCharacters(title); - if (!inner->pageKeywords().isEmpty()) { - const QStringList& w = inner->pageKeywords(); - for (int i = 0; i < w.size(); ++i) { - writer.writeCharacters(" "); - writer.writeCharacters(w.at(i).toLocal8Bit().constData()); - } - } + writer.writeCharacters(pageWords.join(" ")); + writer.writeEndElement(); writer.writeStartElement("pageTitle"); writer.writeCharacters(title); writer.writeEndElement(); writer.writeStartElement("pageUrl"); - writer.writeCharacters(PageGenerator::fileName(node)); + writer.writeCharacters(url); writer.writeEndElement(); writer.writeStartElement("pageType"); switch (node->pageType()) { diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 259641e..41f90d5 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -652,8 +652,14 @@ NodeList InnerNode::overloads(const QString &funcName) const InnerNode::InnerNode(Type type, InnerNode *parent, const QString& name) : Node(type, parent, name) { - if (type == Class) + switch (type) { + case Class: + case Namespace: setPageType(ApiPage); + break; + default: + break; + } } /*! @@ -845,6 +851,19 @@ bool LeafNode::isInnerNode() const LeafNode::LeafNode(Type type, InnerNode *parent, const QString& name) : Node(type, parent, name) { + switch (type) { + case Enum: + case Function: + case Typedef: + case Variable: + case QmlProperty: + case QmlSignal: + case QmlMethod: + setPageType(ApiPage); + break; + default: + break; + } } /*! @@ -1600,7 +1619,7 @@ QmlPropertyNode::QmlPropertyNode(QmlPropGroupNode *parent, des(Trool_Default), att(attached) { - // nothing. + setPageType(ApiPage); } /*! -- cgit v0.12