forked from qt-creator/qt-creator
QmlJS: Allow setting import paths in Qt4Projects using QML_IMPORT_PATH.
Introduced new Creator-specific qmake variable QML_IMPORT_PATH that lists the import paths required by the QmlJS engine. Done-with: Alessandro Portale
This commit is contained in:
@@ -18,6 +18,7 @@ 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>
|
||||
|
||||
@@ -1591,6 +1591,8 @@ void Qt4ProFileNode::applyEvaluate(bool parseResult, bool async)
|
||||
0);
|
||||
newVarValues[LibDirectoriesVar] = libDirectories(m_readerExact);
|
||||
newVarValues[ConfigVar] = m_readerExact->values(QLatin1String("CONFIG"));
|
||||
newVarValues[QmlImportPathVar] = m_readerExact->absolutePathValues(
|
||||
QLatin1String("QML_IMPORT_PATH"), m_projectDir);
|
||||
|
||||
if (m_varValues != newVarValues) {
|
||||
m_varValues = newVarValues;
|
||||
|
||||
@@ -94,7 +94,8 @@ enum Qt4Variable {
|
||||
PkgConfigVar,
|
||||
PrecompiledHeaderVar,
|
||||
LibDirectoriesVar,
|
||||
ConfigVar
|
||||
ConfigVar,
|
||||
QmlImportPathVar
|
||||
};
|
||||
|
||||
class Qt4PriFileNode;
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <cpptools/cppmodelmanagerinterface.h>
|
||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||
#include <projectexplorer/buildenvironmentwidget.h>
|
||||
#include <projectexplorer/customexecutablerunconfiguration.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -318,7 +319,7 @@ bool Qt4Project::fromMap(const QVariantMap &map)
|
||||
update();
|
||||
updateFileList();
|
||||
// This might be incorrect, need a full update
|
||||
updateCodeModel();
|
||||
updateCodeModels();
|
||||
|
||||
createApplicationProjects();
|
||||
|
||||
@@ -395,7 +396,7 @@ bool Qt4Project::equalFileList(const QStringList &a, const QStringList &b)
|
||||
return (ait == aend && bit == bend);
|
||||
}
|
||||
|
||||
void Qt4Project::updateCodeModel()
|
||||
void Qt4Project::updateCodeModels()
|
||||
{
|
||||
if (debug)
|
||||
qDebug()<<"Qt4Project::updateCodeModel()";
|
||||
@@ -403,6 +404,12 @@ void Qt4Project::updateCodeModel()
|
||||
if (!activeTarget() || !activeTarget()->activeBuildConfiguration())
|
||||
return;
|
||||
|
||||
updateCppCodeModel();
|
||||
updateQmlJSCodeModel();
|
||||
}
|
||||
|
||||
void Qt4Project::updateCppCodeModel()
|
||||
{
|
||||
Qt4BuildConfiguration *activeBC = activeTarget()->activeBuildConfiguration();
|
||||
|
||||
CppTools::CppModelManagerInterface *modelmanager =
|
||||
@@ -575,6 +582,28 @@ void Qt4Project::updateCodeModel()
|
||||
}
|
||||
}
|
||||
|
||||
void Qt4Project::updateQmlJSCodeModel()
|
||||
{
|
||||
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
|
||||
if (!modelManager)
|
||||
return;
|
||||
|
||||
QmlJS::ModelManagerInterface::ProjectInfo projectInfo = modelManager->projectInfo(this);
|
||||
|
||||
// Not essential since the QmlJS engine parses required files on demand.
|
||||
//projectInfo.sourceFiles = ...
|
||||
|
||||
FindQt4ProFiles findQt4ProFiles;
|
||||
QList<Qt4ProFileNode *> proFiles = findQt4ProFiles(rootProjectNode());
|
||||
|
||||
foreach (Qt4ProFileNode *node, proFiles) {
|
||||
projectInfo.importPaths.append(node->variableValue(QmlImportPathVar));
|
||||
}
|
||||
projectInfo.importPaths.removeDuplicates();
|
||||
|
||||
modelManager->updateProjectInfo(projectInfo);
|
||||
}
|
||||
|
||||
void Qt4Project::qtVersionsChanged()
|
||||
{
|
||||
setSupportedTargetIds(QtVersionManager::instance()->supportedTargetIds());
|
||||
@@ -751,7 +780,7 @@ void Qt4Project::decrementPendingEvaluateFutures()
|
||||
} else if (m_asyncUpdateState != ShuttingDown){
|
||||
// After beeing done, we need to call:
|
||||
updateFileList();
|
||||
updateCodeModel();
|
||||
updateCodeModels();
|
||||
if (debug)
|
||||
qDebug()<<" Setting state to Base";
|
||||
m_asyncUpdateState = Base;
|
||||
|
||||
@@ -217,7 +217,9 @@ private:
|
||||
void scheduleAsyncUpdate();
|
||||
|
||||
void createApplicationProjects();
|
||||
void updateCodeModel();
|
||||
void updateCodeModels();
|
||||
void updateCppCodeModel();
|
||||
void updateQmlJSCodeModel();
|
||||
void updateFileList();
|
||||
|
||||
static void collectLeafProFiles(QList<Internal::Qt4ProFileNode *> &list, Internal::Qt4ProFileNode *node);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user