summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3/htmlgenerator.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-07-29 07:09:54 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-07-29 07:43:30 (GMT)
commit0eaa3466077839b0cef2ad6c326d80f398eccae7 (patch)
tree4c6855559ec940e2ac87514d14a0573593247915 /tools/qdoc3/htmlgenerator.cpp
parenta45fe18569be1fc91e26f6e58d2f16bc8c6958de (diff)
downloadQt-0eaa3466077839b0cef2ad6c326d80f398eccae7.zip
Qt-0eaa3466077839b0cef2ad6c326d80f398eccae7.tar.gz
Qt-0eaa3466077839b0cef2ad6c326d80f398eccae7.tar.bz2
Merge QML specific qdoc changes
Reviewed-by: Martin Smith
Diffstat (limited to 'tools/qdoc3/htmlgenerator.cpp')
-rw-r--r--tools/qdoc3/htmlgenerator.cpp533
1 files changed, 448 insertions, 85 deletions
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index f92391e..b1f8167 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -223,11 +223,21 @@ void HtmlGenerator::initializeGenerator(const Config &config)
i++;
}
- style = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_STYLE);
- postHeader = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_POSTHEADER);
- footer = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_FOOTER);
- address = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_ADDRESS);
- pleaseGenerateMacRef = config.getBool(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_GENERATEMACREFS);
+ style = config.getString(HtmlGenerator::format() +
+ Config::dot +
+ HTMLGENERATOR_STYLE);
+ postHeader = config.getString(HtmlGenerator::format() +
+ Config::dot +
+ HTMLGENERATOR_POSTHEADER);
+ footer = config.getString(HtmlGenerator::format() +
+ Config::dot +
+ HTMLGENERATOR_FOOTER);
+ address = config.getString(HtmlGenerator::format() +
+ Config::dot +
+ HTMLGENERATOR_ADDRESS);
+ pleaseGenerateMacRef = config.getBool(HtmlGenerator::format() +
+ Config::dot +
+ HTMLGENERATOR_GENERATEMACREFS);
project = config.getString(CONFIG_PROJECT);
@@ -241,10 +251,16 @@ void HtmlGenerator::initializeGenerator(const Config &config)
QSet<QString>::ConstIterator edition = editionNames.begin();
while (edition != editionNames.end()) {
QString editionName = *edition;
- QStringList editionModules = config.getStringList(
- CONFIG_EDITION + Config::dot + editionName + Config::dot + "modules");
- QStringList editionGroups = config.getStringList(
- CONFIG_EDITION + Config::dot + editionName + Config::dot + "groups");
+ QStringList editionModules = config.getStringList(CONFIG_EDITION +
+ Config::dot +
+ editionName +
+ Config::dot +
+ "modules");
+ QStringList editionGroups = config.getStringList(CONFIG_EDITION +
+ Config::dot +
+ editionName +
+ Config::dot +
+ "groups");
if (!editionModules.isEmpty())
editionModuleMap[editionName] = editionModules;
@@ -256,11 +272,17 @@ void HtmlGenerator::initializeGenerator(const Config &config)
slow = config.getBool(CONFIG_SLOW);
- stylesheets = config.getStringList(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_STYLESHEETS);
- customHeadElements = config.getStringList(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_CUSTOMHEADELEMENTS);
+ stylesheets = config.getStringList(HtmlGenerator::format() +
+ Config::dot +
+ HTMLGENERATOR_STYLESHEETS);
+ customHeadElements = config.getStringList(HtmlGenerator::format() +
+ Config::dot +
+ HTMLGENERATOR_CUSTOMHEADELEMENTS);
codeIndent = config.getInt(CONFIG_CODEINDENT);
- helpProjectWriter = new HelpProjectWriter(config, project.toLower() + ".qhp");
+ helpProjectWriter = new HelpProjectWriter(config,
+ project.toLower() +
+ ".qhp");
}
void HtmlGenerator::terminateGenerator()
@@ -304,9 +326,9 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker)
findAllFunctions(tree->root());
findAllLegaleseTexts(tree->root());
findAllNamespaces(tree->root());
-#ifdef ZZZ_QDOC_QML
+#ifdef ZZZ_QDOC_QML
findAllQmlClasses(tree->root());
-#endif
+#endif
PageGenerator::generateTree(tree, marker);
@@ -410,7 +432,8 @@ int HtmlGenerator::generateAtom(const Atom *atom,
QString str;
atom = atom->next();
while (atom != 0 && atom->type() != Atom::BriefRight) {
- if (atom->type() == Atom::String || atom->type() == Atom::AutoLink)
+ if (atom->type() == Atom::String ||
+ atom->type() == Atom::AutoLink)
str += atom->string();
skipAhead++;
atom = atom->next();
@@ -453,14 +476,14 @@ int HtmlGenerator::generateAtom(const Atom *atom,
marker,relative))
<< "</pre>\n";
break;
-#ifdef QDOC_QML
+#ifdef QDOC_QML
case Atom::Qml:
out() << "<pre>"
<< trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
marker,relative))
<< "</pre>\n";
break;
-#endif
+#endif
case Atom::CodeNew:
out() << "<p>you can rewrite it as</p>\n"
<< "<pre>"
@@ -976,7 +999,7 @@ int HtmlGenerator::generateAtom(const Atom *atom,
case Atom::EndQmlText:
// don't do anything with these. They are just tags.
break;
-#endif
+#endif
default:
unknownAtom(atom);
}
@@ -1042,6 +1065,12 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner,
generateHeader(title, inner, marker, true);
generateTitle(title, subtitleText, SmallSubTitle, inner, marker);
+#ifdef QDOC_QML
+ if (classe && !classe->qmlElement().isEmpty()) {
+ generateInstantiatedBy(classe,marker);
+ }
+#endif
+
generateBrief(inner, marker);
generateIncludes(inner, marker);
generateStatus(inner, marker);
@@ -1225,16 +1254,19 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker)
QList<Section>::const_iterator s;
QString htmlTitle = fake->fullTitle();
- if (fake->subType() == FakeNode::File && !fake->subTitle().isEmpty()) {
+ if (fake->subType() == Node::File && !fake->subTitle().isEmpty()) {
subTitleSize = SmallSubTitle;
htmlTitle += " (" + fake->subTitle() + ")";
}
generateHeader(htmlTitle, fake, marker, true);
- generateTitle(fake->fullTitle(), Text() << fake->subTitle(), subTitleSize,
- fake, marker);
+ generateTitle(fake->fullTitle(),
+ Text() << fake->subTitle(),
+ subTitleSize,
+ fake,
+ marker);
- if (fake->subType() == FakeNode::Module) {
+ if (fake->subType() == Node::Module) {
// Generate brief text and status for modules.
generateBrief(fake, marker);
generateStatus(fake, marker);
@@ -1248,7 +1280,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker)
generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]);
}
}
- else if (fake->subType() == FakeNode::HeaderFile) {
+ else if (fake->subType() == Node::HeaderFile) {
// Generate brief text and status for modules.
generateBrief(fake, marker);
generateStatus(fake, marker);
@@ -1295,7 +1327,49 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker)
appendDcfSubSection(&fakeSection, compatSection);
}
}
+#ifdef QDOC_QML
+ else if (fake->subType() == Node::QmlClass) {
+ const QmlClassNode* qml_cn = static_cast<const QmlClassNode*>(fake);
+ const ClassNode* cn = qml_cn->classNode();
+ generateQmlInherits(qml_cn, marker);
+ generateQmlInstantiates(qml_cn, marker);
+ generateBrief(qml_cn, marker);
+ sections = marker->qmlSections(qml_cn,CodeMarker::Summary);
+ s = sections.begin();
+ while (s != sections.end()) {
+ out() << "<a name=\"" << registerRef((*s).name) << "\"></a>\n";
+ out() << "<h2>" << protect((*s).name) << "</h2>\n";
+ generateQmlSummary(*s,fake,marker);
+ ++s;
+ }
+ out() << "<a name=\"" << registerRef("details") << "\"></a>\n";
+ out() << "<h2>" << "Detailed Description" << "</h2>\n";
+ generateBody(fake, marker);
+ if (cn)
+ generateQmlText(cn->doc().body(), cn, marker, fake->name());
+ generateAlsoList(fake, marker);
+ out() << "<hr />\n";
+
+ sections = marker->qmlSections(qml_cn,CodeMarker::Detailed);
+ s = sections.begin();
+ while (s != sections.end()) {
+ out() << "<h2>" << protect((*s).name) << "</h2>\n";
+ NodeList::ConstIterator m = (*s).members.begin();
+ while (m != (*s).members.end()) {
+ generateDetailedQmlMember(*m, fake, marker);
+ out() << "<br />\n";
+ fakeSection.keywords += qMakePair((*m)->name(),
+ linkForNode(*m,0));
+ ++m;
+ }
+ ++s;
+ }
+ generateFooter(fake);
+ return;
+ }
+#endif
+
sections = marker->sections(fake, CodeMarker::Summary, CodeMarker::Okay);
s = sections.begin();
while (s != sections.end()) {
@@ -1306,24 +1380,12 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker)
}
Text brief = fake->doc().briefText();
- if (fake->subType() == FakeNode::Module && !brief.isEmpty()) {
+ if (fake->subType() == Node::Module && !brief.isEmpty()) {
out() << "<a name=\"" << registerRef("details") << "\"></a>\n";
out() << "<h2>" << "Detailed Description" << "</h2>\n";
}
generateBody(fake, marker);
-#ifdef QDOC_QML
- if (fake->subType() == FakeNode::QmlClass) {
- //qDebug() << "generateFakeNode(): QML CLASS" << fake->name();
- const QmlNode* qmlNode = static_cast<const QmlNode*>(fake);
- const ClassNode* cn = qmlNode->classNode();
- if (cn) {
- //qDebug() << " CPP CLASS" << cn->name();
- generateQmlText(cn->doc().body(), cn, marker);
- }
- }
-#endif
-
generateAlsoList(fake, marker);
if (!fake->groupMembers().isEmpty()) {
@@ -1353,10 +1415,10 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker)
}
generateFooter(fake);
- if (fake->subType() == FakeNode::Example) {
+ if (fake->subType() == Node::Example) {
appendDcfSubSection(&dcfExamplesRoot, fakeSection);
}
- else if (fake->subType() != FakeNode::File) {
+ else if (fake->subType() != Node::File) {
QString contentsPage = fake->links().value(Node::ContentsLink).first;
if (contentsPage == "Qt Designer Manual") {
@@ -1643,7 +1705,10 @@ void HtmlGenerator::generateTableOfContents(const Node *node,
columnSize = 0;
}
out() << "<li>";
- out() << "<a href=\"" << nodeName << "#" << Doc::canonicalTitle(headingText.toString())
+ out() << "<a href=\""
+ << nodeName
+ << "#"
+ << Doc::canonicalTitle(headingText.toString())
<< "\">";
generateAtomList(headingText.firstAtom(), node, marker, true, numAtoms);
out() << "</a></li>\n";
@@ -1693,7 +1758,8 @@ void HtmlGenerator::generateNavigationBar(const NavigationBar& bar,
}
#endif
-QString HtmlGenerator::generateListOfAllMemberFile(const InnerNode *inner, CodeMarker *marker)
+QString HtmlGenerator::generateListOfAllMemberFile(const InnerNode *inner,
+ CodeMarker *marker)
{
QList<Section> sections;
QList<Section>::ConstIterator s;
@@ -1744,7 +1810,8 @@ QString HtmlGenerator::generateLowStatusMemberFile(const InnerNode *inner,
if (status == CodeMarker::Compat) {
title = "Qt 3 Support Members for " + inner->name();
fileName = fileBase(inner) + "-qt3." + fileExtension(inner);
- } else {
+ }
+ else {
title = "Obsolete Members for " + inner->name();
fileName = fileBase(inner) + "-obsolete." + fileExtension(inner);
}
@@ -1758,10 +1825,11 @@ QString HtmlGenerator::generateLowStatusMemberFile(const InnerNode *inner,
"<a href=\"qt3support.html\">Qt 3 support layer</a>.</b> "
"They are provided to help you port old code to Qt 4. We advise against "
"using them in new code.</p>\n";
- } else {
- out() << "<p><b>The following class members are obsolete.</b> They are provided to keep "
- "old source code working. We strongly advise against using them in new "
- "code.</p>\n";
+ }
+ else {
+ out() << "<p><b>The following class members are obsolete.</b> "
+ << "They are provided to keep old source code working. "
+ << "We strongly advise against using them in new code.</p>\n";
}
out() << "<p><ul><li><a href=\""
@@ -1816,8 +1884,10 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative,
if (stack.top().isEmpty()) {
stack.pop();
out() << "</ul>\n";
- } else {
- const ClassNode *child = static_cast<const ClassNode *>(*stack.top().begin());
+ }
+ else {
+ const ClassNode *child =
+ static_cast<const ClassNode *>(*stack.top().begin());
out() << "<li>";
generateFullName(child, relative, marker);
out() << "</li>\n";
@@ -1836,10 +1906,9 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative,
}
}
-void
-HtmlGenerator::generateAnnotatedList(const Node *relative,
- CodeMarker *marker,
- const QMap<QString,const Node *>&nodeMap)
+void HtmlGenerator::generateAnnotatedList(const Node *relative,
+ CodeMarker *marker,
+ const QMap<QString, const Node *> &nodeMap)
{
out() << "<p><table width=\"100%\" class=\"annotated\" cellpadding=\"2\" "
<< "cellspacing=\"1\" border=\"0\">\n";
@@ -1866,7 +1935,8 @@ HtmlGenerator::generateAnnotatedList(const Node *relative,
generateText(brief, node, marker);
out() << "</td>";
}
- } else {
+ }
+ else {
out() << "<td>";
out() << protect(node->doc().briefText().toString());
out() << "</td>";
@@ -1876,10 +1946,9 @@ HtmlGenerator::generateAnnotatedList(const Node *relative,
out() << "</table></p>\n";
}
-void
-HtmlGenerator::generateCompactList(const Node *relative,
- CodeMarker *marker,
- const QMap<QString,const Node*> &classMap)
+void HtmlGenerator::generateCompactList(const Node *relative,
+ CodeMarker *marker,
+ const QMap<QString, const Node *> &classMap)
{
const int NumParagraphs = 37; // '0' to '9', 'A' to 'Z', '_'
const int NumColumns = 4; // number of columns in the result
@@ -1922,8 +1991,9 @@ HtmlGenerator::generateCompactList(const Node *relative,
last = classMap.begin().key();
if (classMap.size() > 1) {
- while (commonPrefixLen < first.length() + 1 && commonPrefixLen < last.length() + 1
- && first[commonPrefixLen] == last[commonPrefixLen])
+ while (commonPrefixLen < first.length() + 1 &&
+ commonPrefixLen < last.length() + 1 &&
+ first[commonPrefixLen] == last[commonPrefixLen])
++commonPrefixLen;
}
@@ -1952,7 +2022,8 @@ HtmlGenerator::generateCompactList(const Node *relative,
if (key[0].digitValue() != -1) {
paragraphNo = key[0].digitValue();
- } else if (key[0] >= QLatin1Char('a') && key[0] <= QLatin1Char('z')) {
+ }
+ else if (key[0] >= QLatin1Char('a') && key[0] <= QLatin1Char('z')) {
paragraphNo = 10 + key[0].unicode() - 'a';
}
@@ -2105,7 +2176,8 @@ void HtmlGenerator::generateFunctionIndex(const Node *relative,
#endif
}
-void HtmlGenerator::generateLegaleseList(const Node *relative, CodeMarker *marker)
+void HtmlGenerator::generateLegaleseList(const Node *relative,
+ CodeMarker *marker)
{
QMap<Text, const Node *>::ConstIterator it = legaleseTexts.begin();
while (it != legaleseTexts.end()) {
@@ -2123,6 +2195,77 @@ void HtmlGenerator::generateLegaleseList(const Node *relative, CodeMarker *marke
}
}
+/*void HtmlGenerator::generateSynopsis(const Node *node,
+ const Node *relative,
+ CodeMarker *marker,
+ CodeMarker::SynopsisStyle style)
+{
+ QString marked = marker->markedUpSynopsis(node, relative, style);
+ QRegExp templateTag("(<[^@>]*>)");
+ if (marked.indexOf(templateTag) != -1) {
+ QString contents = protect(marked.mid(templateTag.pos(1),
+ templateTag.cap(1).length()));
+ marked.replace(templateTag.pos(1), templateTag.cap(1).length(),
+ contents);
+ }
+ marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"),
+ "<i>\\1<sub>\\2</sub></i>");
+ marked.replace("<@param>", "<i>");
+ marked.replace("</@param>", "</i>");
+
+ if (style == CodeMarker::Summary)
+ marked.replace("@name>", "b>");
+
+ if (style == CodeMarker::SeparateList) {
+ QRegExp extraRegExp("<@extra>.*</@extra>");
+ extraRegExp.setMinimal(true);
+ marked.replace(extraRegExp, "");
+ }
+ else {
+ marked.replace("<@extra>", "&nbsp;&nbsp;<tt>");
+ marked.replace("</@extra>", "</tt>");
+ }
+
+ if (style != CodeMarker::Detailed) {
+ marked.replace("<@type>", "");
+ marked.replace("</@type>", "");
+ }
+ out() << highlightedCode(marked, marker, relative);
+}*/
+
+#ifdef QDOC_QML
+void HtmlGenerator::generateQmlItem(const Node *node,
+ const Node *relative,
+ CodeMarker *marker,
+ bool summary)
+{
+ QString marked = marker->markedUpQmlItem(node,summary);
+ QRegExp templateTag("(<[^@>]*>)");
+ if (marked.indexOf(templateTag) != -1) {
+ QString contents = protect(marked.mid(templateTag.pos(1),
+ templateTag.cap(1).length()));
+ marked.replace(templateTag.pos(1), templateTag.cap(1).length(),
+ contents);
+ }
+ marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"),
+ "<i>\\1<sub>\\2</sub></i>");
+ marked.replace("<@param>", "<i>");
+ marked.replace("</@param>", "</i>");
+
+ if (summary)
+ marked.replace("@name>", "b>");
+
+ marked.replace("<@extra>", "&nbsp;&nbsp;<tt>");
+ marked.replace("</@extra>", "</tt>");
+
+ if (summary) {
+ marked.replace("<@type>", "");
+ marked.replace("</@type>", "");
+ }
+ out() << highlightedCode(marked, marker, relative);
+}
+#endif
+
void HtmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* marker */)
{
QMap<const FakeNode *, QMap<QString, FakeNode *> > fakeNodeMap;
@@ -2145,7 +2288,7 @@ void HtmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* m
}
// there are too many examples; they would clutter the list
- if (fakeNode->subType() == FakeNode::Example)
+ if (fakeNode->subType() == Node::Example)
continue;
// not interested either in individual (Qt Designer etc.) manual chapters
@@ -2153,7 +2296,7 @@ void HtmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* m
continue;
// Discard external nodes.
- if (fakeNode->subType() == FakeNode::ExternalPage)
+ if (fakeNode->subType() == Node::ExternalPage)
continue;
QString sortKey = fakeNode->fullTitle().toLower();
@@ -2178,7 +2321,8 @@ void HtmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* m
groupTitlesMap[fakeNode->fullTitle()] = const_cast<const FakeNode *>(fakeNode);
}
}
- } else if (!isGroupPage) {
+ }
+ else if (!isGroupPage) {
// If we encounter a page that belongs to a group then
// we add that page to the list for that group.
const FakeNode *groupNode = static_cast<const FakeNode *>(tre->root()->findNode(group, Node::Fake));
@@ -2737,8 +2881,8 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
i += 2;
if (parseArg(src, linkTag, &i, n, &arg, &par1)) {
- QString link = linkForNode(
- CodeMarker::nodeForString(par1.toString()), relative);
+ const Node* node = CodeMarker::nodeForString(par1.toString());
+ QString link = linkForNode(node, relative);
addLink(link, arg, &html);
}
else {
@@ -2751,7 +2895,6 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
}
}
-
if (slow) {
// is this block ever used at all?
// replace all <@func> tags: "(<@func target=\"([^\"]*)\">)(.*)(</@func>)"
@@ -3076,10 +3219,9 @@ QString HtmlGenerator::fileBase(const Node *node,
QString HtmlGenerator::fileName(const Node *node)
{
if (node->type() == Node::Fake) {
- if (static_cast<const FakeNode *>(node)->subType() == FakeNode::ExternalPage)
+ if (static_cast<const FakeNode *>(node)->subType() == Node::ExternalPage)
return node->name();
}
-
return PageGenerator::fileName(node);
}
@@ -3101,7 +3243,8 @@ QString HtmlGenerator::refForNode(const Node *node)
typedeffe = static_cast<const TypedefNode *>(node);
if (typedeffe->associatedEnum()) {
return refForNode(typedeffe->associatedEnum());
- } else {
+ }
+ else {
ref = node->name() + "-typedef";
}
break;
@@ -3109,15 +3252,27 @@ QString HtmlGenerator::refForNode(const Node *node)
func = static_cast<const FunctionNode *>(node);
if (func->associatedProperty()) {
return refForNode(func->associatedProperty());
- } else {
+ }
+ else {
ref = func->name();
if (func->overloadNumber() != 1)
ref += "-" + QString::number(func->overloadNumber());
}
break;
case Node::Property:
+#ifdef QDOC_QML
+ case Node::QmlProperty:
+#endif
ref = node->name() + "-prop";
break;
+#ifdef QDOC_QML
+ case Node::QmlSignal:
+ ref = node->name() + "-signal";
+ break;
+ case Node::QmlMethod:
+ ref = node->name() + "-method";
+ break;
+#endif
case Node::Variable:
ref = node->name() + "-var";
break;
@@ -3166,9 +3321,11 @@ QString HtmlGenerator::refForAtom(Atom *atom, const Node * /* node */)
{
if (atom->type() == Atom::SectionLeft) {
return Doc::canonicalTitle(Text::sectionHeading(atom).toString());
- } else if (atom->type() == Atom::Target) {
+ }
+ else if (atom->type() == Atom::Target) {
return Doc::canonicalTitle(atom->string());
- } else {
+ }
+ else {
return QString();
}
}
@@ -3212,7 +3369,10 @@ void HtmlGenerator::generateDetailedMember(const Node *node,
out() << "<a name=\"" + refForNode(node) + "\"></a>";
generateSynopsis(enume, relative, marker, CodeMarker::Detailed);
out() << "<br />";
- generateSynopsis(enume->flagsType(), relative, marker, CodeMarker::Detailed);
+ generateSynopsis(enume->flagsType(),
+ relative,
+ marker,
+ CodeMarker::Detailed);
out() << "</h3>\n";
}
else {
@@ -3364,7 +3524,7 @@ void HtmlGenerator::findAllNamespaces(const InnerNode *node)
}
}
-#ifdef ZZZ_QDOC_QML
+#ifdef ZZZ_QDOC_QML
/*!
This function finds all the qml element nodes and
stores them in a map for later use.
@@ -3375,24 +3535,16 @@ void HtmlGenerator::findAllQmlClasses(const InnerNode *node)
while (c != node->childNodes().constEnd()) {
if ((*c)->type() == Node::Fake) {
const FakeNode* fakeNode = static_cast<const FakeNode *>(*c);
- if (fakeNode->subType() == FakeNode::QmlClass) {
- const QmlNode* qmlNode = static_cast<const QmlNode*>(fakeNode);
- //qDebug() << "HtmlGenerator: QML CLASS" << qmlNode->name();
+ if (fakeNode->subType() == Node::QmlClass) {
+ const QmlClassNode* qmlNode =
+ static_cast<const QmlClassNode*>(fakeNode);
const Node* n = qmlNode->classNode();
- if (n)
- //qDebug() << " FOUND IT!" << n->name();
}
qmlClasses.insert(fakeNode->name(),*c);
}
++c;
}
}
-#endif
-
-#if 0
- else if ((*c)->isInnerNode()) {
- findAllClasses(static_cast<InnerNode *>(*c));
- }
#endif
int HtmlGenerator::hOffset(const Node *node)
@@ -3705,3 +3857,214 @@ void HtmlGenerator::endLink()
}
QT_END_NAMESPACE
+
+#ifdef QDOC_QML
+
+/*!
+ Generates the summary for for the \a section. Only used for
+ sections of QML element documentation.
+
+ Currently handles only the QML property group.
+ */
+void HtmlGenerator::generateQmlSummary(const Section& section,
+ const Node *relative,
+ CodeMarker *marker)
+{
+ if (!section.members.isEmpty()) {
+ NodeList::ConstIterator m;
+ int count = section.members.size();
+ bool twoColumn = false;
+ if (section.members.first()->type() == Node::QmlProperty) {
+ twoColumn = (count >= 5);
+ }
+ if (twoColumn)
+ out() << "<p><table width=\"100%\" border=\"0\" cellpadding=\"0\""
+ " cellspacing=\"0\">\n"
+ << "<tr><td width=\"45%\" valign=\"top\">";
+ out() << "<ul>\n";
+
+ int row = 0;
+ m = section.members.begin();
+ while (m != section.members.end()) {
+ if (twoColumn && row == (int) (count + 1) / 2)
+ out() << "</ul></td><td valign=\"top\"><ul>\n";
+ out() << "<li><div class=\"fn\"></div>";
+ generateQmlItem(*m,relative,marker,true);
+ out() << "</li>\n";
+ row++;
+ ++m;
+ }
+ out() << "</ul>\n";
+ if (twoColumn)
+ out() << "</td></tr>\n</table></p>\n";
+ }
+}
+
+/*!
+ Outputs the html detailed documentation for a section
+ on a QML element reference page.
+ */
+void HtmlGenerator::generateDetailedQmlMember(const Node *node,
+ const InnerNode *relative,
+ CodeMarker *marker)
+{
+ const QmlPropertyNode* qpn = 0;
+ generateMacRef(node, marker);
+ out() << "<div class=\"qmlitem\">";
+ if (node->subType() == Node::QmlPropertyGroup) {
+ const QmlPropGroupNode* qpgn = static_cast<const QmlPropGroupNode*>(node);
+ NodeList::ConstIterator p = qpgn->childNodes().begin();
+ out() << "<div class=\"qmlproto\">";
+ out() << "<table class=\"qmlname\">";
+
+ while (p != qpgn->childNodes().end()) {
+ if ((*p)->type() == Node::QmlProperty) {
+ qpn = static_cast<const QmlPropertyNode*>(*p);
+ out() << "<tr><td>";
+ out() << "<a name=\"" + refForNode(qpn) + "\"></a>";
+ generateQmlItem(qpn, relative, marker, false);
+ out() << "</td></tr>";
+ if (qpgn->isDefault()) {
+ out() << "</table>"
+ << "</div></div>"
+ << "<div class=\"qmlitem\">"
+ << "<div class=\"qmlproto\">"
+ << "<table class=\"qmlname\">"
+ << "<tr><td><font color=\"green\">"
+ << "default</font></td></tr>";
+ }
+ }
+ ++p;
+ }
+ out() << "</table>";
+ out() << "</div>";
+ }
+ else if (node->type() == Node::QmlSignal) {
+ const QmlSignalNode* qsn = static_cast<const QmlSignalNode*>(node);
+ out() << "<div class=\"qmlproto\">";
+ out() << "<table class=\"qmlname\">";
+ out() << "<tr><td>";
+ out() << "<a name=\"" + refForNode(qsn) + "\"></a>";
+ generateQmlItem(qsn,relative,marker,false);
+ out() << "</td></tr>";
+ out() << "</table>";
+ out() << "</div>";
+ }
+ else if (node->type() == Node::QmlMethod) {
+ const QmlMethodNode* qmn = static_cast<const QmlMethodNode*>(node);
+ out() << "<div class=\"qmlproto\">";
+ out() << "<table class=\"qmlname\">";
+ out() << "<tr><td>";
+ out() << "<a name=\"" + refForNode(qmn) + "\"></a>";
+ generateQmlItem(qmn,relative,marker,false);
+ out() << "</td></tr>";
+ out() << "</table>";
+ out() << "</div>";
+ }
+ out() << "<div class=\"qmldoc\">";
+ generateStatus(node, marker);
+ generateBody(node, marker);
+ generateThreadSafeness(node, marker);
+ generateSince(node, marker);
+ generateAlsoList(node, marker);
+ out() << "</div>";
+ out() << "</div>";
+}
+
+/*!
+ Output the "Inherits" line for the QML element,
+ if there should be one.
+ */
+void HtmlGenerator::generateQmlInherits(const QmlClassNode* cn,
+ CodeMarker* marker)
+{
+ if (cn && !cn->links().empty()) {
+ if (cn->links().contains(Node::InheritsLink)) {
+ QPair<QString,QString> linkPair;
+ linkPair = cn->links()[Node::InheritsLink];
+ QStringList strList(linkPair.first);
+ const Node* n = tre->findNode(strList,Node::Fake);
+ if (n && n->subType() == Node::QmlClass) {
+ const QmlClassNode* qcn = static_cast<const QmlClassNode*>(n);
+ out() << "<p style=\"text-align: center\">";
+ Text text;
+ text << "[Inherits ";
+ text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn));
+ text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
+ text << Atom(Atom::String, linkPair.second);
+ text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
+ text << "]";
+ generateText(text, cn, marker);
+ out() << "</p>";
+ }
+// else
+// qDebug() << "generateQmlInherits(): "
+// << "Inherited element not documented -->"
+// << linkPair.first;
+ }
+ }
+}
+
+/*!
+ Output the "[Xxx instantiates the C++ class QFxXxx]"
+ line for the QML element, if there should be one.
+
+ If there is no class node, or if the class node status
+ is set to Node::Internal, do nothing.
+ */
+void HtmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn,
+ CodeMarker* marker)
+{
+ const ClassNode* cn = qcn->classNode();
+ if (cn && (cn->status() != Node::Internal)) {
+ out() << "<p style=\"text-align: center\">";
+ Text text;
+ text << "[";
+ text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn));
+ text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
+ text << Atom(Atom::String, qcn->name());
+ text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
+ text << " instantiates the C++ class ";
+ text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn));
+ text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
+ text << Atom(Atom::String, cn->name());
+ text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
+ text << "]";
+ generateText(text, qcn, marker);
+ out() << "</p>";
+ }
+}
+
+/*!
+ Output the "[QFxXxx is instantiated by QML element Xxx]"
+ line for the class, if there should be one.
+
+ If there is no QML element, or if the class node status
+ is set to Node::Internal, do nothing.
+ */
+void HtmlGenerator::generateInstantiatedBy(const ClassNode* cn,
+ CodeMarker* marker)
+{
+ if (cn && cn->status() != Node::Internal && !cn->qmlElement().isEmpty()) {
+ const Node* n = tre->root()->findNode(cn->qmlElement(),Node::Fake);
+ if (n && n->subType() == Node::QmlClass) {
+ out() << "<p style=\"text-align: center\">";
+ Text text;
+ text << "[";
+ text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn));
+ text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
+ text << Atom(Atom::String, cn->name());
+ text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
+ text << " is instantiated by QML element ";
+ text << Atom(Atom::LinkNode,CodeMarker::stringForNode(n));
+ text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK);
+ text << Atom(Atom::String, n->name());
+ text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
+ text << "]";
+ generateText(text, cn, marker);
+ out() << "</p>";
+ }
+ }
+}
+
+#endif