summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Köhne <kai.koehne@qt.io>2023-06-26 12:55:27 +0200
committerEike Ziller <eike.ziller@qt.io>2023-09-07 12:34:49 +0200
commit4a2a0d164438b5e16f2199ab5bddc35ed24dca05 (patch)
tree02182749bd6f7ccb1ed3e7268d5ff20f41575e4f
parent32e55d45bdb8becc9f3991d7aec736474b145205 (diff)
Support explicit list of example categories in manifest file
Examples currently implicitly define the list of all available example categories. Add support for an explicit list that defines an order between categories (to be used in the QtC welcome screen). A list for the Qt example categories will be defined in qtdoc. Change-Id: Ia9dfd0b55e4b4063641e72c1d55574743610b164 Reviewed-by: Eike Ziller <eike.ziller@qt.io> (cherry picked from commit 2277cf896c58fc0f2f61a2ab21903d8b710af225) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Köhne <kai.koehne@qt.io>
-rw-r--r--src/qdoc/manifestwriter.cpp14
-rw-r--r--src/qdoc/manifestwriter.h1
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/examples-manifest.xml6
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/configs/testqml.qdocconf5
4 files changed, 26 insertions, 0 deletions
diff --git a/src/qdoc/manifestwriter.cpp b/src/qdoc/manifestwriter.cpp
index dbe305b60..7e592077c 100644
--- a/src/qdoc/manifestwriter.cpp
+++ b/src/qdoc/manifestwriter.cpp
@@ -341,6 +341,17 @@ void ManifestWriter::generateExampleManifestFile()
}
writer.writeEndElement(); // examples
+
+ if (!m_exampleCategories.isEmpty()) {
+ writer.writeStartElement("categories");
+ for (const auto &examplecategory : m_exampleCategories) {
+ writer.writeStartElement("category");
+ writer.writeCharacters(examplecategory);
+ writer.writeEndElement();
+ }
+ writer.writeEndElement(); // categories
+ }
+
writer.writeEndElement(); // instructionals
writer.writeEndDocument();
outputFile.close();
@@ -367,6 +378,9 @@ void ManifestWriter::readManifestMetaContent()
filter.m_tags = config.getStringSet(prefix + QStringLiteral("tags"));
m_manifestMetaContent.append(filter);
}
+
+ m_exampleCategories =
+ config.getStringList(CONFIG_MANIFESTMETA + QStringLiteral(".examplecategories"));
}
/*!
diff --git a/src/qdoc/manifestwriter.h b/src/qdoc/manifestwriter.h
index e703f74e0..730835b9e 100644
--- a/src/qdoc/manifestwriter.h
+++ b/src/qdoc/manifestwriter.h
@@ -35,6 +35,7 @@ private:
QString m_project {};
QDocDatabase *m_qdb { nullptr };
QList<ManifestMetaFilter> m_manifestMetaContent {};
+ QStringList m_exampleCategories {};
template <typename F>
void processManifestMetaContent(const QString &fullName, F matchFunc);
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/examples-manifest.xml b/tests/auto/qdoc/generatedoutput/expected_output/examples-manifest.xml
index 563e3c5a3..b33aa00b9 100644
--- a/tests/auto/qdoc/generatedoutput/expected_output/examples-manifest.xml
+++ b/tests/auto/qdoc/generatedoutput/expected_output/examples-manifest.xml
@@ -20,4 +20,10 @@
</meta>
</example>
</examples>
+ <categories>
+ <category>Application Examples</category>
+ <category>Desktop</category>
+ <category>Mobile</category>
+ <category>Embedded</category>
+ </categories>
</instructionals>
diff --git a/tests/auto/qdoc/generatedoutput/testdata/configs/testqml.qdocconf b/tests/auto/qdoc/generatedoutput/testdata/configs/testqml.qdocconf
index 15d3f5272..27ff9eea5 100644
--- a/tests/auto/qdoc/generatedoutput/testdata/configs/testqml.qdocconf
+++ b/tests/auto/qdoc/generatedoutput/testdata/configs/testqml.qdocconf
@@ -22,3 +22,8 @@ macro.QDocTestVer = "1.1"
navigation.qmltypespage = "QDoc.Test QML Module"
navigation.qmltypestitle = "Types"
warninglimit += 1
+
+manifestmeta.examplecategories = "Application Examples" \
+ "Desktop" \
+ "Mobile" \
+ "Embedded"