summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMartin Smith <msmith@trolltech.com>2010-02-03 14:45:20 +0100
committerMartin Smith <msmith@trolltech.com>2010-02-03 14:45:20 +0100
commit63f66fb0008f93638de782b03f53e9777a941ab7 (patch)
tree1e52796ba03461346a8ec38785fe881f41fd7953 /tools
parentd50c672b037005dfd838bf7658ab7f2888697e85 (diff)
downloadqt4-tools-63f66fb0008f93638de782b03f53e9777a941ab7.tar.gz
qdoc3: Added support for the \qmlbasictype command.
Diffstat (limited to 'tools')
-rw-r--r--tools/qdoc3/cppcodeparser.cpp18
-rw-r--r--tools/qdoc3/htmlgenerator.cpp9
-rw-r--r--tools/qdoc3/node.cpp28
-rw-r--r--tools/qdoc3/node.h11
-rw-r--r--tools/qdoc3/pagegenerator.cpp7
-rw-r--r--tools/qdoc3/tree.cpp3
6 files changed, 68 insertions, 8 deletions
diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp
index 9b6a516db5..7d08c77017 100644
--- a/tools/qdoc3/cppcodeparser.cpp
+++ b/tools/qdoc3/cppcodeparser.cpp
@@ -95,6 +95,7 @@ QT_BEGIN_NAMESPACE
#define COMMAND_QMLMETHOD Doc::alias("qmlmethod")
#define COMMAND_QMLATTACHEDMETHOD Doc::alias("qmlattachedmethod")
#define COMMAND_QMLDEFAULT Doc::alias("default")
+#define COMMAND_QMLBASICTYPE Doc::alias("qmlbasictype")
#endif
QStringList CppCodeParser::exampleFiles;
@@ -536,7 +537,8 @@ QSet<QString> CppCodeParser::topicCommands()
<< COMMAND_QMLSIGNAL
<< COMMAND_QMLATTACHEDSIGNAL
<< COMMAND_QMLMETHOD
- << COMMAND_QMLATTACHEDMETHOD;
+ << COMMAND_QMLATTACHEDMETHOD
+ << COMMAND_QMLBASICTYPE;
#else
<< COMMAND_VARIABLE;
#endif
@@ -728,6 +730,20 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc,
}
return new QmlClassNode(tre->root(), names[0], classNode);
}
+ else if (command == COMMAND_QMLBASICTYPE) {
+#if 0
+ QStringList parts = arg.split(" ");
+ qDebug() << command << parts;
+ if (parts.size() > 1) {
+ FakeNode* pageNode = static_cast<FakeNode*>(tre->root()->findNode(parts[1], Node::Fake));
+ if (pageNode) {
+ qDebug() << "FOUND";
+ return new QmlBasicTypeNode(pageNode, parts[0]);
+ }
+ }
+#endif
+ return new QmlBasicTypeNode(tre->root(), arg);
+ }
else if ((command == COMMAND_QMLSIGNAL) ||
(command == COMMAND_QMLMETHOD) ||
(command == COMMAND_QMLATTACHEDSIGNAL) ||
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index a3cdae6314..15386f196b 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -1428,14 +1428,19 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker)
QList<Section> sections;
QList<Section>::const_iterator s;
- QString htmlTitle = fake->fullTitle();
+ QString fullTitle = fake->fullTitle();
+ QString htmlTitle = fullTitle;
if (fake->subType() == Node::File && !fake->subTitle().isEmpty()) {
subTitleSize = SmallSubTitle;
htmlTitle += " (" + fake->subTitle() + ")";
}
+ else if (fake->subType() == Node::QmlBasicType) {
+ fullTitle = "QML Basic Type: " + fullTitle;
+ htmlTitle = fullTitle;
+ }
generateHeader(htmlTitle, fake, marker, true);
- generateTitle(fake->fullTitle(),
+ generateTitle(fullTitle,
Text() << fake->subTitle(),
subTitleSize,
fake,
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp
index 5796ea4eb8..4da916cbe5 100644
--- a/tools/qdoc3/node.cpp
+++ b/tools/qdoc3/node.cpp
@@ -85,6 +85,9 @@ void Node::setDoc(const Doc& doc, bool replace)
}
/*!
+ Construct a node with the given \a type and having the
+ given \a parent and \a name. The new node is added to the
+ parent's child list.
*/
Node::Node(Type type, InnerNode *parent, const QString& name)
: typ(type),
@@ -490,6 +493,8 @@ NodeList InnerNode::overloads(const QString &funcName) const
}
/*!
+ Construct an inner node (i.e., not a leaf node) of the
+ given \a type and having the given \a parent and \a name.
*/
InnerNode::InnerNode(Type type, InnerNode *parent, const QString& name)
: Node(type, parent, name)
@@ -547,6 +552,7 @@ bool InnerNode::isSameSignature(const FunctionNode *f1, const FunctionNode *f2)
}
/*!
+ Adds the \a child to this node's child list.
*/
void InnerNode::addChild(Node *child)
{
@@ -564,7 +570,9 @@ void InnerNode::addChild(Node *child)
else {
if (child->type() == Enum)
enumChildren.append(child);
- childMap.insert(child->name(), child);
+ if (childMap.contains(child->name()))
+ qDebug() << "Duplicate child" << child->name();
+ childMap.insert(child->name(), child);
}
}
@@ -1207,7 +1215,11 @@ bool TargetNode::isInnerNode() const
bool QmlClassNode::qmlOnly = false;
/*!
- Constructor for the Qml class node.
+ Constructs a Qml class node (i.e. a Fake node with the
+ subtype QmlClass. The new node has the given \a parent
+ and \a name and is associated with the C++ class node
+ specified by \a cn which may be null if the the Qml
+ class node is not associated with a C++ class node.
*/
QmlClassNode::QmlClassNode(InnerNode *parent,
const QString& name,
@@ -1234,6 +1246,18 @@ QString QmlClassNode::fileBase() const
}
/*!
+ Constructs a Qml basic type node (i.e. a Fake node with
+ the subtype QmlBasicType. The new node has the given
+ \a parent and \a name.
+ */
+QmlBasicTypeNode::QmlBasicTypeNode(InnerNode *parent,
+ const QString& name)
+ : FakeNode(parent, name, QmlBasicType)
+{
+ setTitle(name);
+}
+
+/*!
Constructor for the Qml property group node. \a parent is
always a QmlClassNode.
*/
diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h
index c77fbeba6c..077aeb8db2 100644
--- a/tools/qdoc3/node.h
+++ b/tools/qdoc3/node.h
@@ -96,7 +96,8 @@ class Node
#ifdef QDOC_QML
ExternalPage,
QmlClass,
- QmlPropertyGroup
+ QmlPropertyGroup,
+ QmlBasicType
#else
ExternalPage
#endif
@@ -373,6 +374,14 @@ class QmlClassNode : public FakeNode
const ClassNode* cnode;
};
+class QmlBasicTypeNode : public FakeNode
+{
+ public:
+ QmlBasicTypeNode(InnerNode *parent,
+ const QString& name);
+ virtual ~QmlBasicTypeNode() { }
+};
+
class QmlPropGroupNode : public FakeNode
{
public:
diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp
index a001c10212..07edcc46e3 100644
--- a/tools/qdoc3/pagegenerator.cpp
+++ b/tools/qdoc3/pagegenerator.cpp
@@ -104,7 +104,8 @@ QString PageGenerator::fileBase(const Node *node)
we prepend "qml-" to the file name of QML element doc
files.
*/
- if (p->subType() == Node::QmlClass) {
+ if ((p->subType() == Node::QmlClass) ||
+ (p->subType() == Node::QmlBasicType)) {
base.prepend("qml-");
}
#endif
@@ -209,6 +210,10 @@ void PageGenerator::generateInnerNode(const InnerNode *node,
if (fakeNode->subType() == Node::QmlPropertyGroup)
return;
#endif
+ if (fakeNode->subType() == Node::Page) {
+ if (node->count() > 0)
+ qDebug() << "PAGE" << fakeNode->title() << "HAS CHILDREN";
+ }
}
if (node->parent() != 0) {
diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp
index d46da95f2d..6c2502d39f 100644
--- a/tools/qdoc3/tree.cpp
+++ b/tools/qdoc3/tree.cpp
@@ -1914,7 +1914,8 @@ QString Tree::fullDocumentLocation(const Node *node) const
}
else if (node->type() == Node::Fake) {
#ifdef QDOC_QML
- if (node->subType() == Node::QmlClass)
+ if ((node->subType() == Node::QmlClass) ||
+ (node->subType() == Node::QmlBasicType))
return "qml-" + node->fileBase() + ".html";
else
#endif