2013-01-30 18:19:31 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
|
** Contact: http://www.qt.io/licensing
|
2013-01-30 18:19:31 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** 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
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2013-01-30 18:19:31 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2013-01-30 18:19:31 +01:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company LGPL Exception
|
2013-01-30 18:19:31 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef QBSNODES_H
|
|
|
|
|
#define QBSNODES_H
|
|
|
|
|
|
|
|
|
|
#include <projectexplorer/projectnodes.h>
|
|
|
|
|
|
2013-09-06 18:02:46 +02:00
|
|
|
#include <qbs.h>
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2013-04-17 13:07:43 +02:00
|
|
|
#include <QIcon>
|
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
namespace QbsProjectManager {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class FileTreeNode;
|
2013-05-16 16:24:37 +02:00
|
|
|
class QbsProject;
|
2013-01-30 18:19:31 +01:00
|
|
|
class QbsProjectFile;
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
// QbsFileNode:
|
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class QbsFileNode : public ProjectExplorer::FileNode
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QbsFileNode(const QString &filePath, const ProjectExplorer::FileType fileType, bool generated,
|
|
|
|
|
int line);
|
|
|
|
|
|
2013-06-05 15:50:24 +02:00
|
|
|
QString displayName() const;
|
2013-01-30 18:19:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
// QbsBaseProjectNode:
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
2013-04-16 16:19:11 +02:00
|
|
|
class QbsGroupNode;
|
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
class QbsBaseProjectNode : public ProjectExplorer::ProjectNode
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit QbsBaseProjectNode(const QString &path);
|
|
|
|
|
|
2014-03-17 11:52:45 +01:00
|
|
|
bool showInSimpleTree() const;
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2014-02-03 14:45:28 +01:00
|
|
|
QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
|
bool canAddSubProject(const QString &proFilePath) const;
|
|
|
|
|
|
|
|
|
|
bool addSubProjects(const QStringList &proFilePaths);
|
|
|
|
|
|
|
|
|
|
bool removeSubProjects(const QStringList &proFilePaths);
|
|
|
|
|
|
2013-07-01 16:13:48 +02:00
|
|
|
bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0);
|
|
|
|
|
bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
|
|
|
|
|
bool deleteFiles(const QStringList &filePaths);
|
|
|
|
|
bool renameFile(const QString &filePath, const QString &newFilePath);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2013-04-16 16:35:53 +02:00
|
|
|
private:
|
|
|
|
|
friend class QbsGroupNode;
|
2013-01-30 18:19:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
// QbsGroupNode:
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class QbsGroupNode : public QbsBaseProjectNode
|
|
|
|
|
{
|
|
|
|
|
public:
|
2014-08-04 12:32:19 +02:00
|
|
|
QbsGroupNode(const qbs::GroupData &grp, const QString &productPath);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
|
bool isEnabled() const;
|
2014-06-03 21:05:28 +02:00
|
|
|
QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
|
|
|
|
|
bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0);
|
2014-06-23 17:10:15 +02:00
|
|
|
bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
|
2014-09-11 17:12:03 +02:00
|
|
|
bool renameFile(const QString &filePath, const QString &newFilePath);
|
2014-08-04 12:32:19 +02:00
|
|
|
void updateQbsGroupData(const qbs::GroupData &grp, const QString &productPath,
|
2013-05-29 16:35:57 +02:00
|
|
|
bool productWasEnabled, bool productIsEnabled);
|
2013-05-17 13:16:09 +02:00
|
|
|
|
2014-08-04 12:32:19 +02:00
|
|
|
qbs::GroupData qbsGroupData() const { return m_qbsGroupData; }
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2013-04-16 16:19:11 +02:00
|
|
|
QString productPath() const;
|
|
|
|
|
|
2014-07-22 15:43:10 +02:00
|
|
|
static void setupFiles(FolderNode *root, const QStringList &files,
|
2013-05-29 16:35:57 +02:00
|
|
|
const QString &productPath, bool updateExisting);
|
2013-04-16 16:35:53 +02:00
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
private:
|
2013-05-17 13:16:09 +02:00
|
|
|
static void setupFolder(ProjectExplorer::FolderNode *folder,
|
2013-05-29 16:35:57 +02:00
|
|
|
const FileTreeNode *subFileTree, const QString &baseDir, bool updateExisting);
|
2014-08-04 12:32:19 +02:00
|
|
|
qbs::GroupData m_qbsGroupData;
|
2013-04-16 16:19:11 +02:00
|
|
|
QString m_productPath;
|
2013-04-17 13:07:43 +02:00
|
|
|
|
|
|
|
|
static QIcon m_groupIcon;
|
2013-01-30 18:19:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
// QbsProductNode:
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class QbsProductNode : public QbsBaseProjectNode
|
|
|
|
|
{
|
|
|
|
|
public:
|
2014-09-05 12:08:15 +02:00
|
|
|
explicit QbsProductNode(const qbs::Project &project, const qbs::ProductData &prd);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
|
bool isEnabled() const;
|
2014-03-17 11:52:45 +01:00
|
|
|
bool showInSimpleTree() const;
|
2014-06-03 21:05:28 +02:00
|
|
|
QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
|
|
|
|
|
bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0);
|
2014-06-23 17:10:15 +02:00
|
|
|
bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
|
2014-09-11 17:12:03 +02:00
|
|
|
bool renameFile(const QString &filePath, const QString &newFilePath);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2014-09-05 12:08:15 +02:00
|
|
|
void setQbsProductData(const qbs::Project &project, const qbs::ProductData prd);
|
2013-06-21 15:09:01 +02:00
|
|
|
const qbs::ProductData qbsProductData() const { return m_qbsProductData; }
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2014-04-29 08:35:00 +02:00
|
|
|
QList<ProjectExplorer::RunConfiguration *> runConfigurations() const;
|
2013-05-16 16:31:07 +02:00
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
private:
|
|
|
|
|
QbsGroupNode *findGroupNode(const QString &name);
|
|
|
|
|
|
2013-06-21 15:09:01 +02:00
|
|
|
qbs::ProductData m_qbsProductData;
|
2013-04-17 13:07:43 +02:00
|
|
|
static QIcon m_productIcon;
|
2013-01-30 18:19:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
// QbsProjectNode:
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class QbsProjectNode : public QbsBaseProjectNode
|
|
|
|
|
{
|
|
|
|
|
public:
|
2013-06-18 13:09:06 +02:00
|
|
|
explicit QbsProjectNode(const QString &path);
|
2013-01-30 18:19:31 +01:00
|
|
|
~QbsProjectNode();
|
|
|
|
|
|
2014-07-10 17:01:54 +02:00
|
|
|
virtual QbsProject *project() const;
|
2013-09-06 18:02:46 +02:00
|
|
|
const qbs::Project qbsProject() const;
|
2014-08-01 15:45:05 +02:00
|
|
|
const qbs::ProjectData qbsProjectData() const { return m_projectData; }
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2014-03-18 14:41:24 +01:00
|
|
|
bool showInSimpleTree() const;
|
2013-06-18 13:09:06 +02:00
|
|
|
|
2014-07-10 17:01:54 +02:00
|
|
|
protected:
|
2014-09-05 12:08:15 +02:00
|
|
|
void update(const qbs::Project &qbsProject, const qbs::ProjectData &prjData);
|
2014-06-24 12:06:13 +02:00
|
|
|
|
2014-07-10 17:01:54 +02:00
|
|
|
private:
|
|
|
|
|
void ctor();
|
|
|
|
|
|
2014-09-05 12:08:15 +02:00
|
|
|
QbsProductNode *findProductNode(const QString &uniqueName);
|
2013-06-18 13:09:06 +02:00
|
|
|
QbsProjectNode *findProjectNode(const QString &name);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2013-04-17 13:07:43 +02:00
|
|
|
static QIcon m_projectIcon;
|
2014-08-01 15:45:05 +02:00
|
|
|
qbs::ProjectData m_projectData;
|
2013-01-30 18:19:31 +01:00
|
|
|
};
|
2014-07-10 17:01:54 +02:00
|
|
|
|
2014-07-22 15:43:10 +02:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
// QbsRootProjectNode:
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
|
2014-07-10 17:01:54 +02:00
|
|
|
class QbsRootProjectNode : public QbsProjectNode
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit QbsRootProjectNode(QbsProject *project);
|
|
|
|
|
|
|
|
|
|
using QbsProjectNode::update;
|
|
|
|
|
void update();
|
|
|
|
|
|
|
|
|
|
QbsProject *project() const { return m_project; }
|
|
|
|
|
|
|
|
|
|
private:
|
2014-07-22 15:43:10 +02:00
|
|
|
QStringList unreferencedBuildSystemFiles(const qbs::Project &p) const;
|
|
|
|
|
|
2014-07-10 17:01:54 +02:00
|
|
|
QbsProject * const m_project;
|
2014-07-22 15:43:10 +02:00
|
|
|
ProjectExplorer::FolderNode *m_buildSystemFiles;
|
2014-07-10 17:01:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QbsProjectManager
|
|
|
|
|
|
|
|
|
|
#endif // QBSNODES_H
|