From 60fb770fa779864015f728556857b1d70398fb74 Mon Sep 17 00:00:00 2001 From: Casper van Donderen Date: Wed, 30 May 2012 10:44:04 +0200 Subject: [PATCH] QDoc: Add support for 'all subfolders' in dependant modules. It is now possible to use '*' when specifying the 'depends' qdocconf variable, this will automatically load all index files found in subdirectories of the index dirs. Change-Id: I94b140df27da8d987824005a1dcf2a9348d5cd9e Reviewed-by: Martin Smith --- src/tools/qdoc/main.cpp | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp index 34ef213..f33b95c 100644 --- a/src/tools/qdoc/main.cpp +++ b/src/tools/qdoc/main.cpp @@ -254,12 +254,29 @@ static void processQdocconfFile(const QString &fileName) if (dependModules.size() > 0) { if (indexDirs.size() > 0) { - for (int j = 0; j < indexDirs.size(); j++) { - if (indexDirs[j].startsWith("..")) { - indexDirs[j].prepend(QDir(dir).relativeFilePath(prevCurrentDir)); + for (int i = 0; i < indexDirs.size(); i++) { + if (indexDirs[i].startsWith("..")) { + indexDirs[i].prepend(QDir(dir).relativeFilePath(prevCurrentDir)); + } + } + /* + Add all subdirectories of the indexdirs as dependModules when an asterisk is used in + the 'depends' list. + */ + if (dependModules.contains("*")) { + dependModules.removeOne("*"); + for (int i = 0; i < indexDirs.size(); i++) { + QDir scanDir = QDir(indexDirs[i]); + scanDir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot); + QFileInfoList dirList = scanDir.entryInfoList(); + for (int j = 0; j < dirList.size(); j++) { + if (dirList[j].fileName().toLower() != config.getString(CONFIG_PROJECT).toLower()) + dependModules.append(dirList[j].fileName()); + } } } for (int i = 0; i < dependModules.size(); i++) { + QString indexToAdd; QMultiMap foundIndices; for (int j = 0; j < indexDirs.size(); j++) { QString fileToLookFor = indexDirs[j] + QLatin1Char('/') + dependModules[i] + @@ -279,16 +296,18 @@ static void processQdocconfFile(const QString &fileName) qDebug() << "Using" << foundIndices.value( foundIndices.keys()[foundIndices.size() - 1]).absoluteFilePath() << "as index for" << dependModules[i]; - indexFiles << foundIndices.value( + indexToAdd = foundIndices.value( foundIndices.keys()[foundIndices.size() - 1]).absoluteFilePath(); } else if (foundIndices.size() == 1) { - indexFiles << foundIndices.value(foundIndices.keys()[0]).absoluteFilePath(); + indexToAdd = foundIndices.value(foundIndices.keys()[0]).absoluteFilePath(); } else { qDebug() << "No indices for" << dependModules[i] << "could be found in the specified index directories."; } + if (!indexToAdd.isEmpty() && !indexFiles.contains(indexToAdd)) + indexFiles << indexToAdd; } } else { -- 2.7.4