forked from qt-creator/qt-creator
Qbs: Remove QbsBaseProjectNode layer
Change-Id: I7c43b0b04503d4c9a25c5fe758defc589655f387 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -230,20 +230,12 @@ static bool supportsNodeAction(ProjectAction action, const Node *node)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// QbsBaseProjectNode:
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
QbsBaseProjectNode::QbsBaseProjectNode(const Utils::FileName &path) :
|
|
||||||
ProjectExplorer::ProjectNode(path)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
// QbsGroupNode:
|
// QbsGroupNode:
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
QbsGroupNode::QbsGroupNode(const qbs::GroupData &grp, const QString &productPath) :
|
QbsGroupNode::QbsGroupNode(const qbs::GroupData &grp, const QString &productPath) :
|
||||||
QbsBaseProjectNode(Utils::FileName())
|
ProjectNode(Utils::FileName())
|
||||||
{
|
{
|
||||||
static QIcon groupIcon = QIcon(QString(Constants::QBS_GROUP_ICON));
|
static QIcon groupIcon = QIcon(QString(Constants::QBS_GROUP_ICON));
|
||||||
setIcon(groupIcon);
|
setIcon(groupIcon);
|
||||||
@@ -320,7 +312,7 @@ bool QbsGroupNode::renameFile(const QString &filePath, const QString &newFilePat
|
|||||||
FolderNode::AddNewInformation QbsGroupNode::addNewInformation(const QStringList &files,
|
FolderNode::AddNewInformation QbsGroupNode::addNewInformation(const QStringList &files,
|
||||||
Node *context) const
|
Node *context) const
|
||||||
{
|
{
|
||||||
AddNewInformation info = QbsBaseProjectNode::addNewInformation(files, context);
|
AddNewInformation info = ProjectNode::addNewInformation(files, context);
|
||||||
if (context != this)
|
if (context != this)
|
||||||
--info.priority;
|
--info.priority;
|
||||||
return info;
|
return info;
|
||||||
@@ -331,7 +323,7 @@ FolderNode::AddNewInformation QbsGroupNode::addNewInformation(const QStringList
|
|||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
QbsProductNode::QbsProductNode(const qbs::ProductData &prd) :
|
QbsProductNode::QbsProductNode(const qbs::ProductData &prd) :
|
||||||
QbsBaseProjectNode(Utils::FileName::fromString(prd.location().filePath())),
|
ProjectNode(Utils::FileName::fromString(prd.location().filePath())),
|
||||||
m_qbsProductData(prd)
|
m_qbsProductData(prd)
|
||||||
{
|
{
|
||||||
static QIcon productIcon = Core::FileIconProvider::directoryIcon(Constants::QBS_PRODUCT_OVERLAY_ICON);
|
static QIcon productIcon = Core::FileIconProvider::directoryIcon(Constants::QBS_PRODUCT_OVERLAY_ICON);
|
||||||
@@ -417,7 +409,7 @@ QString QbsProductNode::buildKey() const
|
|||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
QbsProjectNode::QbsProjectNode(const Utils::FileName &projectDirectory) :
|
QbsProjectNode::QbsProjectNode(const Utils::FileName &projectDirectory) :
|
||||||
QbsBaseProjectNode(projectDirectory)
|
ProjectNode(projectDirectory)
|
||||||
{
|
{
|
||||||
static QIcon projectIcon = Core::FileIconProvider::directoryIcon(ProjectExplorer::Constants::FILEOVERLAY_QT);
|
static QIcon projectIcon = Core::FileIconProvider::directoryIcon(ProjectExplorer::Constants::FILEOVERLAY_QT);
|
||||||
setIcon(projectIcon);
|
setIcon(projectIcon);
|
||||||
|
@@ -35,23 +35,11 @@ namespace Internal {
|
|||||||
class QbsNodeTreeBuilder;
|
class QbsNodeTreeBuilder;
|
||||||
class QbsProject;
|
class QbsProject;
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// QbsBaseProjectNode:
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class QbsGroupNode;
|
|
||||||
|
|
||||||
class QbsBaseProjectNode : public ProjectExplorer::ProjectNode
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit QbsBaseProjectNode(const Utils::FileName &absoluteFilePath);
|
|
||||||
};
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
// QbsGroupNode:
|
// QbsGroupNode:
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
class QbsGroupNode : public QbsBaseProjectNode
|
class QbsGroupNode : public ProjectExplorer::ProjectNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QbsGroupNode(const qbs::GroupData &grp, const QString &productPath);
|
QbsGroupNode(const qbs::GroupData &grp, const QString &productPath);
|
||||||
@@ -72,7 +60,7 @@ private:
|
|||||||
// QbsProductNode:
|
// QbsProductNode:
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
class QbsProductNode : public QbsBaseProjectNode
|
class QbsProductNode : public ProjectExplorer::ProjectNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit QbsProductNode(const qbs::ProductData &prd);
|
explicit QbsProductNode(const qbs::ProductData &prd);
|
||||||
@@ -96,7 +84,7 @@ private:
|
|||||||
// QbsProjectNode:
|
// QbsProjectNode:
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
class QbsProjectNode : public QbsBaseProjectNode
|
class QbsProjectNode : public ProjectExplorer::ProjectNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit QbsProjectNode(const Utils::FileName &projectDirectory);
|
explicit QbsProjectNode(const Utils::FileName &projectDirectory);
|
||||||
|
@@ -321,9 +321,11 @@ void QbsProjectManagerPlugin::updateBuildActions()
|
|||||||
if (Node *editorNode = currentEditorNode()) {
|
if (Node *editorNode = currentEditorNode()) {
|
||||||
fileName = editorNode->filePath().fileName();
|
fileName = editorNode->filePath().fileName();
|
||||||
|
|
||||||
|
ProjectNode *parentProjectNode = editorNode->parentProjectNode();
|
||||||
|
|
||||||
// FIXME: This code is wrong: If the file is in a Group, then productNode will be
|
// FIXME: This code is wrong: If the file is in a Group, then productNode will be
|
||||||
// null and the action will be disabled. We have to walk up the tree.
|
// null and the action will be disabled. We have to walk up the tree.
|
||||||
auto productNode = dynamic_cast<QbsProductNode *>(editorNode->parentProjectNode());
|
auto productNode = dynamic_cast<QbsProductNode *>(parentProjectNode);
|
||||||
if (productNode) {
|
if (productNode) {
|
||||||
productVisible = true;
|
productVisible = true;
|
||||||
productName = productNode->displayName();
|
productName = productNode->displayName();
|
||||||
@@ -331,7 +333,9 @@ void QbsProjectManagerPlugin::updateBuildActions()
|
|||||||
|
|
||||||
if (QbsProject *editorProject = currentEditorProject()) {
|
if (QbsProject *editorProject = currentEditorProject()) {
|
||||||
enabled = !BuildManager::isBuilding(editorProject) && !editorProject->isParsing();
|
enabled = !BuildManager::isBuilding(editorProject) && !editorProject->isParsing();
|
||||||
fileVisible = dynamic_cast<QbsBaseProjectNode *>(editorNode->parentProjectNode());
|
fileVisible = productNode
|
||||||
|
|| dynamic_cast<QbsProjectNode *>(parentProjectNode)
|
||||||
|
|| dynamic_cast<QbsGroupNode *>(parentProjectNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user