forked from qt-creator/qt-creator
ProjectExplorer: Add a "product" tag to the ProjectNode class
A product is a project node from which a target binary is produced, such as a Product item in qbs or a .pro file in qmake. Change-Id: I6a0e6bed6c02684cb03b2b18fed6a1b493fa78b2 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -173,6 +173,7 @@ CMakeTargetNode::CMakeTargetNode(const Utils::FileName &directory, const QString
|
|||||||
setPriority(Node::DefaultProjectPriority + 900);
|
setPriority(Node::DefaultProjectPriority + 900);
|
||||||
setIcon(QIcon(":/projectexplorer/images/build.png")); // TODO: Use proper icon!
|
setIcon(QIcon(":/projectexplorer/images/build.png")); // TODO: Use proper icon!
|
||||||
setListInProject(false);
|
setListInProject(false);
|
||||||
|
setIsProduct();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CMakeTargetNode::generateId(const Utils::FileName &directory, const QString &target)
|
QString CMakeTargetNode::generateId(const Utils::FileName &directory, const QString &target)
|
||||||
|
|||||||
@@ -104,17 +104,14 @@ void ResourceHandler::updateResourcesHelper(bool updateProjectResources)
|
|||||||
return n->filePath().toString() == fileName;
|
return n->filePath().toString() == fileName;
|
||||||
});
|
});
|
||||||
if (fileNode) {
|
if (fileNode) {
|
||||||
// Slightly hacky:
|
// We do not want qbs groups or qmake .pri files here, as they contain only a subset
|
||||||
// The node types do not tell us whether we are dealing with a proper "product",
|
// of the relevant files.
|
||||||
// e.g. a qbs product or qmake .pro file. We do *not* want qbs groups
|
|
||||||
// or qmake .pri files here, as they contain only a subset of the relevant
|
|
||||||
// files. Luckily, the "show in simplified tree" property appears to match
|
|
||||||
// exactly what we want here.
|
|
||||||
do
|
do
|
||||||
projectNode = fileNode->parentProjectNode();
|
projectNode = fileNode->parentProjectNode();
|
||||||
while (projectNode && !projectNode->showInSimpleTree());
|
while (projectNode && !projectNode->isProduct());
|
||||||
}
|
}
|
||||||
QTC_ASSERT(projectNode, projectNode = project->rootProjectNode());
|
if (!projectNode)
|
||||||
|
projectNode = project->rootProjectNode();
|
||||||
|
|
||||||
QStringList projectQrcFiles;
|
QStringList projectQrcFiles;
|
||||||
projectNode->forEachNode([&](FileNode *node) {
|
projectNode->forEachNode([&](FileNode *node) {
|
||||||
|
|||||||
@@ -357,8 +357,15 @@ public:
|
|||||||
virtual QVariant data(Core::Id role) const;
|
virtual QVariant data(Core::Id role) const;
|
||||||
virtual bool setData(Core::Id role, const QVariant &value) const;
|
virtual bool setData(Core::Id role, const QVariant &value) const;
|
||||||
|
|
||||||
|
bool isProduct() const { return m_isProduct; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void setIsProduct() { m_isProduct = true; }
|
||||||
|
|
||||||
QString m_target;
|
QString m_target;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_isProduct = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT ContainerNode : public FolderNode
|
class PROJECTEXPLORER_EXPORT ContainerNode : public FolderNode
|
||||||
|
|||||||
@@ -329,6 +329,7 @@ QbsProductNode::QbsProductNode(const qbs::ProductData &prd) :
|
|||||||
{
|
{
|
||||||
static QIcon productIcon = Core::FileIconProvider::directoryIcon(Constants::QBS_PRODUCT_OVERLAY_ICON);
|
static QIcon productIcon = Core::FileIconProvider::directoryIcon(Constants::QBS_PRODUCT_OVERLAY_ICON);
|
||||||
setIcon(productIcon);
|
setIcon(productIcon);
|
||||||
|
setIsProduct();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QbsProductNode::supportsAction(ProjectAction action, const Node *node) const
|
bool QbsProductNode::supportsAction(ProjectAction action, const Node *node) const
|
||||||
|
|||||||
@@ -229,7 +229,9 @@ FolderNode::AddNewInformation QmakePriFileNode::addNewInformation(const QStringL
|
|||||||
*/
|
*/
|
||||||
QmakeProFileNode::QmakeProFileNode(QmakeProject *project, const FileName &filePath, QmakeProFile *pf) :
|
QmakeProFileNode::QmakeProFileNode(QmakeProject *project, const FileName &filePath, QmakeProFile *pf) :
|
||||||
QmakePriFileNode(project, this, filePath, pf)
|
QmakePriFileNode(project, this, filePath, pf)
|
||||||
{ }
|
{
|
||||||
|
setIsProduct();
|
||||||
|
}
|
||||||
|
|
||||||
bool QmakeProFileNode::showInSimpleTree() const
|
bool QmakeProFileNode::showInSimpleTree() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user