QmlJS: Fix import path handling in the model manager.

Previously, the model manager always had exactly one import path - but
you can open more than one Qml project at once. Now, we store the union
of all import paths in the model manager.

Reviewed-by: Roberto Raggi
This commit is contained in:
Christian Kamm
2010-06-22 12:54:19 +02:00
parent eba9157476
commit 16b4e4e91f
5 changed files with 98 additions and 29 deletions

View File

@@ -36,6 +36,11 @@
#include <QObject>
#include <QStringList>
#include <QSharedPointer>
#include <QPointer>
namespace ProjectExplorer {
class Project;
}
namespace QmlJS {
@@ -45,6 +50,32 @@ class QMLJS_EXPORT ModelManagerInterface: public QObject
{
Q_OBJECT
public:
class ProjectInfo
{
public:
ProjectInfo()
{ }
ProjectInfo(QPointer<ProjectExplorer::Project> project)
: project(project)
{ }
operator bool() const
{ return ! project.isNull(); }
bool isValid() const
{ return ! project.isNull(); }
bool isNull() const
{ return project.isNull(); }
public: // attributes
QPointer<ProjectExplorer::Project> project;
QStringList sourceFiles;
QStringList importPaths;
};
public:
ModelManagerInterface(QObject *parent = 0);
virtual ~ModelManagerInterface();
@@ -55,7 +86,10 @@ public:
virtual void fileChangedOnDisk(const QString &path) = 0;
virtual void removeFiles(const QStringList &files) = 0;
virtual void setProjectImportPaths(const QStringList &importPaths) = 0;
virtual QList<ProjectInfo> projectInfos() const = 0;
virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const = 0;
virtual void updateProjectInfo(const ProjectInfo &pinfo) = 0;
virtual QStringList importPaths() const = 0;
signals: