forked from qt-creator/qt-creator
Remove the QmlJSEditor dependency from Qt4ProjectManager.
The Qt4ProjectManager now uses metacalls to inform the QmlJSModelManager about the project data. Done-with: hjk
This commit is contained in:
@@ -90,6 +90,17 @@ public:
|
|||||||
return result;
|
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
|
// Plugin operations
|
||||||
QList<PluginSpec *> loadQueue();
|
QList<PluginSpec *> loadQueue();
|
||||||
void loadPlugins();
|
void loadPlugins();
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ ModelManagerInterface::ModelManagerInterface(QObject *parent)
|
|||||||
{
|
{
|
||||||
Q_ASSERT(! g_instance);
|
Q_ASSERT(! g_instance);
|
||||||
g_instance = this;
|
g_instance = this;
|
||||||
|
setObjectName(MODELMANAGERINTERFACE_OBJECTNAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelManagerInterface::~ModelManagerInterface()
|
ModelManagerInterface::~ModelManagerInterface()
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ namespace ProjectExplorer {
|
|||||||
|
|
||||||
namespace QmlJS {
|
namespace QmlJS {
|
||||||
|
|
||||||
|
const char *const MODELMANAGERINTERFACE_OBJECTNAME = "QmlJS::ModelManagerInterface";
|
||||||
|
|
||||||
class Snapshot;
|
class Snapshot;
|
||||||
|
|
||||||
class QMLJS_EXPORT ModelManagerInterface: public QObject
|
class QMLJS_EXPORT ModelManagerInterface: public QObject
|
||||||
@@ -89,8 +91,8 @@ public:
|
|||||||
virtual void removeFiles(const QStringList &files) = 0;
|
virtual void removeFiles(const QStringList &files) = 0;
|
||||||
|
|
||||||
virtual QList<ProjectInfo> projectInfos() const = 0;
|
virtual QList<ProjectInfo> projectInfos() const = 0;
|
||||||
virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const = 0;
|
Q_INVOKABLE virtual QmlJS::ModelManagerInterface::ProjectInfo projectInfo(ProjectExplorer::Project *project) const = 0;
|
||||||
virtual void updateProjectInfo(const ProjectInfo &pinfo) = 0;
|
Q_INVOKABLE virtual void updateProjectInfo(const QmlJS::ModelManagerInterface::ProjectInfo &pinfo) = 0;
|
||||||
|
|
||||||
virtual QStringList importPaths() const = 0;
|
virtual QStringList importPaths() const = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,6 @@ plugin_qt4projectmanager.depends = plugin_texteditor
|
|||||||
plugin_qt4projectmanager.depends += plugin_projectexplorer
|
plugin_qt4projectmanager.depends += plugin_projectexplorer
|
||||||
plugin_qt4projectmanager.depends += plugin_cpptools
|
plugin_qt4projectmanager.depends += plugin_cpptools
|
||||||
plugin_qt4projectmanager.depends += plugin_cppeditor
|
plugin_qt4projectmanager.depends += plugin_cppeditor
|
||||||
plugin_qt4projectmanager.depends += plugin_qmljseditor
|
|
||||||
plugin_qt4projectmanager.depends += plugin_designer
|
plugin_qt4projectmanager.depends += plugin_designer
|
||||||
plugin_qt4projectmanager.depends += plugin_debugger
|
plugin_qt4projectmanager.depends += plugin_debugger
|
||||||
plugin_qt4projectmanager.depends += plugin_qmljseditor
|
plugin_qt4projectmanager.depends += plugin_qmljseditor
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public:
|
|||||||
virtual void removeFiles(const QStringList &files);
|
virtual void removeFiles(const QStringList &files);
|
||||||
|
|
||||||
virtual QList<ProjectInfo> projectInfos() const;
|
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);
|
virtual void updateProjectInfo(const ProjectInfo &pinfo);
|
||||||
|
|
||||||
void emitDocumentUpdated(QmlJS::Document::Ptr doc);
|
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="ProjectExplorer" version="2.0.90"/>
|
||||||
<dependency name="CppTools" version="2.0.90"/>
|
<dependency name="CppTools" version="2.0.90"/>
|
||||||
<dependency name="CppEditor" 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="Designer" version="2.0.90"/>
|
||||||
<dependency name="Debugger" version="2.0.90"/>
|
<dependency name="Debugger" version="2.0.90"/>
|
||||||
</dependencyList>
|
</dependencyList>
|
||||||
|
|||||||
@@ -584,11 +584,17 @@ void Qt4Project::updateCppCodeModel()
|
|||||||
|
|
||||||
void Qt4Project::updateQmlJSCodeModel()
|
void Qt4Project::updateQmlJSCodeModel()
|
||||||
{
|
{
|
||||||
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
|
QObject *modelManager =
|
||||||
|
ExtensionSystem::PluginManager::instance()->getObjectByName(QmlJS::MODELMANAGERINTERFACE_OBJECTNAME);
|
||||||
if (!modelManager)
|
if (!modelManager)
|
||||||
return;
|
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.
|
// Not essential since the QmlJS engine parses required files on demand.
|
||||||
//projectInfo.sourceFiles = ...
|
//projectInfo.sourceFiles = ...
|
||||||
@@ -601,7 +607,10 @@ void Qt4Project::updateQmlJSCodeModel()
|
|||||||
}
|
}
|
||||||
projectInfo.importPaths.removeDuplicates();
|
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()
|
void Qt4Project::qtVersionsChanged()
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
include(../../plugins/projectexplorer/projectexplorer.pri)
|
include(../../plugins/projectexplorer/projectexplorer.pri)
|
||||||
include(../../plugins/cpptools/cpptools.pri)
|
include(../../plugins/cpptools/cpptools.pri)
|
||||||
include(../../plugins/cppeditor/cppeditor.pri)
|
include(../../plugins/cppeditor/cppeditor.pri)
|
||||||
include(../../plugins/qmljseditor/qmljseditor.pri)
|
|
||||||
include(../../plugins/designer/designer.pri)
|
include(../../plugins/designer/designer.pri)
|
||||||
include(../../plugins/debugger/debugger.pri)
|
include(../../plugins/debugger/debugger.pri)
|
||||||
include(../../libs/symbianutils/symbianutils.pri)
|
include(../../libs/symbianutils/symbianutils.pri)
|
||||||
|
|||||||
Reference in New Issue
Block a user