QmakeProjectManager: Differentiate between different types of projects
... by using different icons in the tree. So far, Qmake project nodes looked annoyingly uniform, which was a hindrance to understanding their structure. We now use the same differentiation as in qbs, that is "project" (SUBDIRS pro file), "product" (app/lib/other) and "group" (pri file), which conveys much more information at a quick glance. Change-Id: I04ca2aeccb9240876c0fb5cd1310e0b199eb3e97 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -64,6 +64,10 @@
|
||||
<file>images/fileoverlay_qrc@2x.png</file>
|
||||
<file>images/fileoverlay_qt.png</file>
|
||||
<file>images/fileoverlay_qt@2x.png</file>
|
||||
<file>images/fileoverlay_product.png</file>
|
||||
<file>images/fileoverlay_product@2x.png</file>
|
||||
<file>images/fileoverlay_group.png</file>
|
||||
<file>images/fileoverlay_group@2x.png</file>
|
||||
<file>images/fileoverlay_ui.png</file>
|
||||
<file>images/fileoverlay_ui@2x.png</file>
|
||||
<file>images/fileoverlay_scxml.png</file>
|
||||
|
@@ -210,6 +210,8 @@ const char PROJECTTREE_ID[] = "Projects";
|
||||
|
||||
// File icon overlays
|
||||
const char FILEOVERLAY_QT[]=":/projectexplorer/images/fileoverlay_qt.png";
|
||||
const char FILEOVERLAY_GROUP[] = ":/projectexplorer/images/fileoverlay_group.png";
|
||||
const char FILEOVERLAY_PRODUCT[] = ":/projectexplorer/images/fileoverlay_product.png";
|
||||
const char FILEOVERLAY_QML[]=":/projectexplorer/images/fileoverlay_qml.png";
|
||||
const char FILEOVERLAY_UI[]=":/projectexplorer/images/fileoverlay_ui.png";
|
||||
const char FILEOVERLAY_QRC[]=":/projectexplorer/images/fileoverlay_qrc.png";
|
||||
|
@@ -73,7 +73,7 @@ const QbsProductNode *parentQbsProductNode(const ProjectExplorer::Node *node)
|
||||
|
||||
QbsGroupNode::QbsGroupNode(const QJsonObject &grp) : ProjectNode(FilePath()), m_groupData(grp)
|
||||
{
|
||||
static QIcon groupIcon = QIcon(QString(Constants::QBS_GROUP_ICON));
|
||||
static QIcon groupIcon = QIcon(QString(ProjectExplorer::Constants::FILEOVERLAY_GROUP));
|
||||
setIcon(groupIcon);
|
||||
setDisplayName(grp.value("name").toString());
|
||||
setEnabled(grp.value("is-enabled").toBool());
|
||||
@@ -109,7 +109,7 @@ QVariant QbsGroupNode::data(Core::Id role) const
|
||||
QbsProductNode::QbsProductNode(const QJsonObject &prd) : ProjectNode(FilePath()), m_productData(prd)
|
||||
{
|
||||
static QIcon productIcon = Core::FileIconProvider::directoryIcon(
|
||||
Constants::QBS_PRODUCT_OVERLAY_ICON);
|
||||
ProjectExplorer::Constants::FILEOVERLAY_PRODUCT);
|
||||
setIcon(productIcon);
|
||||
if (prd.value("is-runnable").toBool()) {
|
||||
setProductType(ProductType::App);
|
||||
|
@@ -1,9 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/qbsprojectmanager">
|
||||
<file>images/groups.png</file>
|
||||
<file>images/groups@2x.png</file>
|
||||
<file>images/productgear.png</file>
|
||||
<file>images/productgear@2x.png</file>
|
||||
<file>images/settingscategory_qbsprojectmanager.png</file>
|
||||
<file>images/settingscategory_qbsprojectmanager@2x.png</file>
|
||||
</qresource>
|
||||
|
@@ -73,10 +73,6 @@ const char QBS_CONFIG_QUICK_COMPILER_KEY[] = "modules.Qt.quick.useCompiler";
|
||||
const char QBS_CONFIG_SEPARATE_DEBUG_INFO_KEY[] = "modules.cpp.separateDebugInformation";
|
||||
const char QBS_FORCE_PROBES_KEY[] = "qbspm.forceProbes";
|
||||
|
||||
// Icons:
|
||||
const char QBS_GROUP_ICON[] = ":/qbsprojectmanager/images/groups.png";
|
||||
const char QBS_PRODUCT_OVERLAY_ICON[] = ":/qbsprojectmanager/images/productgear.png";
|
||||
|
||||
// Toolchain related settings:
|
||||
const char QBS_TARGETPLATFORM[] = "qbs.targetPlatform";
|
||||
const char QBS_SYSROOT[] = "qbs.sysroot";
|
||||
|
@@ -95,6 +95,8 @@ public:
|
||||
|
||||
QVector<FileTypeData> fileTypeData;
|
||||
QIcon projectIcon;
|
||||
QIcon productIcon;
|
||||
QIcon groupIcon;
|
||||
};
|
||||
|
||||
void clearQmakeStaticData();
|
||||
@@ -114,6 +116,8 @@ QmakeStaticData::QmakeStaticData()
|
||||
}
|
||||
// Project icon
|
||||
projectIcon = Core::FileIconProvider::directoryIcon(ProjectExplorer::Constants::FILEOVERLAY_QT);
|
||||
productIcon = Core::FileIconProvider::directoryIcon(ProjectExplorer::Constants::FILEOVERLAY_PRODUCT);
|
||||
groupIcon = Core::FileIconProvider::directoryIcon(ProjectExplorer::Constants::FILEOVERLAY_GROUP);
|
||||
|
||||
qAddPostRoutine(clearQmakeStaticData);
|
||||
}
|
||||
@@ -124,12 +128,20 @@ void clearQmakeStaticData()
|
||||
{
|
||||
qmakeStaticData()->fileTypeData.clear();
|
||||
qmakeStaticData()->projectIcon = QIcon();
|
||||
qmakeStaticData()->productIcon = QIcon();
|
||||
qmakeStaticData()->groupIcon = QIcon();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
|
||||
static QIcon iconForProfile(const QmakeProFile *proFile)
|
||||
{
|
||||
return proFile->projectType() == ProjectType::SubDirsTemplate ? qmakeStaticData()->projectIcon
|
||||
: qmakeStaticData()->productIcon;
|
||||
}
|
||||
|
||||
static void createTree(QmakeBuildSystem *buildSystem,
|
||||
const QmakePriFile *pri,
|
||||
QmakePriFileNode *node,
|
||||
@@ -139,7 +151,6 @@ static void createTree(QmakeBuildSystem *buildSystem,
|
||||
QTC_ASSERT(node, return);
|
||||
|
||||
node->setDisplayName(pri->displayName());
|
||||
node->setIcon(qmakeStaticData()->projectIcon);
|
||||
|
||||
// .pro/.pri-file itself:
|
||||
node->addNode(std::make_unique<FileNode>(pri->filePath(), FileType::Project));
|
||||
@@ -227,10 +238,14 @@ static void createTree(QmakeBuildSystem *buildSystem,
|
||||
// Virtual folders:
|
||||
for (QmakePriFile *c : pri->children()) {
|
||||
std::unique_ptr<QmakePriFileNode> newNode;
|
||||
if (auto pf = dynamic_cast<QmakeProFile *>(c))
|
||||
if (auto pf = dynamic_cast<QmakeProFile *>(c)) {
|
||||
newNode = std::make_unique<QmakeProFileNode>(c->buildSystem(), c->filePath(), pf);
|
||||
else
|
||||
newNode = std::make_unique<QmakePriFileNode>(c->buildSystem(), node->proFileNode(), c->filePath(), c);
|
||||
newNode->setIcon(iconForProfile(pf));
|
||||
} else {
|
||||
newNode = std::make_unique<QmakePriFileNode>(c->buildSystem(), node->proFileNode(),
|
||||
c->filePath(), c);
|
||||
newNode->setIcon(qmakeStaticData->groupIcon);
|
||||
}
|
||||
createTree(buildSystem, c, newNode.get(), toExclude);
|
||||
node->addNode(std::move(newNode));
|
||||
}
|
||||
@@ -246,6 +261,7 @@ std::unique_ptr<QmakeProFileNode> QmakeNodeTreeBuilder::buildTree(QmakeBuildSyst
|
||||
auto root = std::make_unique<QmakeProFileNode>(buildSystem,
|
||||
buildSystem->projectFilePath(),
|
||||
buildSystem->rootProFile());
|
||||
root->setIcon(iconForProfile(buildSystem->rootProFile()));
|
||||
createTree(buildSystem, buildSystem->rootProFile(), root.get(), toExclude);
|
||||
|
||||
return root;
|
||||
|