forked from qt-creator/qt-creator
qmljs: better defaults, more uniform handling of paths
Uniform handling of the different qml dialects. Now paths for a given document prefer the project of that document. For Qt the following sequence is used: - Qt of the project of the document - Qt of the active target - Qt used to run creator Currently all paths of the open projects are still merged, but that can be changed. Change-Id: Id302c13c893b66fbfe24e301602fe69de152eed4 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
@@ -61,6 +61,8 @@
|
||||
#include <QTimer>
|
||||
#include <QRegExp>
|
||||
#include <QtAlgorithms>
|
||||
#include <QLibraryInfo>
|
||||
#include <qglobal.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@@ -87,8 +89,8 @@ ModelManagerInterface::ProjectInfo QmlJSTools::defaultProjectInfoForProject(
|
||||
globs.append(MimeGlobPattern(QLatin1String("*.qmltypes")));
|
||||
globs.append(MimeGlobPattern(QLatin1String("*.qmlproject")));
|
||||
}
|
||||
foreach (const QString &filePath
|
||||
, project->files(ProjectExplorer::Project::ExcludeGeneratedFiles))
|
||||
foreach (const QString &filePath,
|
||||
project->files(ProjectExplorer::Project::ExcludeGeneratedFiles))
|
||||
foreach (const MimeGlobPattern &glob, globs)
|
||||
if (glob.matches(filePath))
|
||||
projectInfo.sourceFiles << filePath;
|
||||
@@ -117,6 +119,12 @@ ModelManagerInterface::ProjectInfo QmlJSTools::defaultProjectInfoForProject(
|
||||
projectInfo.qtQmlPath = qtVersion->qmakeProperty("QT_INSTALL_QML");
|
||||
projectInfo.qtImportsPath = qtVersion->qmakeProperty("QT_INSTALL_IMPORTS");
|
||||
projectInfo.qtVersionString = qtVersion->qtVersionString();
|
||||
} else {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
projectInfo.qtQmlPath = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
|
||||
#endif
|
||||
projectInfo.qtImportsPath = QLibraryInfo::location(QLibraryInfo::ImportsPath);
|
||||
projectInfo.qtVersionString = QLatin1String(qVersion());
|
||||
}
|
||||
|
||||
if (projectInfo.tryQmlDump) {
|
||||
@@ -251,11 +259,9 @@ ModelManagerInterface::WorkingCopy ModelManager::workingCopyInternal() const
|
||||
|
||||
ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfo() const
|
||||
{
|
||||
ProjectExplorer::Project *activeProject = ProjectExplorer::SessionManager::startupProject();
|
||||
if (!activeProject)
|
||||
return ModelManagerInterface::ProjectInfo();
|
||||
|
||||
return projectInfo(activeProject);
|
||||
// needs to be performed in the ui therad (change?)
|
||||
ProjectExplorer::Project *currentProject = ProjectExplorer::ProjectExplorerPlugin::currentProject();
|
||||
return defaultProjectInfoForProject(currentProject);
|
||||
}
|
||||
|
||||
// Check whether fileMimeType is the same or extends knownMimeType
|
||||
@@ -279,4 +285,3 @@ void ModelManager::addTaskInternal(QFuture<void> result, const QString &msg, con
|
||||
{
|
||||
ProgressManager::addTask(result, msg, taskId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user