summaryrefslogtreecommitdiffstats
path: root/tools/assistant
diff options
context:
space:
mode:
authorck <qt-info@nokia.com>2009-07-07 09:23:45 (GMT)
committerck <qt-info@nokia.com>2009-07-07 09:23:45 (GMT)
commitac6fad8a677eb113839ff4ca79c8185e0aa8237b (patch)
treeff921be69facf623251627435ff75dbdc15dc194 /tools/assistant
parent134dad4c6a996045397098498eaf0afca889b6f9 (diff)
downloadQt-ac6fad8a677eb113839ff4ca79c8185e0aa8237b.zip
Qt-ac6fad8a677eb113839ff4ca79c8185e0aa8237b.tar.gz
Qt-ac6fad8a677eb113839ff4ca79c8185e0aa8237b.tar.bz2
Added wildcard support for file lists in help projects.
The qhelpgenerator auto test was also updated to test the new feature. Reviewed-by: kh
Diffstat (limited to 'tools/assistant')
-rw-r--r--tools/assistant/lib/qhelpprojectdata.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/tools/assistant/lib/qhelpprojectdata.cpp b/tools/assistant/lib/qhelpprojectdata.cpp
index 8947a36..55b4ea7 100644
--- a/tools/assistant/lib/qhelpprojectdata.cpp
+++ b/tools/assistant/lib/qhelpprojectdata.cpp
@@ -41,6 +41,7 @@
#include "qhelpprojectdata_p.h"
+#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QStack>
#include <QtCore/QMap>
@@ -73,6 +74,7 @@ private:
void readKeywords();
void readFiles();
void raiseUnknownTokenError();
+ void addMatchingFiles(const QString &pattern);
};
void QHelpProjectDataPrivate::raiseUnknownTokenError()
@@ -161,7 +163,7 @@ void QHelpProjectDataPrivate::readFilterSection()
readNext();
if (isStartElement()) {
if (name() == QLatin1String("filterAttribute"))
- filterSectionList.last().addFilterAttribute(readElementText());
+ filterSectionList.last().addFilterAttribute(readElementText());
else if (name() == QLatin1String("toc"))
readTOC();
else if (name() == QLatin1String("keywords"))
@@ -244,7 +246,7 @@ void QHelpProjectDataPrivate::readFiles()
readNext();
if (isStartElement()) {
if (name() == QLatin1String("file"))
- filterSectionList.last().addFile(readElementText());
+ addMatchingFiles(readElementText());
else
raiseUnknownTokenError();
} else if (isEndElement()) {
@@ -258,7 +260,21 @@ void QHelpProjectDataPrivate::readFiles()
}
}
-
+// Expand file pattern and add matches into list. If the pattern does not match
+// any files, insert the pattern itself so the QHelpGenerator will emit a
+// meaningful warning later.
+void QHelpProjectDataPrivate::addMatchingFiles(const QString &pattern)
+{
+ QFileInfo fileInfo(rootPath + '/' + pattern);
+ const QStringList &matches =
+ fileInfo.dir().entryList(QStringList(fileInfo.fileName()));
+ for (QStringList::ConstIterator it = matches.constBegin();
+ it != matches.constEnd();
+ ++it)
+ filterSectionList.last().addFile(QFileInfo(pattern).dir().path() + '/' + *it);
+ if (matches.empty())
+ filterSectionList.last().addFile(pattern);
+}
/*!
\internal