1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
37 #include "qmlprojectmanager_global.h"
38 #include "qmlprojectnodes.h"
39 #include "qmlprojectmanager.h"
41 #include <projectexplorer/project.h>
43 #include <QtDeclarative/QDeclarativeEngine>
46 class ModelManagerInterface;
49 namespace ProjectExplorer {
53 namespace QmlProjectManager {
60 class QmlProjectTarget;
61 } // namespace Internal
63 class QMLPROJECTMANAGER_EXPORT QmlProject : public ProjectExplorer::Project
68 QmlProject(Internal::Manager *manager, const QString &filename);
69 virtual ~QmlProject();
71 QString filesFileName() const;
73 QString displayName() const;
75 Core::IFile *file() const;
76 Internal::Manager *projectManager() const;
77 Internal::QmlProjectTarget *activeTarget() const;
79 QList<ProjectExplorer::Project *> dependsOn();
81 QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
83 Internal::QmlProjectNode *rootProjectNode() const;
84 QStringList files(FilesMode fileMode) const;
86 bool validProjectFile() const;
92 Everything = ProjectFile | Files | Configuration
94 Q_DECLARE_FLAGS(RefreshOptions,RefreshOption)
96 void refresh(RefreshOptions options);
98 QDir projectDir() const;
99 QStringList files() const;
100 QString mainFile() const;
101 QStringList importPaths() const;
103 bool addFiles(const QStringList &filePaths);
106 void refreshProjectFile();
107 void refreshFiles(const QSet<QString> &added, const QSet<QString> &removed);
110 bool fromMap(const QVariantMap &map);
114 void parseProject(RefreshOptions options);
115 QStringList convertToAbsoluteFiles(const QStringList &paths) const;
117 Internal::Manager *m_manager;
119 Internal::QmlProjectFile *m_file;
120 QString m_projectName;
121 QmlJS::ModelManagerInterface *m_modelManager;
126 // qml based, new format
127 QDeclarativeEngine m_engine;
128 QWeakPointer<QmlProjectItem> m_projectItem;
129 ProjectExplorer::FileWatcher *m_fileWatcher;
131 Internal::QmlProjectNode *m_rootNode;
134 } // namespace QmlProjectManager
136 Q_DECLARE_OPERATORS_FOR_FLAGS(QmlProjectManager::QmlProject::RefreshOptions)
138 #endif // QMLPROJECT_H