147 if (node == 0 || !node->isInnerNode()) |
149 if (node == 0 || !node->isInnerNode()) |
148 break; |
150 break; |
149 |
151 |
150 const Node *next = |
152 const Node *next = |
151 static_cast<const InnerNode*>(node)->findNode(path.at(i)); |
153 static_cast<const InnerNode*>(node)->findNode(path.at(i)); |
|
154 |
152 if (!next && (findFlags & SearchEnumValues) && i == path.size()-1) |
155 if (!next && (findFlags & SearchEnumValues) && i == path.size()-1) |
153 next = static_cast<const InnerNode*>(node)->findEnumNodeForValue(path.at(i)); |
156 next = static_cast<const InnerNode*>(node)->findEnumNodeForValue(path.at(i)); |
154 |
157 |
155 if (!next && node->type() == Node::Class && (findFlags & SearchBaseClasses)) { |
158 if (!next && node->type() == Node::Class && (findFlags & SearchBaseClasses)) { |
156 NodeList baseClasses = allBaseClasses(static_cast<const ClassNode *>(node)); |
159 NodeList baseClasses = allBaseClasses(static_cast<const ClassNode *>(node)); |
1205 writer.writeAttribute("name", objName); |
1217 writer.writeAttribute("name", objName); |
1206 QString fullName = fullDocumentName(node); |
1218 QString fullName = fullDocumentName(node); |
1207 if (fullName != objName) |
1219 if (fullName != objName) |
1208 writer.writeAttribute("fullname", fullName); |
1220 writer.writeAttribute("fullname", fullName); |
1209 writer.writeAttribute("href", fullDocumentLocation(node)); |
1221 writer.writeAttribute("href", fullDocumentLocation(node)); |
1210 if (node->type() != Node::Fake) |
1222 if ((node->type() != Node::Fake) && (!node->isQmlNode())) |
1211 writer.writeAttribute("location", node->location().fileName()); |
1223 writer.writeAttribute("location", node->location().fileName()); |
1212 |
1224 |
1213 switch (node->type()) { |
1225 switch (node->type()) { |
1214 |
1226 |
1215 case Node::Class: |
1227 case Node::Class: |
1259 case Node::Page: |
1271 case Node::Page: |
1260 writer.writeAttribute("subtype", "page"); |
1272 writer.writeAttribute("subtype", "page"); |
1261 break; |
1273 break; |
1262 case Node::ExternalPage: |
1274 case Node::ExternalPage: |
1263 writer.writeAttribute("subtype", "externalpage"); |
1275 writer.writeAttribute("subtype", "externalpage"); |
|
1276 break; |
|
1277 case Node::QmlClass: |
|
1278 writer.writeAttribute("subtype", "qmlclass"); |
|
1279 break; |
|
1280 case Node::QmlBasicType: |
|
1281 writer.writeAttribute("subtype", "qmlbasictype"); |
1264 break; |
1282 break; |
1265 default: |
1283 default: |
1266 break; |
1284 break; |
1267 } |
1285 } |
1268 writer.writeAttribute("title", fakeNode->title()); |
1286 writer.writeAttribute("title", fakeNode->title()); |
1332 writer.writeAttribute("associated-property", propertyNode->name()); |
1350 writer.writeAttribute("associated-property", propertyNode->name()); |
1333 writer.writeAttribute("type", functionNode->returnType()); |
1351 writer.writeAttribute("type", functionNode->returnType()); |
1334 } |
1352 } |
1335 break; |
1353 break; |
1336 |
1354 |
|
1355 case Node::QmlProperty: |
|
1356 { |
|
1357 const QmlPropertyNode *qpn = static_cast<const QmlPropertyNode*>(node); |
|
1358 writer.writeAttribute("type", qpn->dataType()); |
|
1359 } |
|
1360 break; |
1337 case Node::Property: |
1361 case Node::Property: |
1338 { |
1362 { |
1339 const PropertyNode *propertyNode = static_cast<const PropertyNode*>(node); |
1363 const PropertyNode *propertyNode = static_cast<const PropertyNode*>(node); |
1340 writer.writeAttribute("type", propertyNode->dataType()); |
1364 writer.writeAttribute("type", propertyNode->dataType()); |
1341 foreach (const Node *fnNode, propertyNode->getters()) { |
1365 foreach (const Node *fnNode, propertyNode->getters()) { |
1519 if (generateIndexSection(writer, node, generateInternalNodes)) { |
1543 if (generateIndexSection(writer, node, generateInternalNodes)) { |
1520 |
1544 |
1521 if (node->isInnerNode()) { |
1545 if (node->isInnerNode()) { |
1522 const InnerNode *inner = static_cast<const InnerNode *>(node); |
1546 const InnerNode *inner = static_cast<const InnerNode *>(node); |
1523 |
1547 |
1524 // Recurse to write an element for this child node and all its children. |
1548 foreach (const Node *child, inner->childNodes()) { |
1525 foreach (const Node *child, inner->childNodes()) |
1549 /* |
1526 generateIndexSections(writer, child, generateInternalNodes); |
1550 Don't generate anything for a QML property group node. |
|
1551 It is just a place holder for a collection of QML property |
|
1552 nodes. Recurse to its children, which are the QML property |
|
1553 nodes. |
|
1554 */ |
|
1555 if (child->subType() == Node::QmlPropertyGroup) { |
|
1556 const InnerNode *pgn = static_cast<const InnerNode*>(child); |
|
1557 foreach (const Node *c, pgn->childNodes()) { |
|
1558 generateIndexSections(writer, c, generateInternalNodes); |
|
1559 } |
|
1560 } |
|
1561 else |
|
1562 generateIndexSections(writer, child, generateInternalNodes); |
|
1563 } |
1527 |
1564 |
1528 /* |
1565 /* |
1529 foreach (const Node *child, inner->relatedNodes()) { |
1566 foreach (const Node *child, inner->relatedNodes()) { |
1530 QDomElement childElement = generateIndexSections(document, child); |
1567 QDomElement childElement = generateIndexSections(document, child); |
1531 element.appendChild(childElement); |
1568 element.appendChild(childElement); |
1925 |
1963 |
1926 Node *parentNode = 0; |
1964 Node *parentNode = 0; |
1927 |
1965 |
1928 if ((parentNode = node->relates())) |
1966 if ((parentNode = node->relates())) |
1929 parentName = fullDocumentLocation(node->relates()); |
1967 parentName = fullDocumentLocation(node->relates()); |
1930 else if ((parentNode = node->parent())) |
1968 else if ((parentNode = node->parent())) { |
1931 parentName = fullDocumentLocation(node->parent()); |
1969 if (parentNode->subType() == Node::QmlPropertyGroup) { |
1932 |
1970 parentNode = parentNode->parent(); |
|
1971 parentName = "qml-" + parentNode->fileBase() + ".html"; |
|
1972 } |
|
1973 else |
|
1974 parentName = fullDocumentLocation(node->parent()); |
|
1975 } |
|
1976 #if 0 |
|
1977 if (node->type() == Node::QmlProperty) { |
|
1978 qDebug() << "Node::QmlProperty:" << node->name() |
|
1979 << "parentName:" << parentName; |
|
1980 if (parentNode) |
|
1981 qDebug() << "PARENT NODE" << parentNode->type() |
|
1982 << parentNode->subType() << parentNode->name(); |
|
1983 } |
|
1984 #endif |
1933 switch (node->type()) { |
1985 switch (node->type()) { |
1934 case Node::Class: |
1986 case Node::Class: |
1935 case Node::Namespace: |
1987 case Node::Namespace: |
1936 if (parentNode && !parentNode->name().isEmpty()) |
1988 if (parentNode && !parentNode->name().isEmpty()) |
1937 parentName = parentName.replace(".html", "") + "-" |
1989 parentName = parentName.replace(".html", "") + "-" |
1973 case Node::Typedef: |
2025 case Node::Typedef: |
1974 anchorRef = "#" + node->name() + "-typedef"; |
2026 anchorRef = "#" + node->name() + "-typedef"; |
1975 break; |
2027 break; |
1976 case Node::Property: |
2028 case Node::Property: |
1977 anchorRef = "#" + node->name() + "-prop"; |
2029 anchorRef = "#" + node->name() + "-prop"; |
|
2030 break; |
|
2031 case Node::QmlProperty: |
|
2032 anchorRef = "#" + node->name() + "-prop"; |
|
2033 break; |
|
2034 case Node::QmlSignal: |
|
2035 anchorRef = "#" + node->name() + "-signal"; |
|
2036 break; |
|
2037 case Node::QmlMethod: |
|
2038 anchorRef = "#" + node->name() + "-method"; |
1978 break; |
2039 break; |
1979 case Node::Variable: |
2040 case Node::Variable: |
1980 anchorRef = "#" + node->name() + "-var"; |
2041 anchorRef = "#" + node->name() + "-var"; |
1981 break; |
2042 break; |
1982 case Node::Target: |
2043 case Node::Target: |
2013 |
2074 |
2014 return parentName.toLower() + anchorRef; |
2075 return parentName.toLower() + anchorRef; |
2015 } |
2076 } |
2016 |
2077 |
2017 /*! |
2078 /*! |
|
2079 Construct the full document name for \a node and return the |
|
2080 name. |
2018 */ |
2081 */ |
2019 QString Tree::fullDocumentName(const Node *node) const |
2082 QString Tree::fullDocumentName(const Node *node) const |
2020 { |
2083 { |
2021 if (!node) |
2084 if (!node) |
2022 return ""; |
2085 return ""; |
2023 |
2086 |
2024 QStringList pieces; |
2087 QStringList pieces; |
2025 const Node *n = node; |
2088 const Node *n = node; |
2026 |
2089 |
2027 do { |
2090 do { |
2028 if (!n->name().isEmpty()) |
2091 if (!n->name().isEmpty() && |
|
2092 ((n->type() != Node::Fake) || (n->subType() != Node::QmlPropertyGroup))) |
2029 pieces.insert(0, n->name()); |
2093 pieces.insert(0, n->name()); |
2030 |
2094 |
2031 if (n->type() == Node::Fake) |
2095 if ((n->type() == Node::Fake) && (n->subType() != Node::QmlPropertyGroup)) |
2032 break; |
2096 break; |
2033 |
2097 |
2034 // Examine the parent node if one exists. |
2098 // Examine the parent node if one exists. |
2035 if (n->parent()) |
2099 if (n->parent()) |
2036 n = n->parent(); |
2100 n = n->parent(); |