QmlJS: Fix running qmldump on plugins that require a specific uri.

The builtin QML plugins require to be imported with the full uri, i.e.
import Qt.labs.particles 1.0
so setting the import path to imports/Qt/labs and doing
import particles 1.0
is not supposed to work. (see QTBUG-11139)

This change adjusts qmldump to take an import path *and* the import uri,
so it will be able to dump the type information for these plugins.

Reviewed-by: Erik Verbruggen
This commit is contained in:
Christian Kamm
2010-08-25 14:15:57 +02:00
parent 6cf563bb25
commit 36e8b65d59
5 changed files with 47 additions and 23 deletions

View File

@@ -228,9 +228,6 @@ void ModelManager::onLibraryInfoUpdated(const QString &path, const LibraryInfo &
{
QMutexLocker locker(&m_mutex);
if (!_snapshot.libraryInfo(path).isValid())
loadQmlPluginTypes(path);
_snapshot.insertLibraryInfo(path, info);
}
@@ -453,8 +450,20 @@ static QStringList environmentImportPaths()
return paths;
}
void ModelManager::loadQmlPluginTypes(const QString &pluginPath)
void ModelManager::loadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri)
{
// make sure loading is always triggered in ModelManager's thread
metaObject()->invokeMethod(this, "onLoadPluginTypes",
Q_ARG(QString, libraryPath),
Q_ARG(QString, importPath),
Q_ARG(QString, importUri));
}
void ModelManager::onLoadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri)
{
if (m_runningQmldumps.values().contains(libraryPath))
return;
static QString qmldumpPath;
if (qmldumpPath.isNull()) {
QDir qmldumpExecutable(QCoreApplication::applicationDirPath());
@@ -482,8 +491,11 @@ void ModelManager::loadQmlPluginTypes(const QString &pluginPath)
QProcess *process = new QProcess(this);
connect(process, SIGNAL(finished(int)), SLOT(qmlPluginTypeDumpDone(int)));
process->start(qmldumpPath, QStringList(pluginPath));
m_runningQmldumps.insert(process, pluginPath);
QStringList args;
args << importPath;
args << importUri;
process->start(qmldumpPath, args);
m_runningQmldumps.insert(process, libraryPath);
}
void ModelManager::updateImportPaths()

View File

@@ -69,6 +69,8 @@ public:
virtual QStringList importPaths() const;
virtual void loadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri);
Q_SIGNALS:
void projectPathChanged(const QString &projectPath);
void libraryInfoUpdated(const QString &path, const QmlJS::LibraryInfo &info);
@@ -77,6 +79,7 @@ private Q_SLOTS:
// this should be executed in the GUI thread.
void onDocumentUpdated(QmlJS::Document::Ptr doc);
void onLibraryInfoUpdated(const QString &path, const QmlJS::LibraryInfo &info);
void onLoadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri);
void qmlPluginTypeDumpDone(int exitCode);
protected:
@@ -98,7 +101,6 @@ protected:
bool emitDocChangedOnDisk);
void loadQmlTypeDescriptions();
void loadQmlPluginTypes(const QString &pluginPath);
void updateImportPaths();