2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-05-04 12:19:22 +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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2010-01-12 16:56:36 +01:00
|
|
|
#include "qmlprojectmanager_global.h"
|
2016-01-08 12:49:00 +01:00
|
|
|
#include "qmlprojectnodes.h"
|
2016-01-08 11:31:06 +01:00
|
|
|
|
2009-05-04 12:19:22 +02:00
|
|
|
#include <projectexplorer/project.h>
|
|
|
|
|
|
2012-09-24 13:48:18 +02:00
|
|
|
#include <QPointer>
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2012-10-09 16:20:26 +02:00
|
|
|
namespace ProjectExplorer { class RunConfiguration; }
|
2012-04-24 15:49:09 +02:00
|
|
|
namespace QmlJS { class ModelManagerInterface; }
|
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-01-12 16:56:36 +01:00
|
|
|
class QMLPROJECTMANAGER_EXPORT QmlProject : public ProjectExplorer::Project
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2017-02-28 16:31:07 +01:00
|
|
|
explicit QmlProject(const Utils::FileName &filename);
|
2016-01-07 17:58:34 +01:00
|
|
|
~QmlProject() override;
|
2010-01-12 16:56:36 +01:00
|
|
|
|
2016-01-07 17:58:34 +01:00
|
|
|
QString displayName() const override;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2016-01-07 17:58:34 +01:00
|
|
|
bool supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) const override;
|
2010-01-12 16:56:36 +01:00
|
|
|
|
2016-01-08 12:49:00 +01:00
|
|
|
Internal::QmlProjectNode *rootProjectNode() const override;
|
2016-01-07 17:58:34 +01:00
|
|
|
QStringList files(FilesMode fileMode) const override;
|
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;
|
2012-12-03 15:28:34 +01:00
|
|
|
QStringList customImportPaths() 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
|
|
|
|
2013-01-21 13:54:20 +01:00
|
|
|
enum QmlImport { UnknownImport, QtQuick1Import, QtQuick2Import };
|
|
|
|
|
QmlImport defaultImport() const;
|
|
|
|
|
|
2016-07-01 12:19:37 +03:00
|
|
|
protected:
|
|
|
|
|
RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) override;
|
|
|
|
|
|
|
|
|
|
private:
|
2010-05-18 13:40:35 +02:00
|
|
|
void refreshFiles(const QSet<QString> &added, const QSet<QString> &removed);
|
2012-10-09 16:20:26 +02:00
|
|
|
void addedTarget(ProjectExplorer::Target *target);
|
2013-05-02 15:29:33 +02:00
|
|
|
void onActiveTargetChanged(ProjectExplorer::Target *target);
|
2013-11-06 12:59:04 +01:00
|
|
|
void onKitChanged();
|
2012-10-09 16:20:26 +02:00
|
|
|
void addedRunConfiguration(ProjectExplorer::RunConfiguration *);
|
2010-01-19 13:53:48 +01:00
|
|
|
|
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;
|
2014-07-24 11:48:30 +02:00
|
|
|
QmlJS::ModelManagerInterface *modelManager() const;
|
2010-01-12 16:56:36 +01:00
|
|
|
|
|
|
|
|
QString m_projectName;
|
2013-01-21 13:54:20 +01:00
|
|
|
QmlImport m_defaultImport;
|
2016-01-08 11:31:06 +01:00
|
|
|
ProjectExplorer::Target *m_activeTarget = 0;
|
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;
|
|
|
|
|
|
2012-09-24 13:48:18 +02:00
|
|
|
QPointer<QmlProjectItem> m_projectItem;
|
2010-01-12 16:56:36 +01:00
|
|
|
};
|
|
|
|
|
|
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)
|