1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
36 #include "qmlprojectmanager_global.h"
37 #include "qmlprojectnodes.h"
38 #include "qmlprojectmanager.h"
40 #include <projectexplorer/project.h>
42 #include <QtDeclarative/QDeclarativeEngine>
45 class ModelManagerInterface;
48 namespace ProjectExplorer {
52 namespace QmlProjectManager {
59 class QmlProjectTarget;
60 } // namespace Internal
62 class QMLPROJECTMANAGER_EXPORT QmlProject : public ProjectExplorer::Project
67 QmlProject(Internal::Manager *manager, const QString &filename);
68 virtual ~QmlProject();
70 QString filesFileName() const;
72 QString displayName() const;
74 Core::IFile *file() const;
75 Internal::Manager *projectManager() const;
76 Internal::QmlProjectTarget *activeTarget() const;
78 QList<ProjectExplorer::Project *> dependsOn();
80 QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
82 Internal::QmlProjectNode *rootProjectNode() const;
83 QStringList files(FilesMode fileMode) const;
85 bool validProjectFile() const;
91 Everything = ProjectFile | Files | Configuration
93 Q_DECLARE_FLAGS(RefreshOptions,RefreshOption)
95 void refresh(RefreshOptions options);
97 QDir projectDir() const;
98 QStringList files() const;
99 QString mainFile() const;
100 QStringList importPaths() const;
102 bool addFiles(const QStringList &filePaths);
105 void refreshProjectFile();
106 void refreshFiles(const QSet<QString> &added, const QSet<QString> &removed);
109 bool fromMap(const QVariantMap &map);
113 void parseProject(RefreshOptions options);
114 QStringList convertToAbsoluteFiles(const QStringList &paths) const;
116 Internal::Manager *m_manager;
118 Internal::QmlProjectFile *m_file;
119 QString m_projectName;
120 QmlJS::ModelManagerInterface *m_modelManager;
125 // qml based, new format
126 QDeclarativeEngine m_engine;
127 QWeakPointer<QmlProjectItem> m_projectItem;
128 ProjectExplorer::FileWatcher *m_fileWatcher;
130 Internal::QmlProjectNode *m_rootNode;
133 } // namespace QmlProjectManager
135 Q_DECLARE_OPERATORS_FOR_FLAGS(QmlProjectManager::QmlProject::RefreshOptions)
137 #endif // QMLPROJECT_H