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:
Fawzi Mohamed
2014-04-11 23:07:52 +02:00
parent 7206c0b020
commit 58489e50a8
9 changed files with 226 additions and 83 deletions

View File

@@ -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);
}