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>
This commit is contained in:
Casper van Donderen 2012-06-04 17:29:53 +02:00 committed by Qt by Nokia
parent 4eecbf3b84
commit 67fc1b893d

View File

@ -4388,17 +4388,37 @@ 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())
writer.writeAttribute("imageUrl", manifestDir + en->imageFileName());
writer.writeStartElement("description");