qdoc: Augment imagedirs list
Modularization of examples has resulted in putting all documentation and code for an example in each example subdirectory. In particular, each example subdirectory now contains a doc/images subdirectoy, where images are stored that are linked to from the example .qdoc files, which are in the doc/src subdirectory of the example directory. Because there are so many example subdirectories, it would be difficult to list all the doc/images directories in the imagedirs variable of the qdocconf file. Therefore, qdoc now searches all the directories listed in the exampledirs variable to find all the doc/images subdirectories there, and it adds these to the imagedirs variable for use in finding images called out in \image and \inlineimage commands. Task Nr: QTBUG-27248 Change-Id: I070ba1a558ab32e1db06429a71c083b55f9dd0ea Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
This commit is contained in:
parent
8e90e0805f
commit
42b8833712
@ -507,7 +507,7 @@ QStringList Config::getExampleQdocFiles(const QSet<QString> &excludedDirs,
|
||||
const QSet<QString> &excludedFiles)
|
||||
{
|
||||
QStringList result;
|
||||
QStringList dirs = getStringList("exampledirs");
|
||||
QStringList dirs = getCanonicalRelativePathList("exampledirs");
|
||||
QString nameFilter = " *.qdoc";
|
||||
|
||||
QStringList::ConstIterator d = dirs.constBegin();
|
||||
@ -518,6 +518,21 @@ QStringList Config::getExampleQdocFiles(const QSet<QString> &excludedDirs,
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList Config::getExampleImageFiles(const QSet<QString> &excludedDirs,
|
||||
const QSet<QString> &excludedFiles)
|
||||
{
|
||||
QStringList result;
|
||||
QStringList dirs = getCanonicalRelativePathList("exampledirs");
|
||||
QString nameFilter = getString(CONFIG_EXAMPLES + dot + QLatin1String(CONFIG_IMAGEEXTENSIONS));
|
||||
|
||||
QStringList::ConstIterator d = dirs.constBegin();
|
||||
while (d != dirs.constEnd()) {
|
||||
result += getFilesHere(*d, nameFilter, location(), excludedDirs, excludedFiles);
|
||||
++d;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*!
|
||||
\a fileName is the path of the file to find.
|
||||
|
||||
|
@ -87,6 +87,8 @@ public:
|
||||
const QSet<QString> &excludedDirs = QSet<QString>(),
|
||||
const QSet<QString> &excludedFiles = QSet<QString>());
|
||||
QStringList getExampleQdocFiles(const QSet<QString> &excludedDirs, const QSet<QString> &excludedFiles);
|
||||
QStringList getExampleImageFiles(const QSet<QString> &excludedDirs, const QSet<QString> &excludedFiles);
|
||||
|
||||
static QStringList getFilesHere(const QString& dir,
|
||||
const QString& nameFilter,
|
||||
const Location &location = Location(),
|
||||
|
@ -1405,9 +1405,12 @@ QStringList Generator::getMetadataElements(const InnerNode* inner, const QString
|
||||
QString Generator::imageFileName(const Node *relative, const QString& fileBase)
|
||||
{
|
||||
QString userFriendlyFilePath;
|
||||
QString filePath = Config::findFile(
|
||||
relative->doc().location(), imageFiles, imageDirs, fileBase,
|
||||
imgFileExts[format()], userFriendlyFilePath);
|
||||
QString filePath = Config::findFile(relative->doc().location(),
|
||||
imageFiles,
|
||||
imageDirs,
|
||||
fileBase,
|
||||
imgFileExts[format()],
|
||||
userFriendlyFilePath);
|
||||
|
||||
if (filePath.isEmpty())
|
||||
return QString();
|
||||
@ -1620,6 +1623,21 @@ void Generator::initialize(const Config &config)
|
||||
outputPrefixes[QLatin1String("QML")] = QLatin1String("qml-");
|
||||
}
|
||||
|
||||
/*!
|
||||
Appends each directory path in \a moreImageDirs to the
|
||||
list of image directories.
|
||||
*/
|
||||
void Generator::augmentImageDirs(QSet<QString>& moreImageDirs)
|
||||
{
|
||||
if (moreImageDirs.isEmpty())
|
||||
return;
|
||||
QSet<QString>::const_iterator i = moreImageDirs.begin();
|
||||
while (i != moreImageDirs.end()) {
|
||||
imageDirs.append(*i);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
void Generator::initializeGenerator(const Config & /* config */)
|
||||
{
|
||||
}
|
||||
|
@ -85,6 +85,7 @@ public:
|
||||
static const QString& outputDir() { return outDir_; }
|
||||
static void terminate();
|
||||
static void writeOutFileNames();
|
||||
static void augmentImageDirs(QSet<QString>& moreImageDirs);
|
||||
|
||||
protected:
|
||||
virtual void beginSubPage(const InnerNode* node, const QString& fileName);
|
||||
|
@ -165,10 +165,8 @@ static void processQdocconfFile(const QString &fileName)
|
||||
++i;
|
||||
}
|
||||
config.setStringList(CONFIG_SYNTAXHIGHLIGHTING, QStringList(highlighting ? "true" : "false"));
|
||||
config.setStringList(CONFIG_SHOWINTERNAL,
|
||||
QStringList(showInternal ? "true" : "false"));
|
||||
config.setStringList(CONFIG_OBSOLETELINKS,
|
||||
QStringList(obsoleteLinks ? "true" : "false"));
|
||||
config.setStringList(CONFIG_SHOWINTERNAL, QStringList(showInternal ? "true" : "false"));
|
||||
config.setStringList(CONFIG_OBSOLETELINKS, QStringList(obsoleteLinks ? "true" : "false"));
|
||||
|
||||
/*
|
||||
With the default configuration values in place, load
|
||||
@ -372,6 +370,18 @@ static void processQdocconfFile(const QString &fileName)
|
||||
}
|
||||
}
|
||||
|
||||
QSet<QString> exampleImageDirs;
|
||||
QStringList exampleImageList = config.getExampleImageFiles(excludedDirs, excludedFiles);
|
||||
for (int i=0; i<exampleImageList.size(); ++i) {
|
||||
if (exampleImageList[i].contains("doc/images")) {
|
||||
QString t = exampleImageList[i].left(exampleImageList[i].lastIndexOf("doc/images")+10);
|
||||
if (!exampleImageDirs.contains(t)) {
|
||||
exampleImageDirs.insert(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
Generator::augmentImageDirs(exampleImageDirs);
|
||||
|
||||
/*
|
||||
Parse each header file in the set using the appropriate parser and add it
|
||||
to the big tree.
|
||||
|
Loading…
Reference in New Issue
Block a user