aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmldirparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml/qqmldirparser.cpp')
-rw-r--r--src/qml/qml/qqmldirparser.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/qml/qml/qqmldirparser.cpp b/src/qml/qml/qqmldirparser.cpp
index 7068818f15..83e1c9c757 100644
--- a/src/qml/qml/qqmldirparser.cpp
+++ b/src/qml/qml/qqmldirparser.cpp
@@ -231,6 +231,28 @@ bool QQmlDirParser::parse(const QString &source)
reportError(lineNumber, 0, QString::fromLatin1("designersupported does not expect any argument"));
else
_designerSupported = true;
+ } else if (sections[0] == QLatin1String("depends")) {
+ if (sectionCount != 3) {
+ reportError(lineNumber, 0,
+ QString::fromLatin1("depends requires 2 arguments, but %1 were provided").arg(sectionCount - 1));
+ continue;
+ }
+
+ const QString &version = sections[2];
+ const int dotIndex = version.indexOf(QLatin1Char('.'));
+ bool validVersionNumber = false;
+ const int majorVersion = parseInt(QStringRef(&version, 0, dotIndex), &validVersionNumber);
+ if (validVersionNumber) {
+ const int minorVersion = parseInt(QStringRef(&version, dotIndex+1, version.length()-dotIndex-1), &validVersionNumber);
+
+ if (validVersionNumber) {
+ Component entry(sections[1], QString(), majorVersion, minorVersion);
+ entry.internal = true;
+ _dependencies.insert(entry.typeName, entry);
+ }
+ } else {
+ reportError(lineNumber, 0, QString(QLatin1String("invalid version %1")).arg(version));
+ }
} else if (sectionCount == 2) {
// No version specified (should only be used for relative qmldir files)
const Component entry(sections[0], sections[1], -1, -1);
@@ -348,6 +370,11 @@ QHash<QString, QQmlDirParser::Component> QQmlDirParser::components() const
return _components;
}
+QHash<QString, QQmlDirParser::Component> QQmlDirParser::dependencies() const
+{
+ return _dependencies;
+}
+
QList<QQmlDirParser::Script> QQmlDirParser::scripts() const
{
return _scripts;