Commit ff778a6c authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Qbs: Add pointer to the project to QbsProjectNode



Change-Id: I81fe083ee4350efd89c3afb3f70deb46d0409ee2
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 82a341da
......@@ -32,6 +32,7 @@
#include "qbsproject.h"
#include <coreplugin/fileiconprovider.h>
#include <coreplugin/idocument.h>
#include <qtsupport/qtsupportconstants.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
......@@ -473,17 +474,19 @@ QbsGroupNode *QbsProductNode::findGroupNode(const QString &name)
// QbsProjectNode:
// --------------------------------------------------------------------
QbsProjectNode::QbsProjectNode(const QString &projectFile) :
QbsBaseProjectNode(projectFile),
m_qbsProject(0), m_qbsProjectData(0)
QbsProjectNode::QbsProjectNode(QbsProject *project) :
QbsBaseProjectNode(project->document()->fileName()),
m_project(project), m_qbsProject(0), m_qbsProjectData(0)
{
Q_ASSERT(project);
setIcon(m_projectIcon);
addFileNodes(QList<ProjectExplorer::FileNode *>()
<< new ProjectExplorer::FileNode(projectFile, ProjectExplorer::ProjectFileType, false), this);
<< new ProjectExplorer::FileNode(path(), ProjectExplorer::ProjectFileType, false), this);
}
QbsProjectNode::~QbsProjectNode()
{
// do not delete m_project
delete m_qbsProjectData;
delete m_qbsProject;
}
......@@ -518,6 +521,11 @@ void QbsProjectNode::update(const qbs::Project *prj)
addProjectNodes(toAdd);
}
QbsProject *QbsProjectNode::project() const
{
return m_project;
}
const qbs::Project *QbsProjectNode::qbsProject() const
{
return m_qbsProject;
......
......@@ -42,6 +42,7 @@ namespace QbsProjectManager {
namespace Internal {
class FileTreeNode;
class QbsProject;
class QbsProjectFile;
// ----------------------------------------------------------------------
......@@ -121,7 +122,7 @@ public:
QString productPath() const;
static void setQbsGroupData(QbsBaseProjectNode *root, const qbs::GroupData *qbsGroupData,
const QString &productPath, QList<Node *> keepers);
const QString &productPath, QList<Node *> keepers);
private:
static void setupFolders(QbsBaseProjectNode *topLevel, FolderNode *root, FileTreeNode *node,
......@@ -166,17 +167,20 @@ class QbsProjectNode : public QbsBaseProjectNode
Q_OBJECT
public:
explicit QbsProjectNode(const QString &projectFile);
explicit QbsProjectNode(QbsProject *project);
~QbsProjectNode();
void update(const qbs::Project *prj);
QbsProject *project() const;
const qbs::Project *qbsProject() const;
const qbs::ProjectData *qbsProjectData() const;
private:
QbsProductNode *findProductNode(const QString &name);
QbsProject *m_project;
const qbs::Project *m_qbsProject;
const qbs::ProjectData *m_qbsProjectData;
static QIcon m_projectIcon;
......
......@@ -100,7 +100,7 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) :
m_manager(manager),
m_projectName(QFileInfo(fileName).completeBaseName()),
m_fileName(fileName),
m_rootProjectNode(new QbsProjectNode(fileName)),
m_rootProjectNode(0),
m_qbsSetupProjectJob(0),
m_qbsUpdateFutureInterface(0),
m_currentBc(0)
......@@ -117,6 +117,7 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) :
this, SLOT(targetWasAdded(ProjectExplorer::Target*)));
updateDocuments(0);
m_rootProjectNode = new QbsProjectNode(this); // needs documents to be initialized!
}
QbsProject::~QbsProject()
......
......@@ -129,7 +129,7 @@ private:
const QString m_projectName;
const QString m_fileName;
QSet<Core::IDocument *> m_qbsDocuments;
QbsProjectNode *const m_rootProjectNode;
QbsProjectNode *m_rootProjectNode;
qbs::SetupProjectJob *m_qbsSetupProjectJob;
QVariantMap m_qbsBuildConfig;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment