From 0909c01b2f5d3a466fe6094a501a2893170e2616 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 11 May 2012 13:18:52 +0200 Subject: [PATCH] qdoc: Fixed a regression bug caused by fixing error messages The C++ code marker is the default code marker. The default code marker was being called for .qdoc files. But when the tree nodes were each assigned a location object based on the location in the source file where the node was built, the default code marker was no longer used. Instead, the plain code marker was used. This was wrong. qdoc now knows to use the C++ code marker for all .qdoc files. Change-Id: I15a58168db74cc5aa82a1fbccc5b7ece219ec297 Reviewed-by: Casper van Donderen --- src/tools/qdoc/codemarker.cpp | 2 +- src/tools/qdoc/cppcodemarker.cpp | 1 + src/tools/qdoc/cppcodeparser.cpp | 11 ++++++----- src/tools/qdoc/ditaxmlgenerator.cpp | 29 +++++++++-------------------- src/tools/qdoc/node.cpp | 13 ++----------- 5 files changed, 19 insertions(+), 37 deletions(-) diff --git a/src/tools/qdoc/codemarker.cpp b/src/tools/qdoc/codemarker.cpp index fe0b366..00094a1 100644 --- a/src/tools/qdoc/codemarker.cpp +++ b/src/tools/qdoc/codemarker.cpp @@ -682,7 +682,7 @@ QList
CodeMarker::qmlSections(const QmlClassNode* , return QList
(); } -const Node* CodeMarker::resolveTarget(const QString& , +const Node* CodeMarker::resolveTarget(const QString& target, const Tree* , const Node* , const Node* ) diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp index 165a235..4e5a9eb 100644 --- a/src/tools/qdoc/cppcodemarker.cpp +++ b/src/tools/qdoc/cppcodemarker.cpp @@ -86,6 +86,7 @@ bool CppCodeMarker::recognizeExtension(const QString& extension) QByteArray ext = extension.toLatin1(); return ext == "c" || ext == "c++" || + ext == "qdoc" || ext == "cc" || ext == "cpp" || ext == "cxx" || diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp index b77d668..cf89bc0 100644 --- a/src/tools/qdoc/cppcodeparser.cpp +++ b/src/tools/qdoc/cppcodeparser.cpp @@ -2538,11 +2538,12 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake) exampleFiles += Config::getFilesHere(fullPath, "*.qrc *.pro *.qmlproject qmldir"); } - foreach (const QString &exampleFile, exampleFiles) - (void) new FakeNode(fake, - exampleFile.mid(sizeOfBoringPartOfName), - Node::File, - Node::NoPageType); + foreach (const QString &exampleFile, exampleFiles) { + FakeNode* fn = new FakeNode(fake, + exampleFile.mid(sizeOfBoringPartOfName), + Node::File, + Node::NoPageType); + } foreach (const QString &imageFile, imageFiles) { new FakeNode(fake, imageFile.mid(sizeOfBoringPartOfName), diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp index bed6e8a..7e55598 100644 --- a/src/tools/qdoc/ditaxmlgenerator.cpp +++ b/src/tools/qdoc/ditaxmlgenerator.cpp @@ -1327,16 +1327,12 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, { const Node *node = 0; QString myLink = getLink(atom, relative, marker, &node); - if (myLink.isEmpty()) { + if (myLink.isEmpty()) myLink = getCollisionLink(atom); - } - if (myLink.isEmpty()) { - relative->doc().location().warning(tr("Can't link to '%1'") - .arg(atom->string())); - } - else if (!inSectionHeading) { + if (myLink.isEmpty()) + relative->doc().location().warning(tr("Can't link to '%1'").arg(atom->string())); + else if (!inSectionHeading) beginLink(myLink); - } skipAhead = 1; } break; @@ -4237,25 +4233,20 @@ QString DitaXmlGenerator::getLink(const Atom* atom, } else { *node = marker->resolveTarget(first, tree_, relative); - if (!*node) { + if (!*node) *node = tree_->findFakeNodeByTitle(first, relative); - } - if (!*node) { + if (!*node) *node = tree_->findUnambiguousTarget(first, targetAtom, relative); - } } if (*node) { - if (!(*node)->url().isEmpty()) { + if (!(*node)->url().isEmpty()) return (*node)->url(); - } - else { + else path.removeFirst(); - } } - else { + else *node = relative; - } if (*node && (*node)->status() == Node::Obsolete) { if (relative && (relative->parent() != *node) && @@ -5747,7 +5738,6 @@ DitaXmlGenerator::generateInnerNode(InnerNode* node) Obtain a code marker for the source file. */ CodeMarker *marker = CodeMarker::markerForFileName(node->location().filePath()); - if (node->parent() != 0) { /* Skip name collision nodes here and process them @@ -5908,7 +5898,6 @@ Node* DitaXmlGenerator::collectNodesByTypeAndSubtype(const InnerNode* parent) nodeSubtypeMaps[Node::QmlModule]->insert(child->title(),child); break; case Node::Collision: - qDebug() << "FAKE NODE: Collision"; if (!isDuplicate(nodeSubtypeMaps[Node::Collision],child->title(),child)) nodeSubtypeMaps[Node::Collision]->insert(child->title(),child); break; diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp index f235753..51d7065 100644 --- a/src/tools/qdoc/node.cpp +++ b/src/tools/qdoc/node.cpp @@ -2029,7 +2029,7 @@ QmlClassNode::QmlClassNode(InnerNode *parent, { int i = 0; if (name.startsWith("QML:")) { - qDebug() << "BOGUS:" << name; + qDebug() << "BOGUS QML qualifier:" << name; i = 4; } setTitle(name.mid(i)); @@ -2040,9 +2040,7 @@ QmlClassNode::QmlClassNode(InnerNode *parent, */ QmlClassNode::~QmlClassNode() { -#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES - qDebug() << "Deleting QmlClassNode:" << name(); -#endif + // nothing. } /*! @@ -2094,9 +2092,6 @@ void QmlClassNode::addInheritedBy(const QString& base, Node* sub) if (inheritedBy.find(base,sub) == inheritedBy.end()) { inheritedBy.insert(base,sub); } -#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES - qDebug() << "QmlClassNode::addInheritedBy(): insert" << base << sub->name() << inheritedBy.size(); -#endif } /*! @@ -2107,10 +2102,6 @@ void QmlClassNode::subclasses(const QString& base, NodeList& subs) subs.clear(); if (inheritedBy.count(base) > 0) { subs = inheritedBy.values(base); -#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES - qDebug() << "QmlClassNode::subclasses():" << inheritedBy.count(base) << base - << "subs:" << subs.size() << "total size:" << inheritedBy.size(); -#endif } } -- 2.7.4