2009-05-04 12:19:22 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** 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-05-04 12:19:22 +02:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef QMLPROJECT_H
|
|
|
|
|
#define QMLPROJECT_H
|
|
|
|
|
|
2010-01-12 16:56:36 +01:00
|
|
|
#include "qmlprojectmanager_global.h"
|
2009-05-04 12:19:22 +02:00
|
|
|
|
|
|
|
|
#include <projectexplorer/project.h>
|
|
|
|
|
|
2010-02-26 14:46:04 +01:00
|
|
|
#include <QtDeclarative/QDeclarativeEngine>
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2010-06-09 15:56:03 +02:00
|
|
|
namespace QmlJS {
|
2010-02-15 13:49:00 +01:00
|
|
|
class ModelManagerInterface;
|
2009-09-04 17:54:38 +02:00
|
|
|
}
|
|
|
|
|
|
2011-04-15 15:55:11 +02:00
|
|
|
namespace Utils {
|
|
|
|
|
class FileSystemWatcher;
|
2010-02-16 13:39:13 +01:00
|
|
|
}
|
2009-12-16 16:39:39 +01:00
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
namespace QmlProjectManager {
|
2009-12-16 16:39:39 +01:00
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
class QmlProjectItem;
|
2009-12-16 16:39:39 +01:00
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
namespace Internal {
|
2011-08-18 16:46:26 +02:00
|
|
|
class Manager;
|
2010-02-16 13:39:13 +01:00
|
|
|
class QmlProjectFile;
|
2011-01-20 14:03:07 +01:00
|
|
|
class QmlProjectTarget;
|
2011-08-18 16:46:26 +02:00
|
|
|
class QmlProjectNode;
|
2009-05-04 12:19:22 +02:00
|
|
|
} // namespace Internal
|
2010-01-12 16:56:36 +01:00
|
|
|
|
|
|
|
|
class QMLPROJECTMANAGER_EXPORT QmlProject : public ProjectExplorer::Project
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
QmlProject(Internal::Manager *manager, const QString &filename);
|
|
|
|
|
virtual ~QmlProject();
|
|
|
|
|
|
|
|
|
|
QString filesFileName() const;
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
QString displayName() const;
|
|
|
|
|
QString id() const;
|
|
|
|
|
Core::IFile *file() const;
|
2011-08-18 16:46:26 +02:00
|
|
|
ProjectExplorer::IProjectManager *projectManager() const;
|
2010-02-16 13:39:13 +01:00
|
|
|
Internal::QmlProjectTarget *activeTarget() const;
|
2010-01-12 16:56:36 +01:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
QList<ProjectExplorer::Project *> dependsOn();
|
2010-01-12 16:56:36 +01:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
2010-01-12 16:56:36 +01:00
|
|
|
|
2011-08-18 16:46:26 +02:00
|
|
|
ProjectExplorer::ProjectNode *rootProjectNode() const;
|
2010-02-08 15:50:06 +01:00
|
|
|
QStringList files(FilesMode fileMode) const;
|
2010-01-12 16:56:36 +01:00
|
|
|
|
2010-02-17 13:37:00 +01:00
|
|
|
bool validProjectFile() const;
|
|
|
|
|
|
2010-01-19 13:53:48 +01:00
|
|
|
enum RefreshOption {
|
|
|
|
|
ProjectFile = 0x01,
|
|
|
|
|
Files = 0x02,
|
|
|
|
|
Configuration = 0x04,
|
|
|
|
|
Everything = ProjectFile | Files | Configuration
|
2010-01-12 16:56:36 +01:00
|
|
|
};
|
2010-01-19 13:53:48 +01:00
|
|
|
Q_DECLARE_FLAGS(RefreshOptions,RefreshOption)
|
2010-01-12 16:56:36 +01:00
|
|
|
|
|
|
|
|
void refresh(RefreshOptions options);
|
|
|
|
|
|
|
|
|
|
QDir projectDir() const;
|
|
|
|
|
QStringList files() const;
|
2010-12-03 17:04:29 +01:00
|
|
|
QString mainFile() const;
|
2010-03-21 09:36:54 +01:00
|
|
|
QStringList importPaths() const;
|
2010-01-12 16:56:36 +01:00
|
|
|
|
2010-02-17 11:20:35 +01:00
|
|
|
bool addFiles(const QStringList &filePaths);
|
|
|
|
|
|
2010-01-19 13:53:48 +01:00
|
|
|
void refreshProjectFile();
|
2011-09-15 13:05:36 +02:00
|
|
|
|
|
|
|
|
private slots:
|
2010-05-18 13:40:35 +02:00
|
|
|
void refreshFiles(const QSet<QString> &added, const QSet<QString> &removed);
|
2010-01-19 13:53:48 +01:00
|
|
|
|
2010-01-12 16:56:36 +01:00
|
|
|
protected:
|
2010-01-19 16:33:44 +01:00
|
|
|
bool fromMap(const QVariantMap &map);
|
2010-01-12 16:56:36 +01:00
|
|
|
|
|
|
|
|
private:
|
2010-01-18 16:32:14 +01:00
|
|
|
// plain format
|
2010-01-12 16:56:36 +01:00
|
|
|
void parseProject(RefreshOptions options);
|
|
|
|
|
QStringList convertToAbsoluteFiles(const QStringList &paths) const;
|
|
|
|
|
|
|
|
|
|
Internal::Manager *m_manager;
|
|
|
|
|
QString m_fileName;
|
|
|
|
|
Internal::QmlProjectFile *m_file;
|
|
|
|
|
QString m_projectName;
|
2010-06-09 15:56:03 +02:00
|
|
|
QmlJS::ModelManagerInterface *m_modelManager;
|
2010-01-12 16:56:36 +01:00
|
|
|
|
2010-01-18 16:32:14 +01:00
|
|
|
// plain format
|
2010-01-12 16:56:36 +01:00
|
|
|
QStringList m_files;
|
|
|
|
|
|
2010-01-18 16:32:14 +01:00
|
|
|
// qml based, new format
|
2010-02-26 14:46:04 +01:00
|
|
|
QDeclarativeEngine m_engine;
|
2010-01-18 16:32:14 +01:00
|
|
|
QWeakPointer<QmlProjectItem> m_projectItem;
|
|
|
|
|
|
2010-01-12 16:56:36 +01:00
|
|
|
Internal::QmlProjectNode *m_rootNode;
|
|
|
|
|
};
|
|
|
|
|
|
2009-05-04 12:19:22 +02:00
|
|
|
} // namespace QmlProjectManager
|
|
|
|
|
|
2010-01-19 13:53:48 +01:00
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(QmlProjectManager::QmlProject::RefreshOptions)
|
|
|
|
|
|
2009-05-04 12:19:22 +02:00
|
|
|
#endif // QMLPROJECT_H
|