summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-01-06 19:31:39 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2011-01-06 19:31:39 -0200
commitc6ecedee1d37dbf3f7ef1d5b77b597febada8ac6 (patch)
treeca32c51998aeb6dc4bbb28ecd3ff42cd0e94f248
parentde235e55f4e587e71a265f17f2e7b087bea22417 (diff)
Add support for extra documentation in module table of contents.
This is needed to fix the bug bug#560 ("Lack of QtCore.Signal documentation")
-rw-r--r--generators/qtdoc/qtdocgenerator.cpp24
-rw-r--r--generators/qtdoc/qtdocgenerator.h1
2 files changed, 24 insertions, 1 deletions
diff --git a/generators/qtdoc/qtdocgenerator.cpp b/generators/qtdoc/qtdocgenerator.cpp
index f5f5626f..ff88c5e3 100644
--- a/generators/qtdoc/qtdocgenerator.cpp
+++ b/generators/qtdoc/qtdocgenerator.cpp
@@ -1344,7 +1344,8 @@ void QtDocGenerator::finishGeneration()
QMap<QString, QStringList>::iterator it = m_packages.begin();
for (; it != m_packages.end(); ++it) {
- FileOut output(outputDirectory() + '/' + QString(it.key()).replace(".", "/") + "/index.rst");
+ QString outputDir = outputDirectory() + '/' + QString(it.key()).replace(".", "/");
+ FileOut output(outputDir + "/index.rst");
QTextStream& s = output.stream;
s << ".. module:: " << it.key() << endl << endl;
@@ -1358,6 +1359,25 @@ void QtDocGenerator::finishGeneration()
Indentation indentation(INDENT);
s << INDENT << ":maxdepth: 1" << endl << endl;
+ // Search for extra-sections
+ if (!m_extraSectionDir.isEmpty()) {
+ QDir extraSectionDir(m_extraSectionDir);
+ QStringList fileList = extraSectionDir.entryList(QStringList() << (it.key() + "*.rst"), QDir::Files);
+ QStringList::iterator it2 = fileList.begin();
+ for (; it2 != fileList.end(); ++it2) {
+ QString origFileName(*it2);
+ it2->remove(0, it.key().count() + 1);
+ QString newFilePath = outputDir + '/' + *it2;
+ if (QFile::exists(newFilePath))
+ QFile::remove(newFilePath);
+ if (!QFile::copy(m_extraSectionDir + '/' + origFileName, newFilePath)) {
+ ReportHandler::warning("Error copying extra doc " + (m_extraSectionDir + '/' + origFileName)
+ + " to " + newFilePath);
+ }
+ }
+ it.value().append(fileList);
+ }
+
qSort(it.value());
foreach (QString className, it.value()) {
s << INDENT << className << endl;
@@ -1382,6 +1402,7 @@ bool QtDocGenerator::doSetup(const QMap<QString, QString>& args)
m_libSourceDir = args.value("library-source-dir");
m_docDataDir = args.value("documentation-data-dir");
m_codeSnippetDir = args.value("documentation-code-snippets-dir", m_libSourceDir);
+ m_extraSectionDir = args.value("documentation-extra-sections-dir");
if (m_libSourceDir.isEmpty() || m_docDataDir.isEmpty()) {
ReportHandler::warning("Documentation data dir and/or Qt source dir not informed, "
@@ -1401,6 +1422,7 @@ QMap<QString, QString> QtDocGenerator::options() const
options.insert("library-source-dir", "Directory where library source code is located");
options.insert("documentation-data-dir", "Directory with XML files generated by documentation tool (qdoc3 or Doxygen)");
options.insert("documentation-code-snippets-dir", "Directory used to search code snippets used by the documentation");
+ options.insert("documentation-extra-sections-dir", "Directory used to search for extra documentation sections");
return options;
}
diff --git a/generators/qtdoc/qtdocgenerator.h b/generators/qtdoc/qtdocgenerator.h
index 327e9056..672dd855 100644
--- a/generators/qtdoc/qtdocgenerator.h
+++ b/generators/qtdoc/qtdocgenerator.h
@@ -213,6 +213,7 @@ private:
QString m_docDataDir;
QString m_libSourceDir;
QString m_codeSnippetDir;
+ QString m_extraSectionDir;
QStringList m_functionList;
QMap<QString, QStringList> m_packages;
QtDocParser* m_docParser;