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 <casper.vandonderen@nokia.com>
This commit is contained in:
Martin Smith 2012-05-11 13:18:52 +02:00 committed by Qt by Nokia
parent 417fc1f759
commit 0909c01b2f
5 changed files with 19 additions and 37 deletions

View File

@ -682,7 +682,7 @@ QList<Section> CodeMarker::qmlSections(const QmlClassNode* ,
return QList<Section>(); return QList<Section>();
} }
const Node* CodeMarker::resolveTarget(const QString& , const Node* CodeMarker::resolveTarget(const QString& target,
const Tree* , const Tree* ,
const Node* , const Node* ,
const Node* ) const Node* )

View File

@ -86,6 +86,7 @@ bool CppCodeMarker::recognizeExtension(const QString& extension)
QByteArray ext = extension.toLatin1(); QByteArray ext = extension.toLatin1();
return ext == "c" || return ext == "c" ||
ext == "c++" || ext == "c++" ||
ext == "qdoc" ||
ext == "cc" || ext == "cc" ||
ext == "cpp" || ext == "cpp" ||
ext == "cxx" || ext == "cxx" ||

View File

@ -2538,11 +2538,12 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake)
exampleFiles += Config::getFilesHere(fullPath, "*.qrc *.pro *.qmlproject qmldir"); exampleFiles += Config::getFilesHere(fullPath, "*.qrc *.pro *.qmlproject qmldir");
} }
foreach (const QString &exampleFile, exampleFiles) foreach (const QString &exampleFile, exampleFiles) {
(void) new FakeNode(fake, FakeNode* fn = new FakeNode(fake,
exampleFile.mid(sizeOfBoringPartOfName), exampleFile.mid(sizeOfBoringPartOfName),
Node::File, Node::File,
Node::NoPageType); Node::NoPageType);
}
foreach (const QString &imageFile, imageFiles) { foreach (const QString &imageFile, imageFiles) {
new FakeNode(fake, new FakeNode(fake,
imageFile.mid(sizeOfBoringPartOfName), imageFile.mid(sizeOfBoringPartOfName),

View File

@ -1327,16 +1327,12 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
{ {
const Node *node = 0; const Node *node = 0;
QString myLink = getLink(atom, relative, marker, &node); QString myLink = getLink(atom, relative, marker, &node);
if (myLink.isEmpty()) { if (myLink.isEmpty())
myLink = getCollisionLink(atom); myLink = getCollisionLink(atom);
} if (myLink.isEmpty())
if (myLink.isEmpty()) { relative->doc().location().warning(tr("Can't link to '%1'").arg(atom->string()));
relative->doc().location().warning(tr("Can't link to '%1'") else if (!inSectionHeading)
.arg(atom->string()));
}
else if (!inSectionHeading) {
beginLink(myLink); beginLink(myLink);
}
skipAhead = 1; skipAhead = 1;
} }
break; break;
@ -4237,25 +4233,20 @@ QString DitaXmlGenerator::getLink(const Atom* atom,
} }
else { else {
*node = marker->resolveTarget(first, tree_, relative); *node = marker->resolveTarget(first, tree_, relative);
if (!*node) { if (!*node)
*node = tree_->findFakeNodeByTitle(first, relative); *node = tree_->findFakeNodeByTitle(first, relative);
} if (!*node)
if (!*node) {
*node = tree_->findUnambiguousTarget(first, targetAtom, relative); *node = tree_->findUnambiguousTarget(first, targetAtom, relative);
} }
}
if (*node) { if (*node) {
if (!(*node)->url().isEmpty()) { if (!(*node)->url().isEmpty())
return (*node)->url(); return (*node)->url();
} else
else {
path.removeFirst(); path.removeFirst();
} }
} else
else {
*node = relative; *node = relative;
}
if (*node && (*node)->status() == Node::Obsolete) { if (*node && (*node)->status() == Node::Obsolete) {
if (relative && (relative->parent() != *node) && if (relative && (relative->parent() != *node) &&
@ -5747,7 +5738,6 @@ DitaXmlGenerator::generateInnerNode(InnerNode* node)
Obtain a code marker for the source file. Obtain a code marker for the source file.
*/ */
CodeMarker *marker = CodeMarker::markerForFileName(node->location().filePath()); CodeMarker *marker = CodeMarker::markerForFileName(node->location().filePath());
if (node->parent() != 0) { if (node->parent() != 0) {
/* /*
Skip name collision nodes here and process them 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); nodeSubtypeMaps[Node::QmlModule]->insert(child->title(),child);
break; break;
case Node::Collision: case Node::Collision:
qDebug() << "FAKE NODE: Collision";
if (!isDuplicate(nodeSubtypeMaps[Node::Collision],child->title(),child)) if (!isDuplicate(nodeSubtypeMaps[Node::Collision],child->title(),child))
nodeSubtypeMaps[Node::Collision]->insert(child->title(),child); nodeSubtypeMaps[Node::Collision]->insert(child->title(),child);
break; break;

View File

@ -2029,7 +2029,7 @@ QmlClassNode::QmlClassNode(InnerNode *parent,
{ {
int i = 0; int i = 0;
if (name.startsWith("QML:")) { if (name.startsWith("QML:")) {
qDebug() << "BOGUS:" << name; qDebug() << "BOGUS QML qualifier:" << name;
i = 4; i = 4;
} }
setTitle(name.mid(i)); setTitle(name.mid(i));
@ -2040,9 +2040,7 @@ QmlClassNode::QmlClassNode(InnerNode *parent,
*/ */
QmlClassNode::~QmlClassNode() QmlClassNode::~QmlClassNode()
{ {
#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES // nothing.
qDebug() << "Deleting QmlClassNode:" << name();
#endif
} }
/*! /*!
@ -2094,9 +2092,6 @@ void QmlClassNode::addInheritedBy(const QString& base, Node* sub)
if (inheritedBy.find(base,sub) == inheritedBy.end()) { if (inheritedBy.find(base,sub) == inheritedBy.end()) {
inheritedBy.insert(base,sub); 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(); subs.clear();
if (inheritedBy.count(base) > 0) { if (inheritedBy.count(base) > 0) {
subs = inheritedBy.values(base); subs = inheritedBy.values(base);
#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES
qDebug() << "QmlClassNode::subclasses():" << inheritedBy.count(base) << base
<< "subs:" << subs.size() << "total size:" << inheritedBy.size();
#endif
} }
} }