summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorck <qt-info@nokia.com>2009-07-28 12:44:50 (GMT)
committerck <qt-info@nokia.com>2009-07-28 12:44:50 (GMT)
commit2d9448d1c9bcf843e36931a9109fd9bd8d42b2be (patch)
treed82e8b23c0fdb82fb6f66abc383d2015f25a17e4
parente1e83e28f66c5cd500ab2961f59840a4e47e80c4 (diff)
downloadQt-2d9448d1c9bcf843e36931a9109fd9bd8d42b2be.zip
Qt-2d9448d1c9bcf843e36931a9109fd9bd8d42b2be.tar.gz
Qt-2d9448d1c9bcf843e36931a9109fd9bd8d42b2be.tar.bz2
Assistant/helpconverter: Remove hard-coded version check in ADP file.
The AdpReader checked for a version attribute == 3.2.0. This has been replaced by a check for >= 3.2.0 Task-number: 258551 Reviewed-by: kh
-rw-r--r--tools/assistant/tools/qhelpconverter/adpreader.cpp20
-rw-r--r--tools/assistant/tools/qhelpconverter/adpreader.h6
2 files changed, 17 insertions, 9 deletions
diff --git a/tools/assistant/tools/qhelpconverter/adpreader.cpp b/tools/assistant/tools/qhelpconverter/adpreader.cpp
index 35f8878..c427038 100644
--- a/tools/assistant/tools/qhelpconverter/adpreader.cpp
+++ b/tools/assistant/tools/qhelpconverter/adpreader.cpp
@@ -39,8 +39,16 @@
**
****************************************************************************/
+#include <QRegExp>
+
#include "adpreader.h"
+static bool versionIsAtLeast320(const QString &version)
+{
+ return QRegExp("\\d.\\d\\.\\d").exactMatch(version)
+ && (version[0] > '3' || (version[0] == '3' && version[2] >= '2'));
+}
+
QT_BEGIN_NAMESPACE
void AdpReader::readData(const QByteArray &contents)
@@ -51,11 +59,11 @@ void AdpReader::readData(const QByteArray &contents)
m_properties.clear();
m_files.clear();
addData(contents);
- while (!atEnd()) {
- readNext();
- if (isStartElement()) {
+ while (!atEnd()) {
+ readNext();
+ if (isStartElement()) {
if (name().toString().toLower() == QLatin1String("assistantconfig")
- && attributes().value(QLatin1String("version")) == QLatin1String("3.2.0")) {
+ && versionIsAtLeast320(attributes().value(QLatin1String("version")).toString())) {
readProject();
} else if (name().toString().toLower() == QLatin1String("dcf")) {
QString ref = attributes().value(QLatin1String("ref")).toString();
@@ -66,8 +74,8 @@ void AdpReader::readData(const QByteArray &contents)
} else {
raiseError();
}
- }
- }
+ }
+ }
}
QList<ContentItem> AdpReader::contents() const
diff --git a/tools/assistant/tools/qhelpconverter/adpreader.h b/tools/assistant/tools/qhelpconverter/adpreader.h
index f2e7509..740a462 100644
--- a/tools/assistant/tools/qhelpconverter/adpreader.h
+++ b/tools/assistant/tools/qhelpconverter/adpreader.h
@@ -50,15 +50,15 @@ QT_BEGIN_NAMESPACE
struct ContentItem {
ContentItem(const QString &t, const QString &r, int d)
- : title(t), reference(r), depth(d) {}
+ : title(t), reference(r), depth(d) {}
QString title;
QString reference;
- int depth;
+ int depth;
};
struct KeywordItem {
KeywordItem(const QString &k, const QString &r)
- : keyword(k), reference(r) {}
+ : keyword(k), reference(r) {}
QString keyword;
QString reference;
};