diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-01-06 19:31:39 -0200 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-01-06 19:31:39 -0200 |
commit | c6ecedee1d37dbf3f7ef1d5b77b597febada8ac6 (patch) | |
tree | ca32c51998aeb6dc4bbb28ecd3ff42cd0e94f248 /generators/qtdoc/qtdocgenerator.cpp | |
parent | de235e55f4e587e71a265f17f2e7b087bea22417 (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")
Diffstat (limited to 'generators/qtdoc/qtdocgenerator.cpp')
-rw-r--r-- | generators/qtdoc/qtdocgenerator.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/generators/qtdoc/qtdocgenerator.cpp b/generators/qtdoc/qtdocgenerator.cpp index f5f5626f3..ff88c5e38 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; } |