Commit 67633523 authored by Fawzi Mohamed's avatar Fawzi Mohamed Committed by hjk
Browse files

qmljs: move defaultProjectInfoForProject to the qmljs library



This removes qmakeprojectmanager and qmlprojectmanager dependency on
qmljstools.
Qmlprojectmanager still imports qmltoolsconstants.h for a constant
but that gives no runtime dependency.

Change-Id: Ifd2e76500a3b27a21937603925f03a70049900e1
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent dd1197aa
......@@ -1399,6 +1399,12 @@ ModelManagerInterface::ProjectInfo ModelManagerInterface::defaultProjectInfo() c
return m_defaultProjectInfo;
}
ModelManagerInterface::ProjectInfo ModelManagerInterface::defaultProjectInfoForProject(
ProjectExplorer::Project *) const
{
return ModelManagerInterface::ProjectInfo();
}
void ModelManagerInterface::setDefaultVContext(const ViewerContext &vContext)
{
QMutexLocker locker(&m_mutex);
......
......@@ -198,6 +198,8 @@ public:
bool autoComplete = true) const;
void setDefaultVContext(const ViewerContext &vContext);
virtual ProjectInfo defaultProjectInfo() const;
virtual ProjectInfo defaultProjectInfoForProject(ProjectExplorer::Project *project) const;
// Blocks until all parsing threads are done. Used for testing.
void joinAllThreads();
......
......@@ -723,7 +723,7 @@ void QbsProject::updateQmlJsCodeModel(const qbs::ProjectData &prj)
return;
QmlJS::ModelManagerInterface::ProjectInfo projectInfo =
QmlJSTools::defaultProjectInfoForProject(this);
modelManager->defaultProjectInfoForProject(this);
setProjectLanguage(ProjectExplorer::Constants::LANG_QMLJS, !projectInfo.sourceFiles.isEmpty());
modelManager->updateProjectInfo(projectInfo, this);
......
......@@ -46,7 +46,7 @@
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/documentmanager.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <qmljstools/qmljsmodelmanager.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/buildtargetinfo.h>
#include <projectexplorer/deploymentdata.h>
......@@ -600,7 +600,7 @@ void QmakeProject::updateQmlJSCodeModel()
return;
QmlJS::ModelManagerInterface::ProjectInfo projectInfo =
QmlJSTools::defaultProjectInfoForProject(this);
modelManager->defaultProjectInfoForProject(this);
FindQmakeProFiles findQt4ProFiles;
QList<QmakeProFileNode *> proFiles = findQt4ProFiles(rootProjectNode());
......
......@@ -15,7 +15,6 @@ QtcPlugin {
Depends { name: "QtSupport" }
Depends { name: "CppTools" }
Depends { name: "TextEditor" }
Depends { name: "QmlJSTools" }
Depends { name: "ResourceEditor" }
Depends { name: "Android" }
......
......@@ -10,7 +10,6 @@ QTC_PLUGIN_DEPENDS += \
qtsupport \
texteditor \
cpptools \
qmljstools \
resourceeditor
QTC_PLUGIN_RECOMMENDS += \
......
......@@ -68,8 +68,8 @@ using namespace QmlJSTools;
using namespace QmlJSTools::Internal;
ModelManagerInterface::ProjectInfo QmlJSTools::defaultProjectInfoForProject(
ProjectExplorer::Project *project)
ModelManagerInterface::ProjectInfo QmlJSTools::Internal::ModelManager::defaultProjectInfoForProject(
ProjectExplorer::Project *project) const
{
ModelManagerInterface::ProjectInfo projectInfo(project);
ProjectExplorer::Target *activeTarget = 0;
......
......@@ -72,6 +72,7 @@ protected:
void writeMessageInternal(const QString &msg) const QTC_OVERRIDE;
WorkingCopy workingCopyInternal() const QTC_OVERRIDE;
void addTaskInternal(QFuture<void> result, const QString &msg, const char *taskId) const QTC_OVERRIDE;
ProjectInfo defaultProjectInfoForProject(ProjectExplorer::Project *project) const QTC_OVERRIDE;
private slots:
void updateDefaultProjectInfo();
private:
......@@ -81,8 +82,6 @@ private:
} // namespace Internal
QMLJSTOOLS_EXPORT QmlJS::ModelManagerInterface::ProjectInfo defaultProjectInfoForProject(
ProjectExplorer::Project *project);
QMLJSTOOLS_EXPORT void setupProjectInfoQmlBundles(QmlJS::ModelManagerInterface::ProjectInfo &projectInfo);
} // namespace QmlJSTools
......
......@@ -41,7 +41,7 @@
#include <coreplugin/documentmanager.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
#include <qmljstools/qmljsmodelmanager.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/target.h>
......@@ -108,7 +108,6 @@ QmlProject::QmlProject(Internal::Manager *manager, const QString &fileName)
: m_manager(manager),
m_fileName(fileName),
m_defaultImport(UnknownImport),
m_modelManager(QmlJS::ModelManagerInterface::instance()),
m_activeTarget(0)
{
setId("QmlProjectManager.QmlProject");
......@@ -210,7 +209,8 @@ void QmlProject::parseProject(RefreshOptions options)
}
if (m_projectItem) {
m_projectItem.data()->setSourceDirectory(projectDir().path());
m_modelManager->updateSourceFiles(m_projectItem.data()->files(), true);
if (modelManager())
modelManager()->updateSourceFiles(m_projectItem.data()->files(), true);
QString mainFilePath = m_projectItem.data()->mainFile();
if (!mainFilePath.isEmpty()) {
......@@ -243,11 +243,14 @@ void QmlProject::refresh(RefreshOptions options)
if (options & Files)
m_rootNode->refresh();
if (!modelManager())
return;
QmlJS::ModelManagerInterface::ProjectInfo projectInfo =
QmlJSTools::defaultProjectInfoForProject(this);
modelManager()->defaultProjectInfoForProject(this);
projectInfo.importPaths = customImportPaths();
m_modelManager->updateProjectInfo(projectInfo, this);
modelManager()->updateProjectInfo(projectInfo, this);
}
QStringList QmlProject::convertToAbsoluteFiles(const QStringList &paths) const
......@@ -262,6 +265,11 @@ QStringList QmlProject::convertToAbsoluteFiles(const QStringList &paths) const
return absolutePaths;
}
QmlJS::ModelManagerInterface *QmlProject::modelManager() const
{
return QmlJS::ModelManagerInterface::instance();
}
QStringList QmlProject::files() const
{
QStringList files;
......@@ -316,8 +324,8 @@ QmlProject::QmlImport QmlProject::defaultImport() const
void QmlProject::refreshFiles(const QSet<QString> &/*added*/, const QSet<QString> &removed)
{
refresh(Files);
if (!removed.isEmpty())
m_modelManager->removeFiles(removed.toList());
if (!removed.isEmpty() && modelManager())
modelManager()->removeFiles(removed.toList());
}
QString QmlProject::displayName() const
......
......@@ -107,13 +107,13 @@ private:
// plain format
void parseProject(RefreshOptions options);
QStringList convertToAbsoluteFiles(const QStringList &paths) const;
QmlJS::ModelManagerInterface *modelManager() const;
Internal::Manager *m_manager;
QString m_fileName;
Internal::QmlProjectFile *m_file;
QString m_projectName;
QmlImport m_defaultImport;
QmlJS::ModelManagerInterface *m_modelManager;
ProjectExplorer::Target *m_activeTarget;
// plain format
......
......@@ -11,7 +11,6 @@ QtcPlugin {
Depends { name: "Core" }
Depends { name: "ProjectExplorer" }
Depends { name: "QmlJSTools" }
Depends { name: "QtSupport" }
Group {
......
......@@ -6,5 +6,4 @@ QTC_LIB_DEPENDS += \
QTC_PLUGIN_DEPENDS += \
coreplugin \
projectexplorer \
qmljstools \
qtsupport
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