qdoc: Fixed the since list for modularized Qt
authorMartin Smith <martin.smith@digia.com>
Fri, 2 Nov 2012 08:54:55 +0000 (09:54 +0100)
committerMartin Smith <martin.smith@digia.com>
Fri, 2 Nov 2012 11:41:43 +0000 (12:41 +0100)
This required adding a "since" attribute to the index file.

Task number: QTBUG-27695

Change-Id: I97ca96b837ce404ea85ca8086718be4e7a9e21a8
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
src/tools/qdoc/node.cpp
src/tools/qdoc/node.h
src/tools/qdoc/qdocdatabase.cpp
src/tools/qdoc/qdocindexfiles.cpp

index 67805d3..3828709 100644 (file)
@@ -462,7 +462,7 @@ void Node::setLink(LinkType linkType, const QString &link, const QString &desc)
 */
 void Node::setSince(const QString &since)
 {
-    sinc = since.simplified();
+    since_ = since.simplified();
 }
 
 /*!
index 451b666..05133ca 100644 (file)
@@ -222,7 +222,7 @@ public:
     Status inheritedStatus() const;
     ThreadSafeness threadSafeness() const;
     ThreadSafeness inheritedThreadSafeness() const;
-    QString since() const { return sinc; }
+    QString since() const { return since_; }
     QString templateStuff() const { return templateStuff_; }
     PageType pageType() const { return pageType_; }
     QString pageTypeString() const;
@@ -280,7 +280,7 @@ private:
     QMap<LinkType, QPair<QString, QString> > linkMap_;
     QString moduleName_;
     QString url_;
-    QString sinc;
+    QString since_;
     QString templateStuff_;
     mutable QString uuid_;
     QString outSubDir_;
index b6163aa..cb93a92 100644 (file)
@@ -467,12 +467,11 @@ void QDocDatabase::findAllSince(const InnerNode* node)
                     nsmap.value().insert(func->name(),(*child));
                 }
             }
-            else if ((*child)->url().isEmpty()) {
-                if ((*child)->type() == Node::Class && !(*child)->doc().isEmpty()) {
+            else {
+                if ((*child)->type() == Node::Class) {
                     // Insert classes into the since and class maps.
                     QString className = (*child)->name();
-                    if ((*child)->parent() && (*child)->parent()->type() == Node::Namespace &&
-                        !(*child)->parent()->name().isEmpty()) {
+                    if ((*child)->parent() && !(*child)->parent()->name().isEmpty()) {
                         className = (*child)->parent()->name()+"::"+className;
                     }
                     nsmap.value().insert(className,(*child));
@@ -481,8 +480,7 @@ void QDocDatabase::findAllSince(const InnerNode* node)
                 else if ((*child)->subType() == Node::QmlClass) {
                     // Insert QML elements into the since and element maps.
                     QString className = (*child)->name();
-                    if ((*child)->parent() && (*child)->parent()->type() == Node::Namespace &&
-                        !(*child)->parent()->name().isEmpty()) {
+                    if ((*child)->parent() && !(*child)->parent()->name().isEmpty()) {
                         className = (*child)->parent()->name()+"::"+className;
                     }
                     nsmap.value().insert(className,(*child));
@@ -493,17 +491,15 @@ void QDocDatabase::findAllSince(const InnerNode* node)
                     QString propertyName = (*child)->name();
                     nsmap.value().insert(propertyName,(*child));
                 }
-            }
-            else {
-                // Insert external documents into the general since map.
-                QString name = (*child)->name();
-                if ((*child)->parent() && (*child)->parent()->type() == Node::Namespace &&
-                    !(*child)->parent()->name().isEmpty()) {
-                    name = (*child)->parent()->name()+"::"+name;
+                else {
+                    // Insert external documents into the general since map.
+                    QString name = (*child)->name();
+                    if ((*child)->parent() && !(*child)->parent()->name().isEmpty()) {
+                        name = (*child)->parent()->name()+"::"+name;
+                    }
+                    nsmap.value().insert(name,(*child));
                 }
-                nsmap.value().insert(name,(*child));
             }
-
             // Recursively find child nodes with since commands.
             if ((*child)->isInnerNode()) {
                 findAllSince(static_cast<InnerNode *>(*child));
index 33b489d..14dfa33 100644 (file)
 #include "generator.h"
 #include <qdebug.h>
 
-//include "doc.h"
-//include "htmlgenerator.h"
-//include "node.h"
-//include "text.h"
-//include <limits.h>
-//include <qdebug.h>
-
 QT_BEGIN_NAMESPACE
 
 /*!
@@ -447,6 +440,11 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
         section->setUrl(indexUrl + QLatin1Char('/') + href);
     }
 
+    QString since = element.attribute("since");
+    if (!since.isEmpty()) {
+        section->setSince(since);
+    }
+
     // Create some content for the node.
     QSet<QString> emptySet;
     Doc doc(location, location, " ", emptySet); // placeholder
@@ -506,7 +504,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
                                           Node* node,
                                           bool generateInternalNodes)
 {
-    if (!node->url().isEmpty() || node->subType() == Node::DitaMap)
+    if (node->subType() == Node::DitaMap)
         return false;
 
     QString nodeName;
@@ -646,6 +644,10 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
     if ((node->type() != Node::Document) && (!node->isQmlNode()))
         writer.writeAttribute("location", node->location().fileName());
 
+    if (!node->since().isEmpty()) {
+        writer.writeAttribute("since", node->since());
+    }
+
     switch (node->type()) {
     case Node::Class:
         {