diff options
author | Christian Kamm <[email protected]> | 2011-02-08 13:22:34 +0100 |
---|---|---|
committer | Christian Kamm <[email protected]> | 2011-02-09 10:42:49 +0100 |
commit | 2ec429e8ce7df1a017c63405442a36dd261142ac (patch) | |
tree | 03006490d7a1b6da3ea00e09d41ba9ba85be6996 /src/plugins/qmljstools/qmljsplugindumper.cpp | |
parent | dd1de1b82f9f8681aec14bc4266bb1d68d11c4fd (diff) |
QmlJS: Switch to new format for QML meta data.
Diffstat (limited to 'src/plugins/qmljstools/qmljsplugindumper.cpp')
-rw-r--r-- | src/plugins/qmljstools/qmljsplugindumper.cpp | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/plugins/qmljstools/qmljsplugindumper.cpp b/src/plugins/qmljstools/qmljsplugindumper.cpp index aca066f1cfb..28db6304f32 100644 --- a/src/plugins/qmljstools/qmljsplugindumper.cpp +++ b/src/plugins/qmljstools/qmljsplugindumper.cpp @@ -96,8 +96,8 @@ void PluginDumper::onLoadPluginTypes(const QString &libraryPath, const QString & } // watch library xml file - if (plugin.hasPredumpedXmlFile()) { - const QString &path = plugin.predumpedXmlFilePath(); + if (plugin.hasPredumpedQmlTypesFile()) { + const QString &path = plugin.predumpedQmlTypesFilePath(); m_pluginWatcher->addFile(path); m_libraryToPluginIndex.insert(path, index); } @@ -134,15 +134,15 @@ static QString qmldumpFailedMessage(const QString &error) ).arg(firstLines); } -static QList<FakeMetaObject::ConstPtr> parseHelper(const QByteArray &xml, QString *error) +static QList<FakeMetaObject::ConstPtr> parseHelper(const QByteArray &qmlTypeDescriptions, QString *error) { QList<FakeMetaObject::ConstPtr> ret; - QMap<QString, FakeMetaObject::Ptr> newObjects; - *error = Interpreter::CppQmlTypesLoader::parseQmlTypeXml(xml, &newObjects); + QHash<QString, FakeMetaObject::Ptr> newObjects; + *error = Interpreter::CppQmlTypesLoader::parseQmlTypeDescriptions(qmlTypeDescriptions, &newObjects); if (error->isEmpty()) { // convert from QList<T *> to QList<const T *> - QMapIterator<QString, FakeMetaObject::Ptr> it(newObjects); + QHashIterator<QString, FakeMetaObject::Ptr> it(newObjects); while (it.hasNext()) { it.next(); ret.append(it.value()); @@ -178,8 +178,9 @@ void PluginDumper::qmlPluginTypeDumpDone(int exitCode) if (exitCode == 0 && error.isEmpty()) { libraryInfo.setMetaObjects(objectsList); - if (libraryPath.isEmpty()) - Interpreter::CppQmlTypesLoader::builtinObjects.append(objectsList); +// ### disabled code path for running qmldump to get Qt's builtins +// if (libraryPath.isEmpty()) +// Interpreter::CppQmlTypesLoader::builtinObjects.append(objectsList); libraryInfo.setDumpStatus(LibraryInfo::DumpDone); } @@ -220,26 +221,26 @@ void PluginDumper::pluginChanged(const QString &pluginLibrary) void PluginDumper::dump(const Plugin &plugin) { - if (plugin.hasPredumpedXmlFile()) { + if (plugin.hasPredumpedQmlTypesFile()) { const Snapshot snapshot = m_modelManager->snapshot(); LibraryInfo libraryInfo = snapshot.libraryInfo(plugin.qmldirPath); if (!libraryInfo.isValid()) return; - const QString &path = plugin.predumpedXmlFilePath(); - QFile libraryXmlFile(path); - if (!libraryXmlFile.open(QFile::ReadOnly | QFile::Text)) { + const QString &path = plugin.predumpedQmlTypesFilePath(); + QFile libraryQmlTypesFile(path); + if (!libraryQmlTypesFile.open(QFile::ReadOnly | QFile::Text)) { libraryInfo.setDumpStatus(LibraryInfo::DumpError, tr("Could not open file '%1' for reading.").arg(path)); m_modelManager->updateLibraryInfo(plugin.qmldirPath, libraryInfo); return; } - const QByteArray xml = libraryXmlFile.readAll(); - libraryXmlFile.close(); + const QByteArray qmlTypeDescriptions = libraryQmlTypesFile.readAll(); + libraryQmlTypesFile.close(); QString error; - const QList<FakeMetaObject::ConstPtr> objectsList = parseHelper(xml, &error); + const QList<FakeMetaObject::ConstPtr> objectsList = parseHelper(qmlTypeDescriptions, &error); if (error.isEmpty()) { libraryInfo.setMetaObjects(objectsList); @@ -390,12 +391,12 @@ QString PluginDumper::resolvePlugin(const QDir &qmldirPath, const QString &qmldi #endif } -bool PluginDumper::Plugin::hasPredumpedXmlFile() const +bool PluginDumper::Plugin::hasPredumpedQmlTypesFile() const { - return QFileInfo(predumpedXmlFilePath()).isFile(); + return QFileInfo(predumpedQmlTypesFilePath()).isFile(); } -QString PluginDumper::Plugin::predumpedXmlFilePath() const +QString PluginDumper::Plugin::predumpedQmlTypesFilePath() const { - return QString("%1%2library.xml").arg(qmldirPath, QDir::separator()); + return QString("%1%2plugins.qmltypes").arg(qmldirPath, QDir::separator()); } |