2013-01-30 18:19:31 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
|
|
|
|
** Contact: http://www.qt-project.org/legal
|
|
|
|
|
**
|
|
|
|
|
** 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
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef QBSNODES_H
|
|
|
|
|
#define QBSNODES_H
|
|
|
|
|
|
|
|
|
|
#include <projectexplorer/projectnodes.h>
|
|
|
|
|
|
|
|
|
|
#include <api/projectdata.h>
|
|
|
|
|
|
2013-04-17 13:07:43 +02:00
|
|
|
#include <QIcon>
|
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
namespace qbs { class Project; }
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
QbsFileNode(const QString &filePath, const ProjectExplorer::FileType fileType, bool generated,
|
|
|
|
|
int line);
|
|
|
|
|
int line() const { return m_line; }
|
|
|
|
|
|
|
|
|
|
void setLine(int l);
|
|
|
|
|
|
2013-06-05 15:50:24 +02:00
|
|
|
QString displayName() const;
|
|
|
|
|
|
2013-05-29 16:35:57 +02:00
|
|
|
bool update(const qbs::CodeLocation &loc);
|
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
private:
|
|
|
|
|
int m_line;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
// QbsBaseProjectNode:
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
2013-04-16 16:19:11 +02:00
|
|
|
class QbsGroupNode;
|
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
class QbsBaseProjectNode : public ProjectExplorer::ProjectNode
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit QbsBaseProjectNode(const QString &path);
|
|
|
|
|
|
|
|
|
|
bool hasBuildTargets() const;
|
|
|
|
|
|
|
|
|
|
QList<ProjectAction> supportedActions(Node *node) const;
|
|
|
|
|
|
|
|
|
|
bool canAddSubProject(const QString &proFilePath) const;
|
|
|
|
|
|
|
|
|
|
bool addSubProjects(const QStringList &proFilePaths);
|
|
|
|
|
|
|
|
|
|
bool removeSubProjects(const QStringList &proFilePaths);
|
|
|
|
|
|
|
|
|
|
bool addFiles(const ProjectExplorer::FileType fileType,
|
|
|
|
|
const QStringList &filePaths,
|
|
|
|
|
QStringList *notAdded = 0);
|
|
|
|
|
bool removeFiles(const ProjectExplorer::FileType fileType,
|
|
|
|
|
const QStringList &filePaths,
|
|
|
|
|
QStringList *notRemoved = 0);
|
|
|
|
|
bool deleteFiles(const ProjectExplorer::FileType fileType,
|
|
|
|
|
const QStringList &filePaths);
|
|
|
|
|
bool renameFile(const ProjectExplorer::FileType fileType,
|
|
|
|
|
const QString &filePath,
|
|
|
|
|
const QString &newFilePath);
|
|
|
|
|
|
|
|
|
|
QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
|
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
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2013-04-16 16:19:11 +02:00
|
|
|
QbsGroupNode(const qbs::GroupData *grp, const QString &productPath);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
|
bool isEnabled() const;
|
2013-05-29 16:35:57 +02:00
|
|
|
void updateQbsGroupData(const qbs::GroupData *grp, const QString &productPath,
|
|
|
|
|
bool productWasEnabled, bool productIsEnabled);
|
2013-05-17 13:16:09 +02:00
|
|
|
|
2013-05-16 16:20:06 +02:00
|
|
|
const 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;
|
|
|
|
|
|
2013-05-17 13:16:09 +02:00
|
|
|
static void setupFiles(QbsBaseProjectNode *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);
|
2013-05-16 16:20:06 +02:00
|
|
|
const 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
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2013-06-21 15:09:01 +02:00
|
|
|
explicit QbsProductNode(const qbs::ProductData &prd);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
|
bool isEnabled() const;
|
|
|
|
|
|
2013-06-21 15:09:01 +02:00
|
|
|
void setQbsProductData(const qbs::ProductData prd);
|
|
|
|
|
const qbs::ProductData qbsProductData() const { return m_qbsProductData; }
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2013-05-16 16:31:07 +02:00
|
|
|
QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
|
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2013-05-16 16:24:37 +02:00
|
|
|
explicit QbsProjectNode(QbsProject *project);
|
2013-06-18 13:09:06 +02:00
|
|
|
explicit QbsProjectNode(const QString &path);
|
2013-01-30 18:19:31 +01:00
|
|
|
~QbsProjectNode();
|
|
|
|
|
|
|
|
|
|
void update(const qbs::Project *prj);
|
2013-06-18 13:09:06 +02:00
|
|
|
void update(const qbs::ProjectData &prjData);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2013-05-16 16:24:37 +02:00
|
|
|
QbsProject *project() const;
|
2013-05-16 16:20:06 +02:00
|
|
|
const qbs::Project *qbsProject() const;
|
2013-06-21 15:09:01 +02:00
|
|
|
const qbs::ProjectData qbsProjectData() const;
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
|
private:
|
2013-06-18 13:09:06 +02:00
|
|
|
void ctor();
|
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
QbsProductNode *findProductNode(const QString &name);
|
2013-06-18 13:09:06 +02:00
|
|
|
QbsProjectNode *findProjectNode(const QString &name);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2013-05-16 16:24:37 +02:00
|
|
|
QbsProject *m_project;
|
|
|
|
|
|
2013-05-16 16:20:06 +02:00
|
|
|
const qbs::Project *m_qbsProject;
|
2013-06-21 15:09:01 +02:00
|
|
|
qbs::ProjectData m_qbsProjectData;
|
2013-04-17 13:07:43 +02:00
|
|
|
static QIcon m_projectIcon;
|
2013-01-30 18:19:31 +01:00
|
|
|
};
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QbsProjectManager
|
|
|
|
|
|
|
|
|
|
#endif // QBSNODES_H
|