2009-05-04 12:19:22 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2010-03-05 11:25:49 +01:00
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
2009-06-17 00:01:27 +10:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
|
|
|
|
** Commercial Usage
|
|
|
|
|
**
|
|
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
** If you are unsure which license is appropriate for your use, please
|
2009-08-14 09:30:56 +02:00
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef QMLPROJECT_H
|
|
|
|
|
#define QMLPROJECT_H
|
|
|
|
|
|
|
|
|
|
#include "qmlprojectmanager.h"
|
2010-01-12 16:56:36 +01:00
|
|
|
#include "qmlprojectmanager_global.h"
|
2010-02-16 13:39:13 +01:00
|
|
|
#include "qmlprojectnodes.h"
|
|
|
|
|
#include "qmlprojecttarget.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
|
|
|
}
|
|
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
class FileWatcher;
|
|
|
|
|
}
|
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 {
|
2009-12-16 16:39:39 +01:00
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
class QmlProjectFile;
|
|
|
|
|
class QmlProjectNode;
|
2009-05-07 12:27:52 +02:00
|
|
|
|
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;
|
|
|
|
|
Internal::Manager *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
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
Internal::QmlProjectNode *rootProjectNode() const;
|
|
|
|
|
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-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
|
|
|
private slots:
|
|
|
|
|
void refreshProjectFile();
|
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-19 13:53:48 +01:00
|
|
|
ProjectExplorer::FileWatcher *m_fileWatcher;
|
2010-01-18 16:32:14 +01:00
|
|
|
|
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
|