diff options
author | Casper van Donderen <casper.vandonderen@nokia.com> | 2012-06-04 17:29:53 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-05 09:25:07 +0200 |
commit | 67fc1b893d6bbcd135497341cfaa4ea74ffeb29b (patch) | |
tree | 25aae32d3d4ccbfb4480342c54c38c809dd8cc06 /src/tools | |
parent | 4eecbf3b842afcfb91d78552ce19d2c0b8f8c53a (diff) |
QDoc: search for example projectPath for manifest.
Previously qdoc would automatically use the first .pro/.qmlproject file
found, now it explicitly searches for a .pro/.qmlproject file with the
name of the example.
Change-Id: I2552e529bd3d1b724d3b4286d98d664edbbabcf2
Reviewed-by: Martin Smith <martin.smith@nokia.com>
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/qdoc/htmlgenerator.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 83f3c4af66..b5fec5d36d 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -4388,15 +4388,35 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element) writer.writeAttribute("name", en->title()); QString docUrl = manifestDir + en->fileBase() + ".html"; writer.writeAttribute("docUrl", docUrl); + QStringList proFiles; foreach (const Node* child, en->childNodes()) { if (child->subType() == Node::File) { QString file = child->name(); if (file.endsWith(".pro") || file.endsWith(".qmlproject")) { if (file.startsWith("demos/")) file = file.mid(6); - writer.writeAttribute("projectPath", file); - break; + proFiles << file; + } + } + } + if (!proFiles.isEmpty()) { + if (proFiles.size() == 1) { + writer.writeAttribute("projectPath", proFiles[0]); + } + else { + QString exampleName = en->name().split('/').last(); + bool proWithExampleNameFound = false; + for (int j = 0; j < proFiles.size(); j++) + { + if (proFiles[j].endsWith(QStringLiteral("%1/%1.pro").arg(exampleName)) + || proFiles[j].endsWith(QStringLiteral("%1/%1.qmlproject").arg(exampleName))) { + writer.writeAttribute("projectPath", proFiles[j]); + proWithExampleNameFound = true; + break; + } } + if (!proWithExampleNameFound) + writer.writeAttribute("projectPath", proFiles[0]); } } if (!en->imageFileName().isEmpty()) |