diff options
Diffstat (limited to 'tools/qdoc3')
-rw-r--r-- | tools/qdoc3/ditaxmlgenerator.cpp | 10 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 117 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.h | 1 | ||||
-rw-r--r-- | tools/qdoc3/node.cpp | 23 |
4 files changed, 116 insertions, 35 deletions
diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 7892025..a83a321 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -544,6 +544,7 @@ void DitaXmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) funcIndex.clear(); legaleseTexts.clear(); serviceClasses.clear(); + qmlClasses.clear(); findAllClasses(tree->root()); findAllFunctions(tree->root()); findAllLegaleseTexts(tree->root()); @@ -751,6 +752,9 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, else if (atom->string() == "classes") { generateCompactList(relative, marker, nonCompatClasses, true); } + else if (atom->string() == "qmlclasses") { + generateCompactList(relative, marker, qmlClasses, true); + } else if (atom->string().contains("classesbymodule")) { QString arg = atom->string().trimmed(); QString moduleName = atom->string().mid(atom->string().indexOf( @@ -3675,6 +3679,12 @@ void DitaXmlGenerator::findAllClasses(const InnerNode *node) if (!serviceName.isEmpty()) serviceClasses.insert(serviceName, *c); } + else if ((*c)->type() == Node::Fake && + (*c)->subType() == Node::QmlClass && + !(*c)->doc().isEmpty()) { + QString qmlClassName = (*c)->name(); + qmlClasses.insert(qmlClassName,*c); + } else if ((*c)->isInnerNode()) { findAllClasses(static_cast<InnerNode *>(*c)); } diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 4603a40..8215ddc 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -376,6 +376,7 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) funcIndex.clear(); legaleseTexts.clear(); serviceClasses.clear(); + qmlClasses.clear(); findAllClasses(tree->root()); findAllFunctions(tree->root()); findAllLegaleseTexts(tree->root()); @@ -611,6 +612,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, else if (atom->string() == "classes") { generateCompactList(relative, marker, nonCompatClasses, true); } + else if (atom->string() == "qmlclasses") { + generateCompactList(relative, marker, qmlClasses, true); + } else if (atom->string().contains("classesbymodule")) { QString arg = atom->string().trimmed(); QString moduleName = atom->string().mid(atom->string().indexOf( @@ -3707,6 +3711,12 @@ void HtmlGenerator::findAllClasses(const InnerNode *node) if (!serviceName.isEmpty()) serviceClasses.insert(serviceName, *c); } + else if ((*c)->type() == Node::Fake && + (*c)->subType() == Node::QmlClass && + !(*c)->doc().isEmpty()) { + QString qmlClassName = (*c)->name(); + qmlClasses.insert(qmlClassName,*c); + } else if ((*c)->isInnerNode()) { findAllClasses(static_cast<InnerNode *>(*c)); } @@ -4412,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<const InnerNode*>(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<const FakeNode*>(node); - title = fake->fullTitle(); - break; - } - case Node::Class: - { - title = node->name() + " Class Reference"; + + if (node->isInnerNode()) { + const InnerNode* inner = static_cast<const InnerNode*>(node); + switch (node->type()) { + case Node::Fake: + { + const FakeNode* fake = static_cast<const FakeNode*>(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/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index eab10c6..d885ada 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -330,6 +330,7 @@ class HtmlGenerator : public PageGenerator NodeMap obsoleteClasses; NodeMap namespaceIndex; NodeMap serviceClasses; + NodeMap qmlClasses; QMap<QString, NodeMap > funcIndex; QMap<Text, const Node *> legaleseTexts; NewSinceMaps newSinceMaps; 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); } /*! |