2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-09-04 16:51:11 +02:00
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2009-09-04 16:51:11 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-09-04 16:51:11 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2009-09-04 16:51:11 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2009-09-04 16:51:11 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-09-04 16:51:11 +02:00
|
|
|
|
2010-02-15 13:49:00 +01:00
|
|
|
#ifndef QMLJSMODELMANAGERINTERFACE_H
|
|
|
|
|
#define QMLJSMODELMANAGERINTERFACE_H
|
2009-09-04 16:51:11 +02:00
|
|
|
|
2010-06-09 15:56:03 +02:00
|
|
|
#include "qmljs_global.h"
|
|
|
|
|
#include "qmljsdocument.h"
|
2012-12-06 17:20:58 +01:00
|
|
|
#include "qmljsbundle.h"
|
2009-09-04 16:51:11 +02:00
|
|
|
|
2010-10-26 15:39:37 +02:00
|
|
|
#include <utils/environment.h>
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QObject>
|
|
|
|
|
#include <QStringList>
|
|
|
|
|
#include <QPointer>
|
2010-06-22 12:54:19 +02:00
|
|
|
|
|
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
class Project;
|
|
|
|
|
}
|
2009-09-04 16:51:11 +02:00
|
|
|
|
2010-01-18 16:15:23 +01:00
|
|
|
namespace QmlJS {
|
2010-01-14 16:22:43 +01:00
|
|
|
|
2010-06-09 15:56:03 +02:00
|
|
|
class Snapshot;
|
2010-01-14 16:22:43 +01:00
|
|
|
|
2010-06-09 15:56:03 +02:00
|
|
|
class QMLJS_EXPORT ModelManagerInterface: public QObject
|
2009-09-04 16:51:11 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
2010-06-22 12:54:19 +02:00
|
|
|
public:
|
|
|
|
|
class ProjectInfo
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ProjectInfo()
|
2013-04-24 12:21:21 +02:00
|
|
|
: tryQmlDump(false), qmlDumpHasRelocatableFlag(true)
|
2010-06-22 12:54:19 +02:00
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
ProjectInfo(QPointer<ProjectExplorer::Project> project)
|
|
|
|
|
: project(project)
|
2013-04-24 12:21:21 +02:00
|
|
|
, tryQmlDump(false), qmlDumpHasRelocatableFlag(true)
|
2010-06-22 12:54:19 +02:00
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
operator bool() const
|
|
|
|
|
{ return ! project.isNull(); }
|
|
|
|
|
|
|
|
|
|
bool isValid() const
|
|
|
|
|
{ return ! project.isNull(); }
|
|
|
|
|
|
|
|
|
|
bool isNull() const
|
|
|
|
|
{ return project.isNull(); }
|
|
|
|
|
|
2012-12-06 17:20:58 +01:00
|
|
|
QStringList completeImportPaths();
|
|
|
|
|
|
2010-06-22 12:54:19 +02:00
|
|
|
public: // attributes
|
|
|
|
|
QPointer<ProjectExplorer::Project> project;
|
|
|
|
|
QStringList sourceFiles;
|
|
|
|
|
QStringList importPaths;
|
2011-09-21 15:54:07 +02:00
|
|
|
|
|
|
|
|
// whether trying to run qmldump makes sense
|
|
|
|
|
bool tryQmlDump;
|
2013-04-24 12:21:21 +02:00
|
|
|
bool qmlDumpHasRelocatableFlag;
|
2010-09-27 17:22:57 +02:00
|
|
|
QString qmlDumpPath;
|
2011-10-07 14:04:06 +02:00
|
|
|
::Utils::Environment qmlDumpEnvironment;
|
2011-09-21 15:54:07 +02:00
|
|
|
|
2011-06-28 12:01:56 +02:00
|
|
|
QString qtImportsPath;
|
2012-12-07 09:25:48 +01:00
|
|
|
QString qtQmlPath;
|
2011-06-28 12:01:56 +02:00
|
|
|
QString qtVersionString;
|
2012-12-06 17:20:58 +01:00
|
|
|
QmlJS::QmlLanguageBundles activeBundle;
|
|
|
|
|
QmlJS::QmlLanguageBundles extendedBundle;
|
2010-06-22 12:54:19 +02:00
|
|
|
};
|
|
|
|
|
|
2010-09-24 14:05:34 +02:00
|
|
|
class WorkingCopy
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
typedef QHash<QString, QPair<QString, int> > Table;
|
|
|
|
|
|
|
|
|
|
void insert(const QString &fileName, const QString &source, int revision = 0)
|
|
|
|
|
{ _elements.insert(fileName, qMakePair(source, revision)); }
|
|
|
|
|
|
|
|
|
|
bool contains(const QString &fileName) const
|
|
|
|
|
{ return _elements.contains(fileName); }
|
|
|
|
|
|
|
|
|
|
QString source(const QString &fileName) const
|
|
|
|
|
{ return _elements.value(fileName).first; }
|
|
|
|
|
|
|
|
|
|
QPair<QString, int> get(const QString &fileName) const
|
|
|
|
|
{ return _elements.value(fileName); }
|
|
|
|
|
|
|
|
|
|
Table all() const
|
|
|
|
|
{ return _elements; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Table _elements;
|
|
|
|
|
};
|
|
|
|
|
|
2011-08-25 12:35:55 +02:00
|
|
|
class CppData
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QList<LanguageUtils::FakeMetaObject::ConstPtr> exportedTypes;
|
2011-09-16 10:35:48 +02:00
|
|
|
QHash<QString, QString> contextProperties;
|
2011-08-25 12:35:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef QHash<QString, CppData> CppDataHash;
|
2011-01-06 10:01:45 +01:00
|
|
|
|
2009-09-04 16:51:11 +02:00
|
|
|
public:
|
2010-02-15 13:49:00 +01:00
|
|
|
ModelManagerInterface(QObject *parent = 0);
|
|
|
|
|
virtual ~ModelManagerInterface();
|
2009-09-04 16:51:11 +02:00
|
|
|
|
2010-07-08 14:38:47 +02:00
|
|
|
static ModelManagerInterface *instance();
|
|
|
|
|
|
2010-09-24 14:05:34 +02:00
|
|
|
virtual WorkingCopy workingCopy() const = 0;
|
2011-08-30 09:19:56 +02:00
|
|
|
|
|
|
|
|
virtual QmlJS::Snapshot snapshot() const = 0;
|
|
|
|
|
virtual QmlJS::Snapshot newestSnapshot() const = 0;
|
2010-09-24 14:05:34 +02:00
|
|
|
|
2010-04-16 13:08:59 +02:00
|
|
|
virtual void updateSourceFiles(const QStringList &files,
|
|
|
|
|
bool emitDocumentOnDiskChanged) = 0;
|
2010-04-16 12:42:12 +02:00
|
|
|
virtual void fileChangedOnDisk(const QString &path) = 0;
|
2010-05-18 13:40:35 +02:00
|
|
|
virtual void removeFiles(const QStringList &files) = 0;
|
2010-03-16 16:34:33 +01:00
|
|
|
|
2010-06-22 12:54:19 +02:00
|
|
|
virtual QList<ProjectInfo> projectInfos() const = 0;
|
2010-09-27 11:16:43 +01:00
|
|
|
virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const = 0;
|
|
|
|
|
virtual void updateProjectInfo(const ProjectInfo &pinfo) = 0;
|
2011-08-26 13:31:18 +02:00
|
|
|
Q_SLOT virtual void removeProjectInfo(ProjectExplorer::Project *project) = 0;
|
2012-12-06 17:20:58 +01:00
|
|
|
virtual ProjectInfo projectInfoForPath(QString path) = 0;
|
2010-06-22 12:54:19 +02:00
|
|
|
|
2010-03-16 16:34:33 +01:00
|
|
|
virtual QStringList importPaths() const = 0;
|
2012-12-06 17:20:58 +01:00
|
|
|
virtual QmlJS::QmlLanguageBundles activeBundles() const = 0;
|
|
|
|
|
virtual QmlJS::QmlLanguageBundles extendedBundles() const = 0;
|
2009-11-11 10:10:00 +01:00
|
|
|
|
2011-02-08 13:29:21 +01:00
|
|
|
virtual void loadPluginTypes(const QString &libraryPath, const QString &importPath,
|
|
|
|
|
const QString &importUri, const QString &importVersion) = 0;
|
2010-08-25 14:15:57 +02:00
|
|
|
|
2011-08-25 12:35:55 +02:00
|
|
|
virtual CppDataHash cppData() const = 0;
|
2011-06-28 12:01:56 +02:00
|
|
|
|
|
|
|
|
virtual LibraryInfo builtins(const Document::Ptr &doc) const = 0;
|
2011-01-06 10:01:45 +01:00
|
|
|
|
2011-07-12 11:11:26 +02:00
|
|
|
// Blocks until all parsing threads are done. Used for testing.
|
|
|
|
|
virtual void joinAllThreads() = 0;
|
|
|
|
|
|
2011-06-23 15:12:03 +02:00
|
|
|
public slots:
|
|
|
|
|
virtual void resetCodeModel() = 0;
|
|
|
|
|
|
2009-11-11 10:10:00 +01:00
|
|
|
signals:
|
2010-01-18 16:15:23 +01:00
|
|
|
void documentUpdated(QmlJS::Document::Ptr doc);
|
2010-04-16 12:42:12 +02:00
|
|
|
void documentChangedOnDisk(QmlJS::Document::Ptr doc);
|
|
|
|
|
void aboutToRemoveFiles(const QStringList &files);
|
2010-10-15 10:09:40 +02:00
|
|
|
void libraryInfoUpdated(const QString &path, const QmlJS::LibraryInfo &info);
|
2011-04-21 11:09:29 +02:00
|
|
|
void projectInfoUpdated(const ProjectInfo &pinfo);
|
2009-09-04 16:51:11 +02:00
|
|
|
};
|
|
|
|
|
|
2010-06-09 15:56:03 +02:00
|
|
|
} // namespace QmlJS
|
2009-09-04 16:51:11 +02:00
|
|
|
|
2010-02-15 13:49:00 +01:00
|
|
|
#endif // QMLJSMODELMANAGERINTERFACE_H
|