summaryrefslogtreecommitdiff
path: root/src/qdoc
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2021-04-14 13:42:15 +0200
committerTopi Reinio <topi.reinio@qt.io>2021-04-15 12:34:24 +0200
commitf970effa9de5ad5e7d0445458d3d43582bbdc695 (patch)
tree992a7a65f0e2bcea3e39106e263d9084c5cde344 /src/qdoc
parent12ef3ff43bc0d5af35c6b7ba2395ee3d6b8a5564 (diff)
downloadqttools-f970effa9de5ad5e7d0445458d3d43582bbdc695.tar.gz
Revert "QDoc: Make Generator::fileBase static"
This reverts commit 3e67b5e4df84421b77f90cbf242abb4a3c4c93a5. The original implementation where fileBase() was a virtual function, overridden by HtmlGenerator, was needed as that generator is the only one that conditionally appends '-obsolete' to output file names. By using a shared static helper across all generators we broke that feature. Modify the revert to resolve conflicts and override fileBase() also for WebXMLGenerator; .webxml output should not refer to files with -obsolete suffix. Pick-to: 6.0 6.1 Fixes: QTBUG-92478 Change-Id: I7a7e3ef333724c96624569dd27b4812196931fb0 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/qdoc')
-rw-r--r--src/qdoc/generator.cpp4
-rw-r--r--src/qdoc/generator.h2
-rw-r--r--src/qdoc/htmlgenerator.cpp13
-rw-r--r--src/qdoc/htmlgenerator.h2
-rw-r--r--src/qdoc/manifestwriter.cpp2
-rw-r--r--src/qdoc/webxmlgenerator.cpp7
-rw-r--r--src/qdoc/webxmlgenerator.h1
7 files changed, 18 insertions, 13 deletions
diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp
index 87b74ec56..5eaa7fbe9 100644
--- a/src/qdoc/generator.cpp
+++ b/src/qdoc/generator.cpp
@@ -326,7 +326,7 @@ static void transmogrify(QString &input, QString &output)
output.chop(1);
}
-QString Generator::fileBase(const Node *node)
+QString Generator::fileBase(const Node *node) const
{
if (!node->isPageNode() && !node->isCollectionNode())
node = node->parent();
@@ -372,7 +372,7 @@ QString Generator::fileBase(const Node *node)
module name.
*/
if (!node->logicalModuleName().isEmpty()
- && (!node->logicalModule()->isInternal() || Config::instance().showInternal()))
+ && (!node->logicalModule()->isInternal() || m_showInternal))
base.prepend(node->logicalModuleName() + outputSuffix(node) + QLatin1Char('-'));
base.prepend(outputPrefix(node));
diff --git a/src/qdoc/generator.h b/src/qdoc/generator.h
index 194c3aefb..3892617cf 100644
--- a/src/qdoc/generator.h
+++ b/src/qdoc/generator.h
@@ -97,7 +97,7 @@ public:
static QmlTypeNode *qmlTypeContext() { return qmlTypeContext_; }
static QString cleanRef(const QString &ref);
static QString plainCode(const QString &markedCode);
- static QString fileBase(const Node *node);
+ virtual QString fileBase(const Node *node) const;
protected:
static QFile *openSubPageFile(const Node *node, const QString &fileName);
diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp
index 210075a2a..b43c1d471 100644
--- a/src/qdoc/htmlgenerator.cpp
+++ b/src/qdoc/htmlgenerator.cpp
@@ -2265,7 +2265,7 @@ QString HtmlGenerator::generateAllMembersFile(const Section &section, CodeMarker
return QString();
const Aggregate *aggregate = section.aggregate();
- QString fileName = appendObsoleteToFileBase(aggregate) + "-members." + fileExtension();
+ QString fileName = fileBase(aggregate) + "-members." + fileExtension();
beginSubPage(aggregate, fileName);
QString title = "List of All Members for " + aggregate->name();
generateHeader(title, aggregate, marker);
@@ -2295,7 +2295,7 @@ QString HtmlGenerator::generateAllQmlMembersFile(const Sections &sections, CodeM
return QString();
const Aggregate *aggregate = sections.aggregate();
- QString fileName = appendObsoleteToFileBase(aggregate) + "-members." + fileExtension();
+ QString fileName = fileBase(aggregate) + "-members." + fileExtension();
beginSubPage(aggregate, fileName);
QString title = "List of All Members for " + aggregate->name();
generateHeader(title, aggregate, marker);
@@ -2365,7 +2365,7 @@ QString HtmlGenerator::generateObsoleteMembersFile(const Sections &sections, Cod
Aggregate *aggregate = sections.aggregate();
QString title = "Obsolete Members for " + aggregate->name();
- QString fileName = appendObsoleteToFileBase(aggregate) + "-obsolete." + fileExtension();
+ QString fileName = fileBase(aggregate) + "-obsolete." + fileExtension();
QString link;
if (useOutputSubdirs() && !Generator::outputSubdir().isEmpty())
link = QString("../" + Generator::outputSubdir() + QLatin1Char('/'));
@@ -2421,7 +2421,7 @@ QString HtmlGenerator::generateObsoleteQmlMembersFile(const Sections &sections,
Aggregate *aggregate = sections.aggregate();
QString title = "Obsolete Members for " + aggregate->name();
- QString fileName = appendObsoleteToFileBase(aggregate) + "-obsolete." + fileExtension();
+ QString fileName = fileBase(aggregate) + "-obsolete." + fileExtension();
QString link;
if (useOutputSubdirs() && !Generator::outputSubdir().isEmpty())
link = QString("../" + Generator::outputSubdir() + QLatin1Char('/'));
@@ -2708,8 +2708,7 @@ void HtmlGenerator::generateCompactList(ListType listType, const Node *relative,
*/
out() << "<a href=\"" << linkForNode(it.value(), relative) << "\">";
} else if (listType == Obsolete) {
- QString fileName =
- appendObsoleteToFileBase(it.value()) + "-obsolete." + fileExtension();
+ QString fileName = fileBase(it.value()) + "-obsolete." + fileExtension();
QString link;
if (useOutputSubdirs()) {
link = QString("../" + it.value()->outputSubdirectory() + QLatin1Char('/'));
@@ -3298,7 +3297,7 @@ QString HtmlGenerator::protect(const QString &string)
#undef APPEND
}
-QString HtmlGenerator::appendObsoleteToFileBase(const Node *node) const
+QString HtmlGenerator::fileBase(const Node *node) const
{
QString result = Generator::fileBase(node);
if (!node->isAggregate() && node->isObsolete())
diff --git a/src/qdoc/htmlgenerator.h b/src/qdoc/htmlgenerator.h
index 13067a71b..d99a5fd3c 100644
--- a/src/qdoc/htmlgenerator.h
+++ b/src/qdoc/htmlgenerator.h
@@ -122,7 +122,7 @@ private:
void generateDetailedMember(const Node *node, const PageNode *relative, CodeMarker *marker);
void generateLink(const Atom *atom, CodeMarker *marker);
- QString appendObsoleteToFileBase(const Node *node) const;
+ QString fileBase(const Node *node) const override;
QString fileName(const Node *node);
void beginLink(const QString &link);
diff --git a/src/qdoc/manifestwriter.cpp b/src/qdoc/manifestwriter.cpp
index ec632294a..bb44158c1 100644
--- a/src/qdoc/manifestwriter.cpp
+++ b/src/qdoc/manifestwriter.cpp
@@ -239,7 +239,7 @@ void ManifestWriter::generateManifestFile(const QString &manifest, const QString
// attributes that are always written for the element
usedAttributes.insert("name", example->title());
- usedAttributes.insert("docUrl", m_manifestDir + Generator::fileBase(example) + ".html");
+ usedAttributes.insert("docUrl", m_manifestDir + Generator::currentGenerator()->fileBase(example) + ".html");
if (!example->projectFile().isEmpty())
usedAttributes.insert("projectPath", installPath + example->projectFile());
diff --git a/src/qdoc/webxmlgenerator.cpp b/src/qdoc/webxmlgenerator.cpp
index 00cceb9a5..dbb4ba52a 100644
--- a/src/qdoc/webxmlgenerator.cpp
+++ b/src/qdoc/webxmlgenerator.cpp
@@ -257,7 +257,7 @@ void WebXMLGenerator::generateDocumentation(Node *node)
if (!node->url().isNull() || node->isExternalPage() || node->isIndexNode())
return;
- if (node->isInternal() && !Config::instance().showInternal())
+ if (node->isInternal() && !m_showInternal)
return;
if (node->parent()) {
@@ -877,4 +877,9 @@ void WebXMLGenerator::generateAnnotatedList(QXmlStreamWriter &writer, const Node
writer.writeEndElement(); // table
}
+QString WebXMLGenerator::fileBase(const Node *node) const
+{
+ return Generator::fileBase(node);
+}
+
QT_END_NAMESPACE
diff --git a/src/qdoc/webxmlgenerator.h b/src/qdoc/webxmlgenerator.h
index 187abd93d..f4e5623e8 100644
--- a/src/qdoc/webxmlgenerator.h
+++ b/src/qdoc/webxmlgenerator.h
@@ -72,6 +72,7 @@ private:
void startLink(QXmlStreamWriter &writer, const Atom *atom, const Node *node,
const QString &link);
void endLink(QXmlStreamWriter &writer);
+ QString fileBase(const Node *node) const override;
bool m_inLink { false };
bool m_inSectionHeading { false };