aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmljstools/qmljsplugindumper.cpp
diff options
context:
space:
mode:
authorChristian Kamm <[email protected]>2011-10-12 08:36:02 +0200
committerChristian Kamm <[email protected]>2011-10-21 08:21:00 +0200
commit0b75a66407eda8de22f0ab141ccbc976daff44b4 (patch)
tree70cb46d5cbd4f4d032c956189cb676650b1358d4 /src/plugins/qmljstools/qmljsplugindumper.cpp
parent55420e2b7070b552fe7790935e56b846d10242f7 (diff)
QmlJS: Support module apis defined by QML modules.
Change-Id: I18ec9daf8088f7db5ff2da11da14b539f501bab3 Reviewed-by: Fawzi Mohamed <[email protected]>
Diffstat (limited to 'src/plugins/qmljstools/qmljsplugindumper.cpp')
-rw-r--r--src/plugins/qmljstools/qmljsplugindumper.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/plugins/qmljstools/qmljsplugindumper.cpp b/src/plugins/qmljstools/qmljsplugindumper.cpp
index 921d8b994cc..a574eb989f1 100644
--- a/src/plugins/qmljstools/qmljsplugindumper.cpp
+++ b/src/plugins/qmljstools/qmljsplugindumper.cpp
@@ -257,21 +257,6 @@ static void printParseWarnings(const QString &libraryPath, const QString &warnin
"%2").arg(libraryPath, warning));
}
-static QList<FakeMetaObject::ConstPtr> parseHelper(const QByteArray &qmlTypeDescriptions,
- QString *error,
- QString *warning)
-{
- QList<FakeMetaObject::ConstPtr> ret;
- QHash<QString, FakeMetaObject::ConstPtr> newObjects;
- CppQmlTypesLoader::parseQmlTypeDescriptions(qmlTypeDescriptions, &newObjects,
- error, warning);
-
- if (error->isEmpty()) {
- ret = newObjects.values();
- }
- return ret;
-}
-
void PluginDumper::qmlPluginTypeDumpDone(int exitCode)
{
QProcess *process = qobject_cast<QProcess *>(sender());
@@ -295,13 +280,16 @@ void PluginDumper::qmlPluginTypeDumpDone(int exitCode)
const QByteArray output = process->readAllStandardOutput();
QString error;
QString warning;
- QList<FakeMetaObject::ConstPtr> objectsList = parseHelper(output, &error, &warning);
+ CppQmlTypesLoader::BuiltinObjects objectsList;
+ QList<ModuleApiInfo> moduleApis;
+ CppQmlTypesLoader::parseQmlTypeDescriptions(output, &objectsList, &moduleApis, &error, &warning);
if (exitCode == 0) {
if (!error.isEmpty()) {
libraryInfo.setPluginTypeInfoStatus(LibraryInfo::DumpError,
qmldumpErrorMessage(libraryPath, error));
} else {
- libraryInfo.setMetaObjects(objectsList);
+ libraryInfo.setMetaObjects(objectsList.values());
+ libraryInfo.setModuleApis(moduleApis);
libraryInfo.setPluginTypeInfoStatus(LibraryInfo::DumpDone);
}
@@ -352,6 +340,7 @@ void PluginDumper::loadQmltypesFile(const QStringList &qmltypesFilePaths,
QStringList errors;
QStringList warnings;
QList<FakeMetaObject::ConstPtr> objects;
+ QList<ModuleApiInfo> moduleApis;
foreach (const QString &qmltypesFilePath, qmltypesFilePaths) {
Utils::FileReader reader;
@@ -362,14 +351,21 @@ void PluginDumper::loadQmltypesFile(const QStringList &qmltypesFilePaths,
QString error;
QString warning;
- objects += parseHelper(reader.data(), &error, &warning);
- if (!error.isEmpty())
+ CppQmlTypesLoader::BuiltinObjects newObjects;
+ QList<ModuleApiInfo> newModuleApis;
+ CppQmlTypesLoader::parseQmlTypeDescriptions(reader.data(), &newObjects, &newModuleApis, &error, &warning);
+ if (!error.isEmpty()) {
errors += tr("Failed to parse '%1'.\nError: %2").arg(qmltypesFilePath, error);
+ } else {
+ objects += newObjects.values();
+ moduleApis += newModuleApis;
+ }
if (!warning.isEmpty())
warnings += warning;
}
libraryInfo.setMetaObjects(objects);
+ libraryInfo.setModuleApis(moduleApis);
if (errors.isEmpty()) {
libraryInfo.setPluginTypeInfoStatus(LibraryInfo::TypeInfoFileDone);
} else {