diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/bootstrap/bootstrap.pri | 9 | ||||
-rw-r--r-- | src/tools/bootstrap/bootstrap.pro | 12 | ||||
-rw-r--r-- | src/tools/qdoc/codemarker.cpp | 16 | ||||
-rw-r--r-- | src/tools/qdoc/config.h | 1 | ||||
-rw-r--r-- | src/tools/qdoc/cppcodemarker.cpp | 36 | ||||
-rw-r--r-- | src/tools/qdoc/cppcodeparser.cpp | 5 | ||||
-rw-r--r-- | src/tools/qdoc/ditaxmlgenerator.cpp | 155 | ||||
-rw-r--r-- | src/tools/qdoc/ditaxmlgenerator.h | 4 | ||||
-rw-r--r-- | src/tools/qdoc/doc/config/qdoc-project.qdocconf | 4 | ||||
-rw-r--r-- | src/tools/qdoc/doc/config/qt-html-templates-online.qdocconf | 24 | ||||
-rw-r--r-- | src/tools/qdoc/doc/config/qt-html-templates.qdocconf | 34 | ||||
-rw-r--r-- | src/tools/qdoc/doc/qdoc-guide.qdoc | 2 | ||||
-rw-r--r-- | src/tools/qdoc/doc/qdoc-manual.qdoc | 14 | ||||
-rw-r--r-- | src/tools/qdoc/main.cpp | 23 | ||||
-rw-r--r-- | src/tools/qdoc/node.cpp | 5 | ||||
-rw-r--r-- | src/tools/qdoc/node.h | 14 | ||||
-rw-r--r-- | src/tools/qdoc/pagegenerator.cpp | 1 | ||||
-rw-r--r-- | src/tools/qdoc/qdoc.pro | 13 | ||||
-rw-r--r-- | src/tools/qdoc/quoter.cpp | 3 | ||||
-rw-r--r-- | src/tools/qdoc/tree.cpp | 3 | ||||
-rw-r--r-- | src/tools/uic/utils.h | 35 |
21 files changed, 216 insertions, 197 deletions
diff --git a/src/tools/bootstrap/bootstrap.pri b/src/tools/bootstrap/bootstrap.pri index e34cc5c033..228fcaca0d 100644 --- a/src/tools/bootstrap/bootstrap.pri +++ b/src/tools/bootstrap/bootstrap.pri @@ -29,18 +29,13 @@ win32:DEFINES += QT_NODLL INCLUDEPATH += $$QT_BUILD_TREE/include \ $$QT_BUILD_TREE/include/QtCore \ $$QT_BUILD_TREE/include/QtCore/$$QT.core.VERSION \ - $$QT_BUILD_TREE/include/QtCore/$$QT.core.VERSION/QtCore \ - $$QT_BUILD_TREE/include/QtXml \ - $$QT_BUILD_TREE/include/QtXml/$$QT.xml.VERSION \ - $$QT_BUILD_TREE/include/QtXml/$$QT.xml.VERSION/QtXml \ - $$QT_SOURCE_TREE/src/xml + $$QT_BUILD_TREE/include/QtCore/$$QT.core.VERSION/QtCore DEPENDPATH += $$INCLUDEPATH \ $$QT_SOURCE_TREE/src/corelib/global \ $$QT_SOURCE_TREE/src/corelib/kernel \ $$QT_SOURCE_TREE/src/corelib/tools \ $$QT_SOURCE_TREE/src/corelib/io \ - $$QT_SOURCE_TREE/src/corelib/codecs \ - $$QT_SOURCE_TREE/src/xml + $$QT_SOURCE_TREE/src/corelib/codecs hpux-acc*|hpuxi-acc* { LIBS += $$QT_BUILD_TREE/src/tools/bootstrap/libbootstrap.a diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 571bae7f24..9c34c758d7 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -32,10 +32,7 @@ win32:DEFINES += QT_NODLL INCLUDEPATH += $$QT_BUILD_TREE/include \ $$QT_BUILD_TREE/include/QtCore \ $$QT_BUILD_TREE/include/QtCore/$$QT.core.VERSION \ - $$QT_BUILD_TREE/include/QtCore/$$QT.core.VERSION/QtCore \ - $$QT_BUILD_TREE/include/QtXml \ - $$QT_BUILD_TREE/include/QtXml/$$QT.xml.VERSION \ - $$QT_BUILD_TREE/include/QtXml/$$QT.xml.VERSION/QtXml \ + $$QT_BUILD_TREE/include/QtCore/$$QT.core.VERSION/QtCore DEPENDPATH += $$INCLUDEPATH \ ../../corelib/global \ @@ -43,8 +40,7 @@ DEPENDPATH += $$INCLUDEPATH \ ../../corelib/tools \ ../../corelib/io \ ../../corelib/codecs \ - ../../corelib/json \ - ../../xml + ../../corelib/json SOURCES += \ ../../corelib/codecs/qlatincodec.cpp \ @@ -97,9 +93,7 @@ SOURCES += \ ../../corelib/json/qjsonarray.cpp \ ../../corelib/json/qjsonvalue.cpp \ ../../corelib/json/qjsonparser.cpp \ - ../../corelib/json/qjsonwriter.cpp \ - ../../xml/dom/qdom.cpp \ - ../../xml/sax/qxml.cpp + ../../corelib/json/qjsonwriter.cpp unix:SOURCES += ../../corelib/io/qfilesystemengine_unix.cpp \ ../../corelib/io/qfilesystemiterator_unix.cpp \ diff --git a/src/tools/qdoc/codemarker.cpp b/src/tools/qdoc/codemarker.cpp index 791e08062b..9f22a287d2 100644 --- a/src/tools/qdoc/codemarker.cpp +++ b/src/tools/qdoc/codemarker.cpp @@ -288,12 +288,17 @@ QString CodeMarker::taggedNode(const Node* node) } tag = QLatin1String("@property"); break; + case Node::QmlMethod: + case Node::QmlSignal: + case Node::QmlSignalHandler: + tag = QLatin1String("@function"); + break; default: tag = QLatin1String("@unknown"); break; } - return QLatin1Char('<') + tag + QLatin1Char('>') + protect(name) - + QLatin1String("</") + tag + QLatin1Char('>'); + return (QLatin1Char('<') + tag + QLatin1Char('>') + protect(name) + + QLatin1String("</") + tag + QLatin1Char('>')); } QString CodeMarker::taggedQmlNode(const Node* node) @@ -373,6 +378,13 @@ QString CodeMarker::sortName(const Node *node, const QString* name) if (node->type() == Node::Property || node->type() == Node::Variable) return QLatin1Char('E') + nodeName; + if ((node->type() == Node::QmlMethod) || + (node->type() == Node::QmlSignal) || + (node->type() == Node::QmlSignalHandler)) { + const FunctionNode* func = static_cast<const FunctionNode *>(node); + return QLatin1String("E") + func->signature(); + } + return QLatin1Char('B') + nodeName; } diff --git a/src/tools/qdoc/config.h b/src/tools/qdoc/config.h index 461e0b969c..6a89684e79 100644 --- a/src/tools/qdoc/config.h +++ b/src/tools/qdoc/config.h @@ -171,7 +171,6 @@ private: #define CONFIG_SHOWINTERNAL "showinternal" #define CONFIG_SOURCEDIRS "sourcedirs" #define CONFIG_SOURCEENCODING "sourceencoding" -#define CONFIG_SOURCEMODULES "sourcemodules" #define CONFIG_SOURCES "sources" #define CONFIG_SPURIOUS "spurious" #define CONFIG_STYLEDIRS "styledirs" diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp index cc68865cc0..3e7d190fe4 100644 --- a/src/tools/qdoc/cppcodemarker.cpp +++ b/src/tools/qdoc/cppcodemarker.cpp @@ -342,19 +342,47 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node, QString CppCodeMarker::markedUpQmlItem(const Node* node, bool summary) { QString name = taggedQmlNode(node); - if (summary) { + if (summary) name = linkTag(node,name); - } else if (node->type() == Node::QmlProperty) { + else if (node->type() == Node::QmlProperty) { const QmlPropertyNode* pn = static_cast<const QmlPropertyNode*>(node); if (pn->isAttached()) name.prepend(pn->element() + QLatin1Char('.')); } name = "<@name>" + name + "</@name>"; - QString synopsis = name; + QString synopsis; if (node->type() == Node::QmlProperty) { const QmlPropertyNode* pn = static_cast<const QmlPropertyNode*>(node); - synopsis += " : " + typified(pn->dataType()); + synopsis = name + " : " + typified(pn->dataType()); } + else if ((node->type() == Node::QmlMethod) || + (node->type() == Node::QmlSignal) || + (node->type() == Node::QmlSignalHandler)) { + const FunctionNode* func = static_cast<const FunctionNode*>(node); + if (!func->returnType().isEmpty()) + synopsis = typified(func->returnType()) + QLatin1Char(' ') + name; + else + synopsis = name; + synopsis += "("; + if (!func->parameters().isEmpty()) { + QList<Parameter>::ConstIterator p = func->parameters().begin(); + while (p != func->parameters().end()) { + if (p != func->parameters().begin()) + synopsis += ", "; + synopsis += typified((*p).leftType()); + if (!(*p).name().isEmpty()) { + if (!synopsis.endsWith("(")) + synopsis += " "; + synopsis += "<@param>" + protect((*p).name()) + "</@param>"; + } + synopsis += protect((*p).rightType()); + ++p; + } + } + synopsis += QLatin1Char(')'); + } + else + synopsis = name; QString extra; if (summary) { diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp index b83e617ee3..86e57a0372 100644 --- a/src/tools/qdoc/cppcodeparser.cpp +++ b/src/tools/qdoc/cppcodeparser.cpp @@ -207,7 +207,7 @@ void CppCodeParser::initializeParser(const Config &config) if (!exampleFilePatterns.isEmpty()) exampleNameFilter = exampleFilePatterns.join(" "); else - exampleNameFilter = "*.cpp *.h *.js *.xq *.svg *.xml *.ui"; + exampleNameFilter = "*.cpp *.h *.js *.xq *.svg *.xml *.dita *.ui"; QStringList exampleImagePatterns = config.getStringList( CONFIG_EXAMPLES + Config::dot + CONFIG_IMAGEEXTENSIONS); @@ -797,8 +797,9 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, return makeFunctionNode(doc,arg,qmlClass,Node::QmlSignal,false,COMMAND_QMLSIGNAL); else if (command == COMMAND_QMLATTACHEDSIGNAL) return makeFunctionNode(doc,arg,qmlClass,Node::QmlSignal,true,COMMAND_QMLATTACHEDSIGNAL); - else if (command == COMMAND_QMLMETHOD) + else if (command == COMMAND_QMLMETHOD) { return makeFunctionNode(doc,arg,qmlClass,Node::QmlMethod,false,COMMAND_QMLMETHOD); + } else if (command == COMMAND_QMLATTACHEDMETHOD) return makeFunctionNode(doc,arg,qmlClass,Node::QmlMethod,true,COMMAND_QMLATTACHEDMETHOD); else diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp index a4c5cbeea0..6b0c2dce88 100644 --- a/src/tools/qdoc/ditaxmlgenerator.cpp +++ b/src/tools/qdoc/ditaxmlgenerator.cpp @@ -297,14 +297,23 @@ void DitaXmlGenerator::writeStartTag(DitaTag t) /*! Pop the current DITA tag off the stack, and write the - appropriate end tag to the DITA XML file. + appropriate end tag to the DITA XML file. If \a t is + not \e DT_NONE (default), then \a t contains the enum + value of the tag that should be on top of the stack. + + If the stack is empty, no end tag is written and false + is returned. Otherwise, an end tag is written and true + is returned. */ -void DitaXmlGenerator::writeEndTag(DitaTag t) +bool DitaXmlGenerator::writeEndTag(DitaTag t) { + if (tagStack.isEmpty()) + return false; DitaTag top = tagStack.pop(); if (t > DT_NONE && top != t) qDebug() << "Expected:" << t << "ACTUAL:" << top; xmlWriter().writeEndElement(); + return true; } /*! @@ -2316,7 +2325,10 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode* fake, CodeMarker* marker } } leaveSection(); // </section> - writeEndTag(); // </body> + if (!writeEndTag()) { // </body> + fake->doc().location().warning(tr("Pop of empty XML tag stack; generating DITA for '%1'").arg(fake->name())); + return; + } writeRelatedLinks(fake, marker); writeEndTag(); // </topic> } @@ -2378,11 +2390,11 @@ void DitaXmlGenerator::writeRelatedLinks(const FakeNode* node, CodeMarker* marke } /*! - Returns "xml" for this subclass of class Generator. + Returns "dita" for this subclass of class Generator. */ QString DitaXmlGenerator::fileExtension(const Node * /* node */) const { - return "xml"; + return "dita"; } /*! @@ -3215,12 +3227,13 @@ void DitaXmlGenerator::generateQmlItem(const Node* node, } marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"), "<i>\\1<sub>\\2</sub></i>"); +#if 0 marked.replace("<@param>", "<i>"); marked.replace("</@param>", "</i>"); marked.replace("<@extra>", "<tt>"); marked.replace("</@extra>", "</tt>"); - +#endif if (summary) { marked.remove("<@type>"); marked.remove("</@type>"); @@ -3572,7 +3585,8 @@ void DitaXmlGenerator::writeText(const QString& markedCode, html.clear(); } writeStartTag(DT_i); - writeCharacters(" " + arg.toString()); + //writeCharacters(" " + arg.toString()); + writeCharacters(arg.toString()); writeEndTag(); // </i> } else if (k == 5) { // <@extra> @@ -4251,7 +4265,8 @@ QString DitaXmlGenerator::getLink(const Atom* atom, QString guid = lookupGuid(link,refForAtom(targetAtom,*node)); link += QLatin1Char('#') + guid; } - else if (!link.isEmpty() && *node && link.endsWith(".xml")) { + else if (!link.isEmpty() && *node && + (link.endsWith(".xml") || link.endsWith(".dita"))) { link += QLatin1Char('#') + (*node)->guid(); } } @@ -5653,7 +5668,8 @@ DitaXmlGenerator::generateInnerNode(const InnerNode* node) CodeMarker *marker = CodeMarker::markerForFileName(node->location().filePath()); if (node->parent() != 0) { - beginSubPage(node, fileName(node)); + if (!node->name().endsWith(".ditamap")) + beginSubPage(node, fileName(node)); if (node->type() == Node::Namespace || node->type() == Node::Class) { generateClassLikeNode(node, marker); } @@ -5665,7 +5681,8 @@ DitaXmlGenerator::generateInnerNode(const InnerNode* node) else generateFakeNode(static_cast<const FakeNode*>(node), marker); } - endSubPage(); + if (!node->name().endsWith(".ditamap")) + endSubPage(); } NodeList::ConstIterator c = node->childNodes().begin(); @@ -5705,6 +5722,9 @@ bool DitaXmlGenerator::isDuplicate(NodeMultiMap* nmm, const QString& key, Node* /*! Collect all the nodes in the tree according to their type or subtype. + If a node is found that is named index.html, return that node as the + root page node. + type: Class type: Namespace @@ -5718,159 +5738,117 @@ bool DitaXmlGenerator::isDuplicate(NodeMultiMap* nmm, const QString& key, Node* subtype: QML class subtype: QML module */ -void DitaXmlGenerator::collectNodesByTypeAndSubtype(const InnerNode* parent) +Node* DitaXmlGenerator::collectNodesByTypeAndSubtype(const InnerNode* parent) { - //qDebug() << "START"; + Node* rootPageNode = 0; const NodeList& children = parent->childNodes(); if (children.size() == 0) - return; + return rootPageNode; - bool related; QString message; for (int i=0; i<children.size(); ++i) { Node* child = children[i]; - if (!child || child->isInternal() || child->doc().isEmpty()) + if ((child->type() == Node::Fake) && (child->subType() == Node::Collision)) { + const FakeNode* fake = static_cast<const FakeNode*>(child); + Node* n = collectNodesByTypeAndSubtype(fake); + if (n) + rootPageNode = n; continue; - if (child->relates()) { - related = true; - message = child->relates()->name(); } - else { - related = false; - message = "has documentation but no \\relates command"; + if (!child || child->isInternal() || child->doc().isEmpty()) + continue; + + if (child->name() == "index.html") { + rootPageNode = child; } + switch (child->type()) { case Node::Namespace: - //qDebug() << "NODE: Namespace" << "TITLE:" << child->name() - // << "FILE:" << fileName(child); if (!isDuplicate(nodeTypeMaps[Node::Namespace],child->name(),child)) nodeTypeMaps[Node::Namespace]->insert(child->name(),child); break; case Node::Class: - //qDebug() << "NODE: Class" << "TITLE:" << child->name() - // << "FILE:" << fileName(child); if (!isDuplicate(nodeTypeMaps[Node::Class],child->name(),child)) nodeTypeMaps[Node::Class]->insert(child->name(),child); break; case Node::Fake: - //qDebug() << "NODE: Fake"; switch (child->subType()) { case Node::Example: - //qDebug() << "FAKE NODE: Example" << "TITLE:" << child->title() - // << "FILE:" << fileName(child); if (!isDuplicate(nodeSubtypeMaps[Node::Example],child->title(),child)) nodeSubtypeMaps[Node::Example]->insert(child->title(),child); break; case Node::HeaderFile: - //qDebug() << "FAKE NODE: Header file" << "TITLE:" << child->title() - // << "FILE:" << fileName(child); if (!isDuplicate(nodeSubtypeMaps[Node::HeaderFile],child->title(),child)) nodeSubtypeMaps[Node::HeaderFile]->insert(child->title(),child); break; case Node::File: - //qDebug() << "FAKE NODE: File"; break; case Node::Image: - //qDebug() << "FAKE NODE: Image"; break; case Node::Group: - //qDebug() << "FAKE NODE: Group" << "TITLE:" << child->title() - // << "FILE:" << fileName(child); if (!isDuplicate(nodeSubtypeMaps[Node::Group],child->title(),child)) nodeSubtypeMaps[Node::Group]->insert(child->title(),child); break; case Node::Module: - //qDebug() << "FAKE NODE: Module" << "TITLE:" << child->title() - // << "FILE:" << fileName(child); if (!isDuplicate(nodeSubtypeMaps[Node::Module],child->title(),child)) nodeSubtypeMaps[Node::Module]->insert(child->title(),child); break; case Node::Page: - //qDebug() << "FAKE NODE: Page" << "PAGE TYPE:" << child->pageTypeString() - // << "TITLE:" << child->title() - // << "FILE:" << fileName(child); if (!isDuplicate(pageTypeMaps[child->pageType()],child->title(),child)) pageTypeMaps[child->pageType()]->insert(child->title(),child); break; case Node::ExternalPage: - //qDebug() << "FAKE NODE: External page" << "TITLE:" << child->title() - // << "FILE:" << fileName(child); if (!isDuplicate(nodeSubtypeMaps[Node::ExternalPage],child->title(),child)) nodeSubtypeMaps[Node::ExternalPage]->insert(child->title(),child); break; case Node::QmlClass: - //qDebug() << "FAKE NODE: QML class" << "TITLE:" << child->title() << "FILE:" - // << fileName(child); if (!isDuplicate(nodeSubtypeMaps[Node::QmlClass],child->title(),child)) nodeSubtypeMaps[Node::QmlClass]->insert(child->title(),child); break; case Node::QmlPropertyGroup: - //qDebug() << "FAKE NODE: QML property group"; break; case Node::QmlBasicType: - //qDebug() << "FAKE NODE: QML basic type" << "TITLE:" << child->title() - // << "FILE:" << fileName(child); if (!isDuplicate(nodeSubtypeMaps[Node::QmlBasicType],child->title(),child)) nodeSubtypeMaps[Node::QmlBasicType]->insert(child->title(),child); break; case Node::QmlModule: - //qDebug() << "FAKE NODE: QML module" << "TITLE:" << child->title() - // << "FILE:" << fileName(child); if (!isDuplicate(nodeSubtypeMaps[Node::QmlModule],child->title(),child)) nodeSubtypeMaps[Node::QmlModule]->insert(child->title(),child); break; case Node::Collision: - //qDebug() << "FAKE NODE: Collision"; + qDebug() << "FAKE NODE: Collision"; + if (!isDuplicate(nodeSubtypeMaps[Node::Collision],child->title(),child)) + nodeSubtypeMaps[Node::Collision]->insert(child->title(),child); break; default: break; } break; case Node::Enum: - if (!related) - child->location().warning(tr("Global enum, %1, %2").arg(child->name()).arg(message)); break; case Node::Typedef: - if (!related) - child->location().warning(tr("Global typedef, %1, %2").arg(child->name()).arg(message)); break; case Node::Function: - if (!related) { - const FunctionNode* fn = static_cast<const FunctionNode*>(child); - if (fn->isMacro()) - child->location().warning(tr("Global macro, %1, %2").arg(child->name()).arg(message)); - else - child->location().warning(tr("Global function, %1(), %2").arg(child->name()).arg(message)); - } break; case Node::Property: break; case Node::Variable: - if (!related) - child->location().warning(tr("Global variable, %1, %2").arg(child->name()).arg(message)); break; case Node::Target: break; case Node::QmlProperty: - if (!related) - child->location().warning(tr("Global QML property, %1, %2").arg(child->name()).arg(message)); break; case Node::QmlSignal: - if (!related) - child->location().warning(tr("Global QML, signal, %1 %2").arg(child->name()).arg(message)); break; case Node::QmlSignalHandler: - if (!related) - child->location().warning(tr("Global QML signal handler, %1, %2").arg(child->name()).arg(message)); break; case Node::QmlMethod: - if (!related) - child->location().warning(tr("Global QML method, %1, %2").arg(child->name()).arg(message)); break; default: break; } } + return rootPageNode; } /*! @@ -5879,16 +5857,13 @@ void DitaXmlGenerator::collectNodesByTypeAndSubtype(const InnerNode* parent) */ void DitaXmlGenerator::writeDitaMap(const Tree *tree) { - beginSubPage(tree->root(),"qt.ditamap"); - QString doctype; - doctype = "<!DOCTYPE map PUBLIC \"-//OASIS//DTD DITA Map//EN\" \"map.dtd\">"; - // doctype = "<!DOCTYPE cxxAPIMap PUBLIC \"-//NOKIA//DTD DITA C++ API Map Reference Type v0.6.0//EN\" \"dtd/cxxAPIMap.dtd\">"; +#if 0 + beginSubPage(tree->root(),"qt.ditamap"); + doctype = "<!DOCTYPE map PUBLIC \"-//OASIS//DTD DITA Map//EN\" \"map.dtd\">"; xmlWriter().writeDTD(doctype); writeStartTag(DT_map); - //xmlWriter().writeAttribute("id","Qt-DITA-Map"); - //xmlWriter().writeAttribute("title","Qt DITA Map"); writeStartTag(DT_topicmeta); writeStartTag(DT_shortdesc); xmlWriter().writeCharacters("The top level map for the Qt documentation"); @@ -5903,6 +5878,7 @@ void DitaXmlGenerator::writeDitaMap(const Tree *tree) ++i; } endSubPage(); +#endif for (unsigned i=0; i<Node::LastType; ++i) nodeTypeMaps[i] = new NodeMultiMap; @@ -5910,22 +5886,9 @@ void DitaXmlGenerator::writeDitaMap(const Tree *tree) nodeSubtypeMaps[i] = new NodeMultiMap; for (unsigned i=0; i<Node::OnBeyondZebra; ++i) pageTypeMaps[i] = new NodeMultiMap; - collectNodesByTypeAndSubtype(tree->root()); -#if 0 - for (unsigned i=0; i<Node::LastType; ++i) { - if (nodeTypeMaps[i] && nodeTypeMaps[i]->size() > 0) - qDebug() << "NODE TYPE:" << Node::nodeTypeString(i) << nodeTypeMaps[i]->size(); - } - for (unsigned i=1; i<Node::LastSubtype; ++i) { - if (nodeSubtypeMaps[i] && nodeSubtypeMaps[i]->size() > 0) - qDebug() << "NODE SUBTYPE:" << Node::nodeSubtypeString(i) << nodeSubtypeMaps[i]->size(); - } - for (unsigned i=1; i<Node::OnBeyondZebra; ++i) { - if (pageTypeMaps[i] && pageTypeMaps[i]->size() > 0) - qDebug() << "PAGE TYPE:" << Node::pageTypeString(i) << pageTypeMaps[i]->size(); - } -#endif - beginSubPage(tree->root(),"test.ditamap"); + Node* rootPageNode = collectNodesByTypeAndSubtype(tree->root()); + + beginSubPage(tree->root(),"qt.ditamap"); doctype = "<!DOCTYPE map PUBLIC \"-//OASIS//DTD DITA Map//EN\" \"map.dtd\">"; xmlWriter().writeDTD(doctype); @@ -5936,6 +5899,11 @@ void DitaXmlGenerator::writeDitaMap(const Tree *tree) writeEndTag(); // </shortdesc> writeEndTag(); // </topicmeta> + writeStartTag(DT_topicref); + xmlWriter().writeAttribute("navtitle",project); + if (rootPageNode) + xmlWriter().writeAttribute("href",fileName(rootPageNode)); + writeTopicrefs(pageTypeMaps[Node::OverviewPage], "overviews"); writeTopicrefs(pageTypeMaps[Node::HowToPage], "howtos"); writeTopicrefs(pageTypeMaps[Node::TutorialPage], "tutorials"); @@ -5951,6 +5919,7 @@ void DitaXmlGenerator::writeDitaMap(const Tree *tree) writeTopicrefs(nodeSubtypeMaps[Node::QmlModule], "QML modules"); writeTopicrefs(nodeSubtypeMaps[Node::QmlBasicType], "QML basic types"); + writeEndTag(); // </topicref> endSubPage(); for (unsigned i=0; i<Node::LastType; ++i) @@ -5971,8 +5940,6 @@ void DitaXmlGenerator::writeDitaMap(const DitaMapNode* node) QString doctype; doctype = "<!DOCTYPE map PUBLIC \"-//OASIS//DTD DITA Map//EN\" \"map.dtd\">"; - // doctype = "<!DOCTYPE cxxAPIMap PUBLIC \"-//NOKIA//DTD DITA C++ API Map Reference Type v0.6.0//EN\" \"dtd/cxxAPIMap.dtd\">"; - xmlWriter().writeDTD(doctype); writeStartTag(DT_map); writeStartTag(DT_topicmeta); diff --git a/src/tools/qdoc/ditaxmlgenerator.h b/src/tools/qdoc/ditaxmlgenerator.h index ba96265b48..b3da02bce1 100644 --- a/src/tools/qdoc/ditaxmlgenerator.h +++ b/src/tools/qdoc/ditaxmlgenerator.h @@ -445,7 +445,7 @@ private: void writeDitaMap(const Tree* tree); void writeDitaMap(const DitaMapNode* node); void writeStartTag(DitaTag t); - void writeEndTag(DitaTag t=DT_NONE); + bool writeEndTag(DitaTag t=DT_NONE); DitaTag currentTag(); void clearSectionNesting() { sectionNestingLevel = 0; } int enterApiDesc(const QString& outputclass, const QString& title); @@ -455,7 +455,7 @@ private: int currentSectionNestingLevel() const { return sectionNestingLevel; } QString metadataDefault(DitaTag t) const; QString stripMarkup(const QString& src) const; - void collectNodesByTypeAndSubtype(const InnerNode* parent); + Node* collectNodesByTypeAndSubtype(const InnerNode* parent); void writeDitaRefs(const DitaRefList& ditarefs); void writeTopicrefs(NodeMultiMap* nmm, const QString& navtitle); bool isDuplicate(NodeMultiMap* nmm, const QString& key, Node* node); diff --git a/src/tools/qdoc/doc/config/qdoc-project.qdocconf b/src/tools/qdoc/doc/config/qdoc-project.qdocconf index d85058cd6a..2ac9107f38 100644 --- a/src/tools/qdoc/doc/config/qdoc-project.qdocconf +++ b/src/tools/qdoc/doc/config/qdoc-project.qdocconf @@ -28,8 +28,8 @@ exampledirs = .. \ imagedirs = ../../../doc/src/templates/images \ images -outputdir = $$MODULE_BUILD_TREE/tools/qdoc3/doc/html -tagfile = $$MODULE_BUILD_TREE/tools/qdoc3/doc/html/qdoc.tags +outputdir = $$MODULE_BUILD_TREE/tools/qdoc/doc/html +tagfile = $$MODULE_BUILD_TREE/tools/qdoc/doc/html/qdoc.tags qhp.projects = QDoc diff --git a/src/tools/qdoc/doc/config/qt-html-templates-online.qdocconf b/src/tools/qdoc/doc/config/qt-html-templates-online.qdocconf index af186f0568..f799fb3549 100644 --- a/src/tools/qdoc/doc/config/qt-html-templates-online.qdocconf +++ b/src/tools/qdoc/doc/config/qt-html-templates-online.qdocconf @@ -64,20 +64,22 @@ HTML.footer = \ " <div class=\"footer\">\n" \ " <p>\n" \ " <acronym title=\"Copyright\">©</acronym> 2012 Nokia Corporation and/or its\n" \ - " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ - " in Finland and/or other countries worldwide.</p>\n" \ - " <p>\n" \ - " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \ - " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ + " subsidiaries. Documentation contributions included herein are the copyrights of\n" \ + " their respective owners.</p>\n" \ " <br />\n" \ " <p>\n" \ - " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ - " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ - " with the terms contained in a written agreement between you and Nokia.</p>\n" \ + " The documentation provided herein is licensed under the terms of the\n" \ + " <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU Free Documentation\n" \ + " License version 1.3</a> as published by the Free Software Foundation.</p>\n" \ + " <p>\n" \ + " Documentation sources may be obtained from <a href=\"http://www.qt-project.org\">\n" \ + " www.qt-project.org</a>.</p>\n" \ + " <br />\n" \ " <p>\n" \ - " Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \ - " Free Documentation License version 1.3</a>\n" \ - " as published by the Free Software Foundation.</p>\n" \ + " Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide. All other trademarks are property\n" \ + " of their respective owners. <a title=\"Privacy Policy\"\n" \ + " href=\"http://en.gitorious.org/privacy_policy/\">Privacy Policy</a></p>\n" \ " </div>\n" diff --git a/src/tools/qdoc/doc/config/qt-html-templates.qdocconf b/src/tools/qdoc/doc/config/qt-html-templates.qdocconf index 2e15140945..5172c2fd51 100644 --- a/src/tools/qdoc/doc/config/qt-html-templates.qdocconf +++ b/src/tools/qdoc/doc/config/qt-html-templates.qdocconf @@ -22,22 +22,24 @@ HTML.footer = \ " </div>\n" \ "</div> \n" \ "<div class=\"footer\">\n" \ - " <p>\n" \ - " <acronym title=\"Copyright\">©</acronym> 2012 Nokia Corporation and/or its\n" \ - " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ - " in Finland and/or other countries worldwide.</p>\n" \ - " <p>\n" \ - " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \ - " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ - " <br />\n" \ - " <p>\n" \ - " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ - " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ - " with the terms contained in a written agreement between you and Nokia.</p>\n" \ - " <p>\n" \ - " Alternatively, this document may be used under the terms of the <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU\n" \ - " Free Documentation License version 1.3</a>\n" \ - " as published by the Free Software Foundation.</p>\n" \ + " <p>\n" \ + " <acronym title=\"Copyright\">©</acronym> 2012 Nokia Corporation and/or its\n" \ + " subsidiaries. Documentation contributions included herein are the copyrights of\n" \ + " their respective owners.</p>\n" \ + " <br />\n" \ + " <p>\n" \ + " The documentation provided herein is licensed under the terms of the\n" \ + " <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU Free Documentation\n" \ + " License version 1.3</a> as published by the Free Software Foundation.</p>\n" \ + " <p>\n" \ + " Documentation sources may be obtained from <a href=\"http://www.qt-project.org\">\n" \ + " www.qt-project.org</a>.</p>\n" \ + " <br />\n" \ + " <p>\n" \ + " Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide. All other trademarks are property\n" \ + " of their respective owners. <a title=\"Privacy Policy\"\n" \ + " href=\"http://en.gitorious.org/privacy_policy/\">Privacy Policy</a></p>\n" \ "</div>\n" \ # Files not referenced in any qdoc file. diff --git a/src/tools/qdoc/doc/qdoc-guide.qdoc b/src/tools/qdoc/doc/qdoc-guide.qdoc index c3b37822fb..33cc5c67fd 100644 --- a/src/tools/qdoc/doc/qdoc-guide.qdoc +++ b/src/tools/qdoc/doc/qdoc-guide.qdoc @@ -89,7 +89,7 @@ To run qdoc, the project configuration file is supplied as an argument. \code - qdoc3 project.qdocconf + qdoc project.qdocconf \endcode The project configuration contains information that qdoc uses to create the diff --git a/src/tools/qdoc/doc/qdoc-manual.qdoc b/src/tools/qdoc/doc/qdoc-manual.qdoc index 3e67579f2a..e6bdf5af27 100644 --- a/src/tools/qdoc/doc/qdoc-manual.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \page index.html + \page qdoc-index.html \nextpage Introduction to QDoc \title Table of Contents @@ -138,11 +138,11 @@ \section1 Running QDoc - The current name of the QDoc program is \c {qdoc3}. To run qdoc3 + The current name of the QDoc program is \c {qdoc}. To run qdoc from the command line, give it the name of a configuration file: \quotation - \c {$ ../../bin/qdoc3 ./config.qdocconf} + \c {$ ../../bin/qdoc ./config.qdocconf} \endquotation QDoc recognizes the \c {.qdocconf} suffix as a \l{The QDoc @@ -2907,7 +2907,7 @@ \li Tutorial and Examples \endlist - \warning There appears to be a bug in qdoc3 here. If you include + \warning There appears to be a bug in qdoc here. If you include any of the argument types, you get a numeric list. We're looking into it. @@ -7062,7 +7062,7 @@ QDoc on the command line: \quotation - \c {/current/dir$ ../../bin/qdoc3 ./config.qdocconf} + \c {/current/dir$ ../../bin/qdoc ./config.qdocconf} \endquotation \section1 General Description @@ -7307,7 +7307,7 @@ looking for \e qt5. For example, this file would be: \code - ~/depot/qt5/qtdoc/tools/qdoc3/doc/qdoc-manual.qdoc + ~/depot/qt5/qtdoc/tools/qdoc/doc/qdoc-manual.qdoc \endcode QDoc scans the path for the basedir \e{qt5} and the next subdirectory @@ -7365,7 +7365,7 @@ line using the -D option. For example: \code - currentdirectory$ qdoc3 -Dconsoleedition qt.qdocconf + currentdirectory$ qdoc -Dconsoleedition qt.qdocconf \endcode In this case the -D option ensures that the \c consoleedition diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp index 11a54b4d38..85e97cdec9 100644 --- a/src/tools/qdoc/main.cpp +++ b/src/tools/qdoc/main.cpp @@ -76,6 +76,7 @@ QT_BEGIN_NAMESPACE /* The default indent for code is 4. The default value for false is 0. + The default supported file extensions are cpp, h, qdoc and qml. The default language is c++. The default output format is html. The default tab size is 8. @@ -87,6 +88,7 @@ static const struct { } defaults[] = { { CONFIG_CODEINDENT, "4" }, { CONFIG_FALSEHOODS, "0" }, + { CONFIG_FILEEXTENSIONS, "*.cpp *.h *.qdoc *.qml"}, { CONFIG_LANGUAGE, "Cpp" }, { CONFIG_OUTPUTFORMATS, "HTML" }, { CONFIG_TABSIZE, "8" }, @@ -173,27 +175,6 @@ static void processQdocconfFile(const QString &fileName) Location::initialize(config); config.load(fileName); - QStringList sourceModules; - sourceModules = config.getStringList(CONFIG_SOURCEMODULES); - Location sourceModulesLocation = config.lastLocation(); - - if (!sourceModules.isEmpty()) { - Location::information(tr("qdoc will generate documentation for the modules found in the sourcemodules variable.")); - foreach (const QString& sourceModule, sourceModules) { - QString qdocconf = sourceModule; - if (!qdocconf.endsWith(".qdocconf")) - qdocconf += "/doc/config/module.qdocconf"; - QFile f(qdocconf); - if (!f.exists()) { - sourceModulesLocation.warning(tr("Can't find module's qdoc config file '%1'").arg(qdocconf)); - } - else { - Location::information(tr(" Including: %1").arg(qdocconf)); - config.load(qdocconf); - } - } - } - /* Add the defines to the configuration variables. */ diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp index 13c51c721d..e4350f1d9e 100644 --- a/src/tools/qdoc/node.cpp +++ b/src/tools/qdoc/node.cpp @@ -98,6 +98,7 @@ Node::Node(Type type, InnerNode *parent, const QString& name) safeness_(UnspecifiedSafeness), pageType_(NoPageType), status_(Commendable), + indexNodeFlag_(false), parent_(parent), relatesTo_(0), name_(name) @@ -513,8 +514,8 @@ QString Node::ditaXmlHref() else { href = fileBase(); } - if (!href.endsWith(".xml")) - href += ".xml"; + if (!href.endsWith(".xml") && !href.endsWith(".dita")) + href += ".dita"; return href + QLatin1Char('#') + guid(); } diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h index 440b22dc04..8c6eb673cd 100644 --- a/src/tools/qdoc/node.h +++ b/src/tools/qdoc/node.h @@ -173,6 +173,8 @@ public: void setPageType(PageType t) { pageType_ = t; } void setPageType(const QString& t); void setParent(InnerNode* n) { parent_ = n; } + void setIndexNodeFlag() { indexNodeFlag_ = true; } + virtual void setOutputFileName(const QString& ) { } virtual bool isInnerNode() const = 0; virtual bool isReimp() const { return false; } @@ -183,6 +185,7 @@ public: virtual bool isAbstract() const { return false; } virtual void setAbstract(bool ) { } virtual QString title() const { return QString(); } + bool isIndexNode() const { return indexNodeFlag_; } Type type() const { return nodeType_; } virtual SubType subType() const { return NoSubType; } InnerNode* parent() const { return parent_; } @@ -192,6 +195,7 @@ public: QString moduleName() const; QString url() const; virtual QString nameForLists() const { return name_; } + virtual QString outputFileName() const { return QString(); } Access access() const { return access_; } QString accessString() const; @@ -240,13 +244,16 @@ protected: private: -#ifdef Q_WS_WIN Type nodeType_; Access access_; ThreadSafeness safeness_; PageType pageType_; Status status_; -#else + bool indexNodeFlag_; + +#if 0 + //ifdef Q_WS_WIN + //else Type nodeType_ : 4; Access access_ : 2; ThreadSafeness safeness_ : 2; @@ -319,6 +326,8 @@ public: virtual void addPageKeywords(const QString& t) { pageKeywds << t; } virtual void setCurrentChild() { } virtual void setCurrentChild(InnerNode* ) { } + virtual void setOutputFileName(const QString& f) { outputFileName_ = f; } + virtual QString outputFileName() const { return outputFileName_; } protected: InnerNode(Type type, InnerNode* parent, const QString& name); @@ -332,6 +341,7 @@ private: void removeRelated(Node* pseudoChild); void removeChild(Node* child); + QString outputFileName_; QStringList pageKeywds; QStringList inc; NodeList children; diff --git a/src/tools/qdoc/pagegenerator.cpp b/src/tools/qdoc/pagegenerator.cpp index d8c3babe2e..6a52b7755a 100644 --- a/src/tools/qdoc/pagegenerator.cpp +++ b/src/tools/qdoc/pagegenerator.cpp @@ -298,6 +298,7 @@ void PageGenerator::beginSubPage(const InnerNode* node, const QString& fileName) if (outputCodec) out->setCodec(outputCodec); outStreamStack.push(out); + const_cast<InnerNode*>(node)->setOutputFileName(fileName); } /*! diff --git a/src/tools/qdoc/qdoc.pro b/src/tools/qdoc/qdoc.pro index fca5a3daf4..03de9f91df 100644 --- a/src/tools/qdoc/qdoc.pro +++ b/src/tools/qdoc/qdoc.pro @@ -9,9 +9,14 @@ DEFINES -= QT_NO_CAST_FROM_ASCII DEFINES += QT_NO_TRANSLATION INCLUDEPATH += $$QT_SOURCE_TREE/src/tools/qdoc \ - $$QT_SOURCE_TREE/src/tools/qdoc/qmlparser + $$QT_SOURCE_TREE/src/tools/qdoc/qmlparser \ + $$QT_BUILD_TREE/include/QtXml \ + $$QT_BUILD_TREE/include/QtXml/$$QT.xml.VERSION \ + $$QT_BUILD_TREE/include/QtXml/$$QT.xml.VERSION/QtXml + DEPENDPATH += $$QT_SOURCE_TREE/src/tools/qdoc \ - $$QT_SOURCE_TREE/src/tools/qdoc/qmlparser + $$QT_SOURCE_TREE/src/tools/qdoc/qmlparser \ + $$QT_SOURCE_TREE/src/xml # Increase the stack size on MSVC to 4M to avoid a stack overflow win32-msvc*:{ @@ -68,7 +73,9 @@ SOURCES += atom.cpp \ text.cpp \ tokenizer.cpp \ tree.cpp \ - yyindent.cpp + yyindent.cpp \ + ../../xml/dom/qdom.cpp \ + ../../xml/sax/qxml.cpp ### QML/JS Parser ### diff --git a/src/tools/qdoc/quoter.cpp b/src/tools/qdoc/quoter.cpp index 0c16acbe73..9ae2a31236 100644 --- a/src/tools/qdoc/quoter.cpp +++ b/src/tools/qdoc/quoter.cpp @@ -125,7 +125,7 @@ Quoter::Quoter() //! [<id>] * .pro, .py files: #! [<id>] - * .html, .qrc, .ui, .xq, .xml files: + * .html, .qrc, .ui, .xq, .xml .dita files: <!-- [<id>] --> */ commentHash["pro"] = "#!"; @@ -134,6 +134,7 @@ Quoter::Quoter() commentHash["qrc"] = "<!--"; commentHash["ui"] = "<!--"; commentHash["xml"] = "<!--"; + commentHash["dita"] = "<!--"; commentHash["xq"] = "<!--"; } diff --git a/src/tools/qdoc/tree.cpp b/src/tools/qdoc/tree.cpp index c52e45739a..4b2a8ba55c 100644 --- a/src/tools/qdoc/tree.cpp +++ b/src/tools/qdoc/tree.cpp @@ -1050,6 +1050,8 @@ void Tree::readIndexFile(const QString& path) } /*! + Read a <section> element from the index file and create the + appropriate node(s). */ void Tree::readIndexSection(const QDomElement& element, InnerNode* parent, @@ -1364,6 +1366,7 @@ void Tree::readIndexSection(const QDomElement& element, Doc doc(location, location, " ", emptySet); // placeholder section->setDoc(doc); + section->setIndexNodeFlag(); if (section->isInnerNode()) { InnerNode* inner = static_cast<InnerNode*>(section); diff --git a/src/tools/uic/utils.h b/src/tools/uic/utils.h index c6dbe548cb..b2214d9c38 100644 --- a/src/tools/uic/utils.h +++ b/src/tools/uic/utils.h @@ -55,21 +55,27 @@ inline bool toBool(const QString &str) inline QString toString(const DomString *str) { return str ? str->text() : QString(); } -inline QString fixString(const QString &str, const QString &indent, bool *isUtf8Ret=0) +enum StringFlags { + Utf8String = 0x1, + MultiLineString = 0x2 +}; + +inline QString fixString(const QString &str, const QString &indent, + unsigned *stringFlags = 0) { QString cursegment; QStringList result; const QByteArray utf8 = str.toUtf8(); const int utf8Length = utf8.length(); - bool isUtf8 = false; + unsigned flags = 0; for (int i = 0; i < utf8Length; ++i) { const uchar cbyte = utf8.at(i); if (cbyte >= 0x80) { cursegment += QLatin1Char('\\'); cursegment += QString::number(cbyte, 8); - isUtf8 = true; + flags |= Utf8String; } else { switch(cbyte) { case '\\': @@ -79,6 +85,7 @@ inline QString fixString(const QString &str, const QString &indent, bool *isUtf8 case '\r': break; case '\n': + flags |= MultiLineString; cursegment += QLatin1String("\\n\"\n\""); break; default: cursegment += QLatin1Char(cbyte); @@ -103,19 +110,27 @@ inline QString fixString(const QString &str, const QString &indent, bool *isUtf8 QString rc(QLatin1Char('"')); rc += result.join(joinstr); rc += QLatin1Char('"'); - if (isUtf8Ret) - *isUtf8Ret = isUtf8; + + if (result.size() > 1) + flags |= MultiLineString; + + if (stringFlags) + *stringFlags = flags; + return rc; } inline QString writeString(const QString &s, const QString &indent) { - bool isUtf8 = false; - const QString ret = fixString(s, indent, &isUtf8); - if (isUtf8) + unsigned flags = 0; + const QString ret = fixString(s, indent, &flags); + if (flags & Utf8String) return QLatin1String("QString::fromUtf8(") + ret + QLatin1Char(')'); - else - return QLatin1String("QStringLiteral(") + ret + QLatin1Char(')'); + // MSVC cannot concat L"foo" "bar" (C2308: concatenating mismatched strings), + // use QLatin1String instead (all platforms to avoid cross-compiling issues). + if (flags & MultiLineString) + return QLatin1String("QLatin1String(") + ret + QLatin1Char(')'); + return QLatin1String("QStringLiteral(") + ret + QLatin1Char(')'); } inline QHash<QString, DomProperty *> propertyMap(const QList<DomProperty *> &properties) |