From 67fc1b893d6bbcd135497341cfaa4ea74ffeb29b Mon Sep 17 00:00:00 2001 From: Casper van Donderen Date: Mon, 4 Jun 2012 17:29:53 +0200 Subject: [PATCH] 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 --- src/tools/qdoc/htmlgenerator.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 83f3c4a..b5fec5d 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()) -- 2.7.4