diff options
Diffstat (limited to 'src/tools/qdoc/qdocindexfiles.cpp')
-rw-r--r-- | src/tools/qdoc/qdocindexfiles.cpp | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp index d68fe0e6fa..3f79675b3b 100644 --- a/src/tools/qdoc/qdocindexfiles.cpp +++ b/src/tools/qdoc/qdocindexfiles.cpp @@ -48,13 +48,7 @@ #include "location.h" #include "atom.h" #include "generator.h" - -//include "doc.h" -//include "htmlgenerator.h" -//include "node.h" -//include "text.h" -//include <limits.h> -//include <qdebug.h> +#include <qdebug.h> QT_BEGIN_NAMESPACE @@ -109,8 +103,11 @@ void QDocIndexFiles::destroyQDocIndexFiles() */ void QDocIndexFiles::readIndexes(const QStringList& indexFiles) { - foreach (const QString& indexFile, indexFiles) + foreach (const QString& indexFile, indexFiles) { + QString msg = "Loading index file: " + indexFile; + Location::logToStdErr(msg); readIndexFile(indexFile); + } } /*! @@ -438,11 +435,18 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, else section->setStatus(Node::Commendable); - section->setModuleName(element.attribute("module")); + QString moduleName = element.attribute("module"); + if (!moduleName.isEmpty()) + section->setModuleName(moduleName); if (!indexUrl.isEmpty()) { 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 @@ -502,7 +506,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; @@ -642,6 +646,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: { @@ -654,11 +662,13 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, baseStrings.insert(baseClassNode->name()); } writer.writeAttribute("bases", QStringList(baseStrings.toList()).join(",")); - writer.writeAttribute("module", node->moduleName()); + if (!node->moduleName().isEmpty()) + writer.writeAttribute("module", node->moduleName()); } break; case Node::Namespace: - writer.writeAttribute("module", node->moduleName()); + if (!node->moduleName().isEmpty()) + writer.writeAttribute("module", node->moduleName()); break; case Node::Document: { @@ -666,25 +676,30 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, Document nodes (such as manual pages) contain subtypes, titles and other attributes. */ + bool writeModuleName = false; const DocNode* docNode = static_cast<const DocNode*>(node); switch (docNode->subType()) { case Node::Example: writer.writeAttribute("subtype", "example"); + writeModuleName = true; break; case Node::HeaderFile: writer.writeAttribute("subtype", "header"); + writeModuleName = true; break; case Node::File: writer.writeAttribute("subtype", "file"); break; case Node::Group: writer.writeAttribute("subtype", "group"); + writeModuleName = true; break; case Node::Module: writer.writeAttribute("subtype", "module"); break; case Node::Page: writer.writeAttribute("subtype", "page"); + writeModuleName = true; break; case Node::ExternalPage: writer.writeAttribute("subtype", "externalpage"); @@ -702,6 +717,9 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, writer.writeAttribute("fulltitle", docNode->fullTitle()); writer.writeAttribute("subtitle", docNode->subTitle()); writer.writeAttribute("location", docNode->doc().location().fileName()); + if (!node->moduleName().isEmpty() && writeModuleName) { + writer.writeAttribute("module", node->moduleName()); + } } break; case Node::Function: @@ -1048,6 +1066,9 @@ void QDocIndexFiles::generateIndex(const QString& fileName, if (!file.open(QFile::WriteOnly | QFile::Text)) return; + QString msg = "Writing index file: " + fileName; + Location::logToStdErr(msg); + gen_ = g; QXmlStreamWriter writer(&file); writer.setAutoFormatting(true); |