diff options
author | Janne Anttila <janne.anttila@digia.com> | 2009-09-30 13:01:05 (GMT) |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2009-09-30 13:01:05 (GMT) |
commit | c3ef2d3a6d9a6e35b05cbd8f370630d5dd85415e (patch) | |
tree | b11aaa1acca5ffe30cbfe2ce42a00d3597fa6c45 /tools | |
parent | af1e344ac6046640ddb728f6017b3181469c241d (diff) | |
parent | 1a902e6dba504b4a25a218555bb326772b5b77a6 (diff) | |
download | Qt-c3ef2d3a6d9a6e35b05cbd8f370630d5dd85415e.zip Qt-c3ef2d3a6d9a6e35b05cbd8f370630d5dd85415e.tar.gz Qt-c3ef2d3a6d9a6e35b05cbd8f370630d5dd85415e.tar.bz2 |
Merge branch '4.6' of git@scm.dev.troll.no:qt/qt into 4.6
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 132 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.h | 8 | ||||
-rw-r--r-- | tools/qdoc3/node.cpp | 17 | ||||
-rw-r--r-- | tools/qdoc3/node.h | 9 |
4 files changed, 137 insertions, 29 deletions
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 5406017..2757cd8 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -330,7 +330,65 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) #ifdef ZZZ_QDOC_QML findAllQmlClasses(tree->root()); #endif - findAllSince(tree->root(),tree->version()); + findAllSince(tree->root()); + +#if 0 + if (!sinceVersions.isEmpty()) { + SinceVersionMap::const_iterator v = sinceVersions.constEnd(); + do { + --v; + qDebug() << "SINCE:" << v.key(); + if (!v.value().isEmpty()) { + QString type; + SinceNodeMultiMap::const_iterator n = v.value().constBegin(); + while (n != v.value().constEnd()) { + switch (n.value()->type()) { + case Node::Namespace: + type = "namespace"; + break; + case Node::Class: + type = "class"; + break; + case Node::Fake: + type = "fake"; + break; + case Node::Enum: + type = "enum"; + break; + case Node::Typedef: + type = "typedef"; + break; + case Node::Function: + type = "function"; + break; + case Node::Property: + type = "property"; + break; + case Node::Variable: + type = "variable"; + break; + case Node::Target: + type = "target"; + break; + case Node::QmlProperty: + type = "QML property"; + break; + case Node::QmlSignal: + type = "QML signal"; + break; + case Node::QmlMethod: + type = "QML method"; + break; + default: + type = "No type"; + } + qDebug() << " " << type << n.key(); + ++n; + } + } + } while (v != sinceVersions.constBegin()); + } +#endif PageGenerator::generateTree(tree, marker); @@ -655,21 +713,32 @@ int HtmlGenerator::generateAtom(const Atom *atom, break; case Atom::SinceList: { - QList<Node*> values; - if (atom->string() == "classes") { - values = sinceClasses.values(); - } - else if (atom->string() == "functions") { - values = sinceFunctions.values(); - } - if (!values.isEmpty()) { - QMap<QString, const Node*> nodeMap; - for (int i=0; i<values.size(); ++i) { - const Node* n = values.at(i); - nodeMap.insert(n->nameForLists(),n); + QList<Node*> nodes; + SinceVersionMap::const_iterator v; + v = sinceVersions.find(atom->string()); + if ((v != sinceVersions.constEnd()) && !v.value().isEmpty()) { + for (int i=0; !Node::typeName(i).isEmpty(); i++) { + Node::Type t = (Node::Type) i; + SinceNodeMultiMap::const_iterator n=v.value().constBegin(); + QMultiMap<QString, const Node*> nodeMap; + while (n != v.value().constEnd()) { + const Node* node = n.value(); + if (node->type() == t) + nodeMap.insert(node->nameForLists(),node); + ++n; + } + if (!nodeMap.isEmpty()) { + out() << "<h2>" + << Node::typeName(i) + << " new in Qt " + << atom->string() + << "<h2>"; + generateAnnotatedList(relative, marker, nodeMap); + nodeMap.clear(); + } } - generateAnnotatedList(relative, marker, nodeMap); } + } break; case Atom::Image: @@ -3517,22 +3586,21 @@ void HtmlGenerator::findAllClasses(const InnerNode *node) /*! For generating the "Since x.y" page. */ -void HtmlGenerator::findAllSince(const InnerNode *node, QString version) +void HtmlGenerator::findAllSince(const InnerNode *node) { - const QRegExp versionSeparator("[\\-\\.]"); - const int minorIndex = version.indexOf(versionSeparator); - const int patchIndex = version.indexOf(versionSeparator, minorIndex+1); - version = version.left(patchIndex); - NodeList::const_iterator c = node->childNodes().constBegin(); while (c != node->childNodes().constEnd()) { - if (((*c)->access() != Node::Private) && ((*c)->since() == version)) { + QString sinceVersion = (*c)->since(); + if (((*c)->access() != Node::Private) && !sinceVersion.isEmpty()) { + SinceVersionMap::iterator vmap = sinceVersions.find(sinceVersion); + if (vmap == sinceVersions.end()) + vmap = sinceVersions.insert(sinceVersion,SinceNodeMultiMap()); if ((*c)->type() == Node::Function) { FunctionNode *func = static_cast<FunctionNode *>(*c); if ((func->status() > Node::Obsolete) && (func->metaness() != FunctionNode::Ctor) && (func->metaness() != FunctionNode::Dtor)) { - sinceFunctions.insert(func->name(), func); + vmap.value().insert(func->name(),(*c)); } } else if ((*c)->url().isEmpty()) { @@ -3542,17 +3610,33 @@ void HtmlGenerator::findAllSince(const InnerNode *node, QString version) (*c)->parent()->type() == Node::Namespace && !(*c)->parent()->name().isEmpty()) className = (*c)->parent()->name()+"::"+className; - sinceClasses.insert(className, *c); + vmap.value().insert(className,(*c)); } } + else { + QString name = (*c)->name(); + if ((*c)->parent() && + (*c)->parent()->type() == Node::Namespace && + !(*c)->parent()->name().isEmpty()) + name = (*c)->parent()->name()+"::"+name; + vmap.value().insert(name,(*c)); + qDebug() << "GOT HEAH" << name; + } if ((*c)->isInnerNode()) { - findAllSince(static_cast<InnerNode *>(*c),version); + findAllSince(static_cast<InnerNode *>(*c)); } } ++c; } } +#if 0 + const QRegExp versionSeparator("[\\-\\.]"); + const int minorIndex = version.indexOf(versionSeparator); + const int patchIndex = version.indexOf(versionSeparator, minorIndex+1); + version = version.left(patchIndex); +#endif + void HtmlGenerator::findAllFunctions(const InnerNode *node) { NodeList::ConstIterator c = node->childNodes().begin(); diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 24e2986..3f6e564 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -67,6 +67,9 @@ struct NavigationBar }; #endif +typedef QMultiMap<QString, Node*> SinceNodeMultiMap; +typedef QMap<QString, SinceNodeMultiMap> SinceVersionMap; + class HelpProjectWriter; class HtmlGenerator : public PageGenerator @@ -216,7 +219,7 @@ class HtmlGenerator : public PageGenerator #ifdef ZZZ_QDOC_QML void findAllQmlClasses(const InnerNode *node); #endif - void findAllSince(const InnerNode *node, QString version); + void findAllSince(const InnerNode *node); static int hOffset(const Node *node); static bool isThreeColumnEnumValueTable(const Atom *atom); virtual QString getLink(const Atom *atom, @@ -286,8 +289,7 @@ class HtmlGenerator : public PageGenerator #endif QMap<QString, QMap<QString, const Node *> > funcIndex; QMap<Text, const Node *> legaleseTexts; - QMap<QString, Node*> sinceClasses; - QMap<QString, Node*> sinceFunctions; + SinceVersionMap sinceVersions; }; #define HTMLGENERATOR_ADDRESS "address" diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index b44ede0..d547d20 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -48,6 +48,23 @@ QT_BEGIN_NAMESPACE +QString Node::typeNames[] = + { + "Namespaces", + "Classes", + "Fake", + "Enums", + "Typedefs", + "Functions and Macros", + "Properties", + "Variables", + "Targets", + "Qml Properties", + "Qml Signals", + "Qml Methods", + "" + }; + /*! \class Node \brief A node in a Tree. diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index fdef920..09f38d2 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -76,9 +76,11 @@ class Node Target, QmlProperty, QmlSignal, - QmlMethod + QmlMethod, + LastType #else - Target + Target, + LastType #endif }; @@ -173,10 +175,13 @@ class Node virtual QString fileBase() const; + static QString typeName(int i) { return typeNames[i]; } + protected: Node(Type type, InnerNode *parent, const QString& name); private: + static QString typeNames[]; #ifdef Q_WS_WIN Type typ; Access acc; |