diff options
author | Martin Smith <martin.smith@digia.com> | 2013-09-16 13:07:57 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-16 15:35:33 +0200 |
commit | 433f2315ac07534acb858006f3ad925cd31eaa98 (patch) | |
tree | 9f9ea6e35efc0084c6d326d5b564f3a6dc809455 /src | |
parent | 4bae7158d379acb15a4eae02a4fc3d3e6103a7f9 (diff) |
qdoc: Now reports duplicate page titles better.
Currently, qdoc reports duplicate pages, when it should be reporting
duplicate page titles. Sometimes the duplicate titles actually refer
to the same page, but often they are different pages with the same
title. This update changes the error message to better indicate that
two identical page titles were seen.
A further complication was that the qdoc warnings for these duplate
page title errors were useless when the duplicates were in different Qt5
modules, because the support for file location information in the qdoc
index files was inadequate. This update adds better location information
to each section in the index file. This makes the index files bigger
and will increase qdoc runtimes, hopefully not too much.
Task-number: QTBUG-33506
Change-Id: I35db3c5e1551b9ef748d63377e94453da80c1e26
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/qdoc/node.h | 6 | ||||
-rw-r--r-- | src/tools/qdoc/qdocdatabase.cpp | 2 | ||||
-rw-r--r-- | src/tools/qdoc/qdocindexfiles.cpp | 21 |
3 files changed, 22 insertions, 7 deletions
diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h index 8364fac82f..76e762120e 100644 --- a/src/tools/qdoc/node.h +++ b/src/tools/qdoc/node.h @@ -169,7 +169,7 @@ public: void setBaseName(const QString& bn) { baseName_ = bn; } void setAccess(Access access) { access_ = access; } - void setLocation(const Location& location) { loc = location; } + void setLocation(const Location& location) { loc_ = location; } void setDoc(const Doc& doc, bool replace = false); void setStatus(Status status) { if (status_ == Obsolete && status == Deprecated) @@ -241,7 +241,7 @@ public: Access access() const { return access_; } QString accessString() const; - const Location& location() const { return loc; } + const Location& location() const { return loc_; } const Doc& doc() const { return doc_; } Status status() const { return status_; } Status inheritedStatus() const; @@ -304,7 +304,7 @@ private: InnerNode* parent_; InnerNode* relatesTo_; QString name_; - Location loc; + Location loc_; Doc doc_; QMap<LinkType, QPair<QString, QString> > linkMap_; QString baseName_; diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index a50f428d24..821170d0b1 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -932,7 +932,7 @@ const DocNode* QDocDatabase::findDocNodeByTitle(const QString& title, const Node ++j; } if (internalLocations.size() > 0) { - i.value()->location().warning(tr("This page exists in more than one file: \"%1\"").arg(title)); + i.value()->location().warning(tr("This page title exists in more than one file: \"%1\"").arg(title)); foreach (const Location &location, internalLocations) location.warning(tr("[It also exists here]")); } diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp index 265142d320..d8cb42513e 100644 --- a/src/tools/qdoc/qdocindexfiles.cpp +++ b/src/tools/qdoc/qdocindexfiles.cpp @@ -172,6 +172,12 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, Node* node; Location location; + QString filePath; + int lineNo = 0; + if (element.hasAttribute("filepath")) { + filePath = element.attribute("filepath", QString()); + lineNo = element.attribute("lineno", QString()).toInt(); + } if (element.nodeName() == "namespace") { node = new NamespaceNode(parent, name); @@ -519,6 +525,12 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, // Create some content for the node. QSet<QString> emptySet; + Location t(filePath); + if (!filePath.isEmpty()) { + t.setLineNo(lineNo); + node->setLocation(t); + location = t; + } Doc doc(location, location, " ", emptySet, emptySet); // placeholder node->setDoc(doc); node->setIndexNodeFlag(); @@ -774,8 +786,12 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, href.append(QLatin1Char('/')); href.append(gen_->fullDocumentLocation(node)); writer.writeAttribute("href", href); - if ((node->type() != Node::Document) && (!node->isQmlNode())) - writer.writeAttribute("location", node->location().fileName()); + + writer.writeAttribute("location", node->location().fileName()); + if (!node->location().filePath().isEmpty()) { + writer.writeAttribute("filepath", node->location().filePath()); + writer.writeAttribute("lineno", QString("%1").arg(node->location().lineNo())); + } if (!node->since().isEmpty()) { writer.writeAttribute("since", node->since()); @@ -870,7 +886,6 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, writer.writeAttribute("title", docNode->title()); 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()); } |