summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorCasper van Donderen <casper.vandonderen@nokia.com>2011-08-30 08:44:54 (GMT)
committerCasper van Donderen <casper.vandonderen@nokia.com>2011-08-30 08:44:54 (GMT)
commit214a26fbde1c5600a10db59217ae9b63a46bce9e (patch)
tree601e9edf2832834f0ffef9c7b5c54303ce2f70d2 /tools
parent7f27ebb0383414f15f391151655e5b09952f8ccd (diff)
parentad203bc0bd17be1ade143e38cdc7e8eca26ebc07 (diff)
downloadQt-214a26fbde1c5600a10db59217ae9b63a46bce9e.zip
Qt-214a26fbde1c5600a10db59217ae9b63a46bce9e.tar.gz
Qt-214a26fbde1c5600a10db59217ae9b63a46bce9e.tar.bz2
Merge branch '4.8'
Conflicts: doc/src/declarative/righttoleft.qdoc
Diffstat (limited to 'tools')
-rw-r--r--tools/qdoc3/codemarker.cpp2
-rw-r--r--tools/qdoc3/codeparser.cpp3
-rw-r--r--tools/qdoc3/cppcodemarker.cpp28
-rw-r--r--tools/qdoc3/cppcodeparser.cpp17
-rw-r--r--tools/qdoc3/ditaxmlgenerator.cpp10
-rw-r--r--tools/qdoc3/doc.cpp4
-rw-r--r--tools/qdoc3/generator.h4
-rw-r--r--tools/qdoc3/htmlgenerator.cpp199
-rw-r--r--tools/qdoc3/htmlgenerator.h5
-rw-r--r--tools/qdoc3/node.cpp50
-rw-r--r--tools/qdoc3/node.h29
11 files changed, 303 insertions, 48 deletions
diff --git a/tools/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp
index 614419e..705ef6c 100644
--- a/tools/qdoc3/codemarker.cpp
+++ b/tools/qdoc3/codemarker.cpp
@@ -76,7 +76,7 @@ CodeMarker::~CodeMarker()
A code market performs no initialization by default. Marker-specific
initialization is performed in subclasses.
*/
-void CodeMarker::initializeMarker(const Config &config)
+void CodeMarker::initializeMarker(const Config& ) // config
{
}
diff --git a/tools/qdoc3/codeparser.cpp b/tools/qdoc3/codeparser.cpp
index c7a8912..9ab5f82 100644
--- a/tools/qdoc3/codeparser.cpp
+++ b/tools/qdoc3/codeparser.cpp
@@ -287,6 +287,9 @@ void CodeParser::processCommonMetaCommand(const Location &location,
FakeNode *fake = static_cast<FakeNode *>(node);
fake->setTitle(arg);
nameToTitle.insert(fake->name(),arg);
+ if (fake->subType() == Node::Example) {
+
+ }
}
else
location.warning(tr("Ignored '\\%1'").arg(COMMAND_TITLE));
diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp
index b3dc31a..0fc30bc 100644
--- a/tools/qdoc3/cppcodemarker.cpp
+++ b/tools/qdoc3/cppcodemarker.cpp
@@ -483,10 +483,10 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
"",
"public function",
"public functions");
- FastSection publicSignals(classe, "Signals", "", "signal", "signals");
- FastSection publicSlots(classe, "Public Slots", "", "public slot", "public slots");
- FastSection publicTypes(classe, "Public Types", "", "public type", "public types");
- FastSection publicVariables(classe,
+ FastSection publicSignals(classe, "Signals", "", "signal", "signal");
+ FastSection publicSlots(classe, "Public Slots", "", "public slot", "public slots");
+ FastSection publicTypes(classe, "Public Types", "", "public type", "public types");
+ FastSection publicVariables(classe,
"Public Variables",
"",
"public variable",
@@ -878,6 +878,7 @@ static const char * const keywordTable[] = {
"signals", "slots", "emit", 0
};
+#if 0
static QString untabified(const QString &in)
{
QString res;
@@ -897,6 +898,7 @@ static QString untabified(const QString &in)
return res;
}
+#endif
/*
@char
@@ -1157,15 +1159,15 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode,
"property",
"properties");
FastSection qmlsignals(qmlClassNode,
- "Signals",
+ "Signal Handlers",
"",
- "signal",
- "signals");
+ "signal handler",
+ "signal handlers");
FastSection qmlattachedsignals(qmlClassNode,
- "Attached Signals",
+ "Attached Signal Handlers",
"",
- "signal",
- "signals");
+ "signal handler",
+ "signal handlers");
FastSection qmlmethods(qmlClassNode,
"Methods",
"",
@@ -1220,9 +1222,9 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode,
FastSection qmlproperties(qmlClassNode, "Property Documentation","qmlprop","member","members");
FastSection qmlattachedproperties(qmlClassNode,"Attached Property Documentation","qmlattprop",
"member","members");
- FastSection qmlsignals(qmlClassNode,"Signal Documentation","qmlsig","member","members");
- FastSection qmlattachedsignals(qmlClassNode,"Attached Signal Documentation","qmlattsig",
- "member","members");
+ FastSection qmlsignals(qmlClassNode,"Signal Handler Documentation","qmlsig","handler","handlers");
+ FastSection qmlattachedsignals(qmlClassNode,"Attached Signal Handler Documentation","qmlattsig",
+ "handler","handlers");
FastSection qmlmethods(qmlClassNode,"Method Documentation","qmlmeth","member","members");
FastSection qmlattachedmethods(qmlClassNode,"Attached Method Documentation","qmlattmeth",
"member","members");
diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp
index 6f5baa0..1a4c344 100644
--- a/tools/qdoc3/cppcodeparser.cpp
+++ b/tools/qdoc3/cppcodeparser.cpp
@@ -47,7 +47,7 @@
#include <stdio.h>
#include <errno.h>
-
+#include <qdebug.h>
#include "codechunk.h"
#include "config.h"
#include "cppcodeparser.h"
@@ -704,7 +704,7 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc,
if (command == COMMAND_CLASS) {
if (paths.size() > 1) {
if (!paths[1].endsWith(".h")) {
- ClassNode*cnode = static_cast<ClassNode*>(node);
+ ClassNode* cnode = static_cast<ClassNode*>(node);
cnode->setQmlElement(paths[1]);
}
}
@@ -712,9 +712,9 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc,
return node;
}
else if (command == COMMAND_EXAMPLE) {
- FakeNode *fake = new FakeNode(tre->root(), arg, Node::Example);
- createExampleFileNodes(fake);
- return fake;
+ ExampleNode* en = new ExampleNode(tre->root(), arg);
+ createExampleFileNodes(en);
+ return en;
}
else if (command == COMMAND_EXTERNALPAGE) {
return new FakeNode(tre->root(), arg, Node::ExternalPage);
@@ -2349,8 +2349,8 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake)
proFileName,
userFriendlyFilePath);
if (fullPath.isEmpty()) {
- fake->doc().location().warning(
- tr("Cannot find file '%1' or '%2'").arg(tmp).arg(proFileName));
+ fake->doc().location().warning(tr("Cannot find file '%1' or '%2'").arg(tmp).arg(proFileName));
+ fake->doc().location().warning(tr("EXAMPLE PATH DOES NOT EXIST: %1").arg(examplePath));
return;
}
}
@@ -2362,7 +2362,6 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake)
QStringList exampleFiles = Config::getFilesHere(fullPath,exampleNameFilter);
QString imagesPath = fullPath + "/images";
QStringList imageFiles = Config::getFilesHere(imagesPath,exampleImageFilter);
-
if (!exampleFiles.isEmpty()) {
// move main.cpp and to the end, if it exists
QString mainCpp;
@@ -2382,7 +2381,7 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake)
exampleFiles.append(mainCpp);
// add any qmake Qt resource files and qmake project files
- exampleFiles += Config::getFilesHere(fullPath, "*.qrc *.pro qmldir");
+ exampleFiles += Config::getFilesHere(fullPath, "*.qrc *.pro *.qmlproject qmldir");
}
foreach (const QString &exampleFile, exampleFiles)
diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp
index fc66923..4393e8d 100644
--- a/tools/qdoc3/ditaxmlgenerator.cpp
+++ b/tools/qdoc3/ditaxmlgenerator.cpp
@@ -76,7 +76,7 @@ QString DitaXmlGenerator::sinceTitles[] =
" New Variables",
" New QML Elements",
" New Qml Properties",
- " New Qml Signals",
+ " New Qml Signal Handlers",
" New Qml Methods",
""
};
@@ -770,7 +770,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
{
writeStartTag(DT_codeblock);
xmlWriter().writeAttribute("outputclass","cpp");
- QString chars = trimmedTrailing(atom->string());
+ QString chars = trimmedTrailing(atom->string());
writeText(chars, marker, relative);
writeEndTag(); // </codeblock>
}
@@ -3408,6 +3408,7 @@ void DitaXmlGenerator::writeText(const QString& markedCode,
"<@type>", "<@type>",
"<@headerfile>", "<@headerfile>",
"<@func>", "<@func>",
+ "<@func ", "<@func ",
"<@param>", "<@param>",
"<@extra>", "<@extra>",
"</@link>", "</@link>",
@@ -3420,7 +3421,7 @@ void DitaXmlGenerator::writeText(const QString& markedCode,
for (int i = 0, n = src.size(); i < n;) {
if (src.at(i) == charLangle) {
bool handled = false;
- for (int k = 0; k != 12; ++k) {
+ for (int k = 0; k != 13; ++k) {
const QString & tag = spanTags[2 * k];
if (tag == QStringRef(&src, i, tag.length())) {
html += spanTags[2 * k + 1];
@@ -4397,7 +4398,8 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node* node,
writeStartTag(DT_li);
writeGuidAttribute((Node*)qpn);
QString attr;
- if (!qpn->isWritable(myTree))
+ const ClassNode* cn = qpn->declarativeCppNode();
+ if (cn && !qpn->isWritable(myTree))
attr = "read-only";
if (qpgn->isDefault()) {
if (!attr.isEmpty())
diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp
index 479931d..f0c4264 100644
--- a/tools/qdoc3/doc.cpp
+++ b/tools/qdoc3/doc.cpp
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC(QSet<QString>, null_Set_QString)
Q_GLOBAL_STATIC(QStringList, null_QStringList)
Q_GLOBAL_STATIC(QList<Text>, null_QList_Text)
-Q_GLOBAL_STATIC(QStringMap, null_QStringMap)
+//Q_GLOBAL_STATIC(QStringMap, null_QStringMap)
Q_GLOBAL_STATIC(QStringMultiMap, null_QStringMultiMap)
struct Macro
@@ -1861,7 +1861,7 @@ void DocParser::startSection(Doc::Sections unit, int cmd)
}
-void DocParser::endSection(int unit, int endCmd)
+void DocParser::endSection(int , int) // (int unit, int endCmd)
{
leavePara();
append(Atom::SectionRight, QString::number(currentSection));
diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h
index e5e9747..d4fe76f 100644
--- a/tools/qdoc3/generator.h
+++ b/tools/qdoc3/generator.h
@@ -57,6 +57,10 @@
QT_BEGIN_NAMESPACE
+typedef QMap<QString, NodeMultiMap> NewSinceMaps;
+typedef QMap<Node*, NodeMultiMap> ParentMaps;
+typedef QMap<QString, NodeMap> NewClassMaps;
+
class ClassNode;
class Config;
class CodeMarker;
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index 52da178..e79e180 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -80,7 +80,7 @@ QString HtmlGenerator::sinceTitles[] =
" New Variables",
" New QML Elements",
" New QML Properties",
- " New QML Signals",
+ " New QML Signal Handlers",
" New QML Methods",
""
};
@@ -180,6 +180,9 @@ void HtmlGenerator::initializeGenerator(const Config &config)
pleaseGenerateMacRef = config.getBool(HtmlGenerator::format() +
Config::dot +
HTMLGENERATOR_GENERATEMACREFS);
+ noBreadCrumbs = config.getBool(HtmlGenerator::format() +
+ Config::dot +
+ HTMLGENERATOR_NOBREADCRUMBS);
project = config.getString(CONFIG_PROJECT);
@@ -276,6 +279,7 @@ void HtmlGenerator::generateTree(const Tree *tree)
generatePageIndex(outputDir() + "/" + fileBase + ".pageindex");
helpProjectWriter->generate(myTree);
+ generateManifestFiles();
}
void HtmlGenerator::startText(const Node * /* relative */,
@@ -331,8 +335,10 @@ int HtmlGenerator::generateAtom(const Atom *atom,
break;
case Atom::BriefLeft:
if (relative->type() == Node::Fake) {
- skipAhead = skipAtoms(atom, Atom::BriefRight);
- break;
+ if (relative->subType() != Node::Example) {
+ skipAhead = skipAtoms(atom, Atom::BriefRight);
+ break;
+ }
}
out() << "<p>";
@@ -765,6 +771,15 @@ int HtmlGenerator::generateAtom(const Atom *atom,
out() << " alt=\"" << protectEnc(text) << "\"";
out() << " />";
helpProjectWriter->addExtraFile(fileName);
+ if ((relative->type() == Node::Fake) &&
+ (relative->subType() == Node::Example)) {
+ const ExampleNode* cen = static_cast<const ExampleNode*>(relative);
+ if (cen->imageFileName().isEmpty()) {
+ ExampleNode* en = const_cast<ExampleNode*>(cen);
+ en->setImageFileName(fileName);
+ ExampleNode::exampleNodeMap.insert(en->title(),en);
+ }
+ }
}
if (atom->type() == Atom::Image)
out() << "</p>";
@@ -1504,8 +1519,10 @@ void HtmlGenerator::generateBreadCrumbs(const QString &title,
const Node *node,
CodeMarker *marker)
{
+ if (noBreadCrumbs)
+ return;
+
Text breadcrumbs;
-
if (node->type() == Node::Class) {
const ClassNode *cn = static_cast<const ClassNode *>(node);
QString name = node->moduleName();
@@ -1792,7 +1809,6 @@ void HtmlGenerator::generateTableOfContents(const Node *node,
toc = node->doc().tableOfContents();
if (toc.isEmpty() && !sections && (node->subType() != Node::Module))
return;
- bool debug = false;
QStringList sectionNumber;
int detailsBase = 0;
@@ -3779,8 +3795,6 @@ void HtmlGenerator::endLink()
inObsoleteLink = false;
}
-#ifdef QDOC_QML
-
/*!
Generates the summary for the \a section. Only used for
sections of QML element documentation.
@@ -3837,7 +3851,8 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node,
out() << "<a name=\"" + refForNode(qpn) + "\"></a>";
- if (!qpn->isWritable(myTree)) {
+ const ClassNode* cn = qpn->declarativeCppNode();
+ if (cn && !qpn->isWritable(myTree)) {
out() << "<span class=\"qmlreadonly\">read-only</span>";
}
if (qpgn->isDefault())
@@ -4266,7 +4281,6 @@ QString HtmlGenerator::fullDocumentLocation(const Node *node)
return "";
}
else if (node->type() == Node::Fake) {
-#ifdef QDOC_QML
if ((node->subType() == Node::QmlClass) ||
(node->subType() == Node::QmlBasicType)) {
QString fb = node->fileBase();
@@ -4274,9 +4288,9 @@ QString HtmlGenerator::fullDocumentLocation(const Node *node)
return fb + ".html";
else
return Generator::outputPrefix(QLatin1String("QML")) + node->fileBase() + QLatin1String(".html");
- } else
-#endif
- parentName = node->fileBase() + ".html";
+ }
+ else
+ parentName = node->fileBase() + ".html";
}
else if (node->fileBase().isEmpty())
return "";
@@ -4387,6 +4401,165 @@ QString HtmlGenerator::fullDocumentLocation(const Node *node)
return parentName.toLower() + anchorRef;
}
-#endif
+/*!
+ This function outputs one or more manifest files in XML.
+ They are used by Creator.
+ */
+void HtmlGenerator::generateManifestFiles()
+{
+ generateManifestFile("examples", "example");
+ generateManifestFile("demos", "demo");
+ ExampleNode::exampleNodeMap.clear();
+}
+
+/*!
+ This function is called by generaqteManiferstFile(), once
+ for each manifest file to be generated. \a manifest is the
+ type of manifest file.
+ */
+void HtmlGenerator::generateManifestFile(QString manifest, QString element)
+{
+ if (ExampleNode::exampleNodeMap.isEmpty())
+ return;
+ QString fileName = manifest +"-manifest.xml";
+ QFile file(outputDir() + "/" + fileName);
+ if (!file.open(QFile::WriteOnly | QFile::Text))
+ return ;
+ bool demos = false;
+ if (manifest == "demos")
+ demos = true;
+
+ bool proceed = false;
+ ExampleNodeMap::Iterator i = ExampleNode::exampleNodeMap.begin();
+ while (i != ExampleNode::exampleNodeMap.end()) {
+ const ExampleNode* en = i.value();
+ if (demos) {
+ if (en->name().startsWith("demos")) {
+ proceed = true;
+ break;
+ }
+ }
+ else if (!en->name().startsWith("demos")) {
+ proceed = true;
+ break;
+ }
+ ++i;
+ }
+ if (!proceed)
+ return;
+
+ QXmlStreamWriter writer(&file);
+ writer.setAutoFormatting(true);
+ writer.writeStartDocument();
+ writer.writeStartElement("instructionals");
+ writer.writeAttribute("module", project);
+ writer.writeStartElement(manifest);
+
+ i = ExampleNode::exampleNodeMap.begin();
+ while (i != ExampleNode::exampleNodeMap.end()) {
+ const ExampleNode* en = i.value();
+ if (demos) {
+ if (!en->name().startsWith("demos")) {
+ ++i;
+ continue;
+ }
+ }
+ else if (en->name().startsWith("demos")) {
+ ++i;
+ continue;
+ }
+ writer.writeStartElement(element);
+ writer.writeAttribute("name", en->title());
+ //QString docUrl = projectUrl + "/" + en->fileBase() + ".html";
+ QString docUrl = "%REPLACEME%/" + en->fileBase() + ".html";
+ writer.writeAttribute("docUrl", docUrl);
+ foreach (const Node* child, en->childNodes()) {
+ if (child->subType() == Node::File) {
+ QString file = child->name();
+ if (file.endsWith(".pro") || file.endsWith(".qmlproject")) {
+ if (file.startsWith("demos/"))
+ file = file.mid(6);
+ writer.writeAttribute("projectPath", file);
+ break;
+ }
+ }
+ }
+ //writer.writeAttribute("imageUrl", projectUrl + "/" + en->imageFileName());
+ writer.writeAttribute("imageUrl", "%REPLACEME%/" + en->imageFileName());
+ writer.writeStartElement("description");
+ Text brief = en->doc().briefText();
+ if (!brief.isEmpty())
+ writer.writeCDATA(brief.toString());
+ else
+ writer.writeCDATA(QString("No description available"));
+ writer.writeEndElement(); // description
+ QStringList tags = en->title().toLower().split(" ");
+ if (!tags.isEmpty()) {
+ writer.writeStartElement("tags");
+ bool wrote_one = false;
+ for (int n=0; n<tags.size(); ++n) {
+ QString tag = tags.at(n);
+ if (tag.at(0).isDigit())
+ continue;
+ if (tag.at(0) == '-')
+ continue;
+ if (tag.startsWith("example"))
+ continue;
+ if (tag.startsWith("chapter"))
+ continue;
+ if (tag.endsWith(":"))
+ tag.chop(1);
+ if (n>0 && wrote_one)
+ writer.writeCharacters(",");
+ writer.writeCharacters(tag);
+ wrote_one = true;
+ }
+ writer.writeEndElement(); // tags
+ }
+
+ QString ename = en->name().mid(en->name().lastIndexOf('/')+1);
+ QSet<QString> usedNames;
+ foreach (const Node* child, en->childNodes()) {
+ if (child->subType() == Node::File) {
+ QString file = child->name();
+ QString fileName = file.mid(file.lastIndexOf('/')+1);
+ QString baseName = fileName;
+ if ((fileName.count(QChar('.')) > 0) &&
+ (fileName.endsWith(".cpp") ||
+ fileName.endsWith(".h") ||
+ fileName.endsWith(".qml")))
+ baseName.truncate(baseName.lastIndexOf(QChar('.')));
+ if (baseName.toLower() == ename) {
+ if (!usedNames.contains(fileName)) {
+ writer.writeStartElement("fileToOpen");
+ if (file.startsWith("demos/"))
+ file = file.mid(6);
+ writer.writeCharacters(file);
+ writer.writeEndElement(); // fileToOpen
+ usedNames.insert(fileName);
+ }
+ }
+ else if (fileName.toLower().endsWith("main.cpp") ||
+ fileName.toLower().endsWith("main.qml")) {
+ if (!usedNames.contains(fileName)) {
+ writer.writeStartElement("fileToOpen");
+ if (file.startsWith("demos/"))
+ file = file.mid(6);
+ writer.writeCharacters(file);
+ writer.writeEndElement(); // fileToOpen
+ usedNames.insert(fileName);
+ }
+ }
+ }
+ }
+ writer.writeEndElement(); // example
+ ++i;
+ }
+
+ writer.writeEndElement(); // examples
+ writer.writeEndElement(); // instructionals
+ writer.writeEndDocument();
+ file.close();
+}
QT_END_NAMESPACE
diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h
index 70ec0b7..70508a0 100644
--- a/tools/qdoc3/htmlgenerator.h
+++ b/tools/qdoc3/htmlgenerator.h
@@ -93,6 +93,7 @@ class HtmlGenerator : public PageGenerator
virtual void terminateGenerator();
virtual QString format();
virtual void generateTree(const Tree *tree);
+ void generateManifestFiles();
QString protectEnc(const QString &string);
static QString protect(const QString &string, const QString &encoding = "ISO-8859-1");
@@ -112,6 +113,8 @@ class HtmlGenerator : public PageGenerator
virtual QString linkForNode(const Node *node, const Node *relative);
virtual QString refForAtom(Atom *atom, const Node *node);
+ void generateManifestFile(QString manifest, QString element);
+
private:
enum SubTitleSize { SmallSubTitle, LargeSubTitle };
enum ExtractionMarkType {
@@ -273,6 +276,7 @@ class HtmlGenerator : public PageGenerator
QString footer;
QString address;
bool pleaseGenerateMacRef;
+ bool noBreadCrumbs;
QString project;
QString projectDescription;
QString projectUrl;
@@ -307,6 +311,7 @@ class HtmlGenerator : public PageGenerator
#define HTMLGENERATOR_GENERATEMACREFS "generatemacrefs" // ### document me
#define HTMLGENERATOR_POSTHEADER "postheader"
#define HTMLGENERATOR_POSTPOSTHEADER "postpostheader"
+#define HTMLGENERATOR_NOBREADCRUMBS "nobreadcrumbs"
QT_END_NAMESPACE
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp
index 56d76d3..b1d94e2 100644
--- a/tools/qdoc3/node.cpp
+++ b/tools/qdoc3/node.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/*
- node.cpp
-*/
-
#include "node.h"
#include "tree.h"
#include "codemarker.h"
@@ -51,6 +47,8 @@
QT_BEGIN_NAMESPACE
+ExampleNodeMap ExampleNode::exampleNodeMap;
+
/*!
\class Node
\brief The Node class is a node in the Tree.
@@ -307,6 +305,38 @@ QString Node::ditaXmlHref()
}
/*!
+ If this node is a QML class node, return a pointer to it.
+ If it is a child of a QML class node, return a pointer to
+ the QML class node. Otherwise, return 0;
+ */
+const QmlClassNode* Node::qmlClassNode() const
+{
+ if (isQmlNode()) {
+ const Node* n = this;
+ while (n && n->subType() != Node::QmlClass)
+ n = n->parent();
+ if (n && n->subType() == Node::QmlClass)
+ return static_cast<const QmlClassNode*>(n);
+ }
+ return 0;
+}
+
+/*!
+ If this node is a QML node, find its QML class node,
+ and return a pointer to the C++ class node from the
+ QML class node. That pointer will be null if the QML
+ class node is a component. It will be non-null if
+ the QML class node is a QML element.
+ */
+const ClassNode* Node::declarativeCppNode() const
+{
+ const QmlClassNode* qcn = qmlClassNode();
+ if (qcn)
+ return qcn->classNode();
+ return 0;
+}
+
+/*!
\class InnerNode
*/
@@ -1063,6 +1093,16 @@ QString FakeNode::subTitle() const
}
/*!
+ The constructor calls the FakeNode constructor with
+ \a parent, \a name, and Node::Example.
+ */
+ExampleNode::ExampleNode(InnerNode* parent, const QString& name)
+ : FakeNode(parent, name, Node::Example)
+{
+ // nothing
+}
+
+/*!
\class EnumNode
*/
@@ -1684,6 +1724,7 @@ bool QmlPropertyNode::fromTrool(Trool troolean, bool defaultValue)
}
}
+#if 0
static QString valueType(const QString &n)
{
if (n == "QPoint")
@@ -1714,6 +1755,7 @@ static QString valueType(const QString &n)
return "QDeclarativeFontValueType";
return QString();
}
+#endif
/*!
Returns true if a QML property or attached property is
diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h
index e1e9440..3b031b6 100644
--- a/tools/qdoc3/node.h
+++ b/tools/qdoc3/node.h
@@ -58,7 +58,15 @@
QT_BEGIN_NAMESPACE
+class Node;
+class ClassNode;
class InnerNode;
+class ExampleNode;
+class QmlClassNode;
+
+typedef QMap<QString, const Node*> NodeMap;
+typedef QMultiMap<QString, Node*> NodeMultiMap;
+typedef QMap<QString, const ExampleNode*> ExampleNodeMap;
class Node
{
@@ -194,6 +202,8 @@ class Node
QString guid() const;
QString ditaXmlHref();
QString extractClassName(const QString &string) const;
+ const QmlClassNode* qmlClassNode() const;
+ const ClassNode* declarativeCppNode() const;
protected:
Node(Type type, InnerNode* parent, const QString& name);
@@ -380,8 +390,10 @@ class FakeNode : public InnerNode
virtual QString title() const;
virtual QString fullTitle() const;
virtual QString subTitle() const;
+ virtual QString imageFileName() const { return QString(); }
const NodeList &groupMembers() const { return gr; }
virtual QString nameForLists() const { return title(); }
+ virtual void setImageFileName(const QString& ) { }
private:
SubType sub;
@@ -390,7 +402,21 @@ class FakeNode : public InnerNode
NodeList gr;
};
-#ifdef QDOC_QML
+class ExampleNode : public FakeNode
+{
+ public:
+ ExampleNode(InnerNode* parent, const QString& name);
+ virtual ~ExampleNode() { }
+ virtual QString imageFileName() const { return imageFileName_; }
+ virtual void setImageFileName(const QString& ifn) { imageFileName_ = ifn; }
+
+ public:
+ static ExampleNodeMap exampleNodeMap;
+
+ private:
+ QString imageFileName_;
+};
+
class QmlClassNode : public FakeNode
{
public:
@@ -482,7 +508,6 @@ class QmlPropertyNode : public LeafNode
Trool wri;
bool att;
};
-#endif
class EnumItem
{