forked from qt-creator/qt-creator
Qml: Write qmldump errors to 'General messages'.
This should make it easier to debug problems with Qml plugin type dumping. Reviewed-by: Roberto Raggi
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
#include <coreplugin/progressmanager/progressmanager.h>
|
||||||
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
#include <coreplugin/mimedatabase.h>
|
||||||
#include <qmljs/qmljsinterpreter.h>
|
#include <qmljs/qmljsinterpreter.h>
|
||||||
#include <qmljs/qmljsbind.h>
|
#include <qmljs/qmljsbind.h>
|
||||||
@@ -497,6 +498,7 @@ void ModelManager::onLoadPluginTypes(const QString &libraryPath, const QString &
|
|||||||
|
|
||||||
QProcess *process = new QProcess(this);
|
QProcess *process = new QProcess(this);
|
||||||
connect(process, SIGNAL(finished(int)), SLOT(qmlPluginTypeDumpDone(int)));
|
connect(process, SIGNAL(finished(int)), SLOT(qmlPluginTypeDumpDone(int)));
|
||||||
|
connect(process, SIGNAL(error(QProcess::ProcessError)), SLOT(qmlPluginTypeDumpError(QProcess::ProcessError)));
|
||||||
QStringList args;
|
QStringList args;
|
||||||
args << importPath;
|
args << importPath;
|
||||||
args << importUri;
|
args << importUri;
|
||||||
@@ -525,14 +527,25 @@ void ModelManager::updateImportPaths()
|
|||||||
updateSourceFiles(importedFiles, true);
|
updateSourceFiles(importedFiles, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString qmldumpErrorMessage(const QString &libraryPath, const QString &error)
|
||||||
|
{
|
||||||
|
return ModelManager::tr("Type dump of QML plugin in %0 failed.\nErrors:\n%1\n").arg(libraryPath, error);
|
||||||
|
}
|
||||||
|
|
||||||
void ModelManager::qmlPluginTypeDumpDone(int exitCode)
|
void ModelManager::qmlPluginTypeDumpDone(int exitCode)
|
||||||
{
|
{
|
||||||
QProcess *process = qobject_cast<QProcess *>(sender());
|
QProcess *process = qobject_cast<QProcess *>(sender());
|
||||||
if (!process)
|
if (!process)
|
||||||
return;
|
return;
|
||||||
process->deleteLater();
|
process->deleteLater();
|
||||||
if (exitCode != 0)
|
|
||||||
|
const QString libraryPath = m_runningQmldumps.take(process);
|
||||||
|
|
||||||
|
if (exitCode != 0) {
|
||||||
|
Core::MessageManager *messageManager = Core::MessageManager::instance();
|
||||||
|
messageManager->printToOutputPane(qmldumpErrorMessage(libraryPath, process->readAllStandardError()));
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const QByteArray output = process->readAllStandardOutput();
|
const QByteArray output = process->readAllStandardOutput();
|
||||||
QMap<QString, Interpreter::FakeMetaObject *> newObjects;
|
QMap<QString, Interpreter::FakeMetaObject *> newObjects;
|
||||||
@@ -548,8 +561,6 @@ void ModelManager::qmlPluginTypeDumpDone(int exitCode)
|
|||||||
objectsList.append(it.value());
|
objectsList.append(it.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString libraryPath = m_runningQmldumps.take(process);
|
|
||||||
|
|
||||||
QMutexLocker locker(&m_mutex);
|
QMutexLocker locker(&m_mutex);
|
||||||
|
|
||||||
if (!libraryPath.isEmpty()) {
|
if (!libraryPath.isEmpty()) {
|
||||||
@@ -560,3 +571,16 @@ void ModelManager::qmlPluginTypeDumpDone(int exitCode)
|
|||||||
Interpreter::CppQmlTypesLoader::builtinObjects.append(objectsList);
|
Interpreter::CppQmlTypesLoader::builtinObjects.append(objectsList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModelManager::qmlPluginTypeDumpError(QProcess::ProcessError)
|
||||||
|
{
|
||||||
|
QProcess *process = qobject_cast<QProcess *>(sender());
|
||||||
|
if (!process)
|
||||||
|
return;
|
||||||
|
process->deleteLater();
|
||||||
|
|
||||||
|
const QString libraryPath = m_runningQmldumps.take(process);
|
||||||
|
|
||||||
|
Core::MessageManager *messageManager = Core::MessageManager::instance();
|
||||||
|
messageManager->printToOutputPane(qmldumpErrorMessage(libraryPath, process->readAllStandardError()));
|
||||||
|
}
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ private Q_SLOTS:
|
|||||||
void onLibraryInfoUpdated(const QString &path, const QmlJS::LibraryInfo &info);
|
void onLibraryInfoUpdated(const QString &path, const QmlJS::LibraryInfo &info);
|
||||||
void onLoadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri);
|
void onLoadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri);
|
||||||
void qmlPluginTypeDumpDone(int exitCode);
|
void qmlPluginTypeDumpDone(int exitCode);
|
||||||
|
void qmlPluginTypeDumpError(QProcess::ProcessError error);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct WorkingCopy
|
struct WorkingCopy
|
||||||
|
|||||||
@@ -63,11 +63,13 @@ void processObject(QObject *object, QSet<const QMetaObject *> *metas)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const QMetaObject *meta = object->metaObject();
|
const QMetaObject *meta = object->metaObject();
|
||||||
|
qDebug() << "Processing object" << meta->className();
|
||||||
processMetaObject(meta, metas);
|
processMetaObject(meta, metas);
|
||||||
|
|
||||||
for (int index = 0; index < meta->propertyCount(); ++index) {
|
for (int index = 0; index < meta->propertyCount(); ++index) {
|
||||||
QMetaProperty prop = meta->property(index);
|
QMetaProperty prop = meta->property(index);
|
||||||
if (QDeclarativeMetaType::isQObject(prop.userType())) {
|
if (QDeclarativeMetaType::isQObject(prop.userType())) {
|
||||||
|
qDebug() << " Processing property" << prop.name();
|
||||||
QObject *oo = QDeclarativeMetaType::toQObject(prop.read(object));
|
QObject *oo = QDeclarativeMetaType::toQObject(prop.read(object));
|
||||||
if (oo && !metas->contains(oo->metaObject()))
|
if (oo && !metas->contains(oo->metaObject()))
|
||||||
processObject(oo, metas);
|
processObject(oo, metas);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
TARGET = qmldump
|
TARGET = qmldump
|
||||||
QT += declarative
|
QT += declarative
|
||||||
|
CONFIG += console
|
||||||
|
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user