Commit f8c50013 authored by Christian Kamm's avatar Christian Kamm

Remove the QmlJSEditor dependency from Qt4ProjectManager.

The Qt4ProjectManager now uses metacalls to inform the QmlJSModelManager
about the project data.

Done-with: hjk
parent f5c044fe
......@@ -90,6 +90,17 @@ public:
return result;
}
QObject *getObjectByName(const QString &name) const
{
QReadLocker lock(&m_lock);
QList<QObject *> all = allObjects();
foreach (QObject *obj, all) {
if (obj->objectName() == name)
return obj;
}
return 0;
}
// Plugin operations
QList<PluginSpec *> loadQueue();
void loadPlugins();
......
......@@ -38,6 +38,7 @@ ModelManagerInterface::ModelManagerInterface(QObject *parent)
{
Q_ASSERT(! g_instance);
g_instance = this;
setObjectName(MODELMANAGERINTERFACE_OBJECTNAME);
}
ModelManagerInterface::~ModelManagerInterface()
......
......@@ -44,6 +44,8 @@ namespace ProjectExplorer {
namespace QmlJS {
const char *const MODELMANAGERINTERFACE_OBJECTNAME = "QmlJS::ModelManagerInterface";
class Snapshot;
class QMLJS_EXPORT ModelManagerInterface: public QObject
......@@ -89,8 +91,8 @@ public:
virtual void removeFiles(const QStringList &files) = 0;
virtual QList<ProjectInfo> projectInfos() const = 0;
virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const = 0;
virtual void updateProjectInfo(const ProjectInfo &pinfo) = 0;
Q_INVOKABLE virtual QmlJS::ModelManagerInterface::ProjectInfo projectInfo(ProjectExplorer::Project *project) const = 0;
Q_INVOKABLE virtual void updateProjectInfo(const QmlJS::ModelManagerInterface::ProjectInfo &pinfo) = 0;
virtual QStringList importPaths() const = 0;
......
......@@ -126,7 +126,6 @@ plugin_qt4projectmanager.depends = plugin_texteditor
plugin_qt4projectmanager.depends += plugin_projectexplorer
plugin_qt4projectmanager.depends += plugin_cpptools
plugin_qt4projectmanager.depends += plugin_cppeditor
plugin_qt4projectmanager.depends += plugin_qmljseditor
plugin_qt4projectmanager.depends += plugin_designer
plugin_qt4projectmanager.depends += plugin_debugger
plugin_qt4projectmanager.depends += plugin_qmljseditor
......
......@@ -60,7 +60,7 @@ public:
virtual void removeFiles(const QStringList &files);
virtual QList<ProjectInfo> projectInfos() const;
virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const;
virtual QmlJS::ModelManagerInterface::ProjectInfo projectInfo(ProjectExplorer::Project *project) const;
virtual void updateProjectInfo(const ProjectInfo &pinfo);
void emitDocumentUpdated(QmlJS::Document::Ptr doc);
......
......@@ -18,7 +18,6 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General
<dependency name="ProjectExplorer" version="2.0.90"/>
<dependency name="CppTools" version="2.0.90"/>
<dependency name="CppEditor" version="2.0.90"/>
<dependency name="QmlJSEditor" version="2.0.90"/>
<dependency name="Designer" version="2.0.90"/>
<dependency name="Debugger" version="2.0.90"/>
</dependencyList>
......
......@@ -584,11 +584,17 @@ void Qt4Project::updateCppCodeModel()
void Qt4Project::updateQmlJSCodeModel()
{
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
QObject *modelManager =
ExtensionSystem::PluginManager::instance()->getObjectByName(QmlJS::MODELMANAGERINTERFACE_OBJECTNAME);
if (!modelManager)
return;
QmlJS::ModelManagerInterface::ProjectInfo projectInfo = modelManager->projectInfo(this);
QmlJS::ModelManagerInterface::ProjectInfo projectInfo;
bool success = QMetaObject::invokeMethod(
modelManager, "projectInfo", Qt::DirectConnection,
Q_RETURN_ARG(QmlJS::ModelManagerInterface::ProjectInfo, projectInfo),
Q_ARG(ProjectExplorer::Project *, this));
QTC_ASSERT(success, return);
// Not essential since the QmlJS engine parses required files on demand.
//projectInfo.sourceFiles = ...
......@@ -601,7 +607,10 @@ void Qt4Project::updateQmlJSCodeModel()
}
projectInfo.importPaths.removeDuplicates();
modelManager->updateProjectInfo(projectInfo);
success = QMetaObject::invokeMethod(
modelManager, "updateProjectInfo", Qt::DirectConnection,
Q_ARG(QmlJS::ModelManagerInterface::ProjectInfo, projectInfo));
QTC_ASSERT(success, return);
}
void Qt4Project::qtVersionsChanged()
......
include(../../plugins/projectexplorer/projectexplorer.pri)
include(../../plugins/cpptools/cpptools.pri)
include(../../plugins/cppeditor/cppeditor.pri)
include(../../plugins/qmljseditor/qmljseditor.pri)
include(../../plugins/designer/designer.pri)
include(../../plugins/debugger/debugger.pri)
include(../../libs/symbianutils/symbianutils.pri)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment