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>
This commit is contained in:
parent
4bae7158d3
commit
433f2315ac
@ -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_;
|
||||
|
@ -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]"));
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user