forked from qt-creator/qt-creator
Qbs: Add icons to Project-/Product- and GroupNodes
Change-Id: Ifedfe50e661320d5a4d26e2ef01a482afb6a76dc Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -31,12 +31,15 @@
|
|||||||
|
|
||||||
#include "qbsproject.h"
|
#include "qbsproject.h"
|
||||||
|
|
||||||
|
#include <coreplugin/fileiconprovider.h>
|
||||||
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <qbs.h>
|
#include <qbs.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QStyle>
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Helpers:
|
// Helpers:
|
||||||
@@ -45,6 +48,24 @@
|
|||||||
namespace QbsProjectManager {
|
namespace QbsProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
QIcon generateIcon()
|
||||||
|
{
|
||||||
|
const QSize desiredSize = QSize(16, 16);
|
||||||
|
const QIcon projectBaseIcon(QString::fromLatin1(QtSupport::Constants::ICON_QT_PROJECT));
|
||||||
|
const QPixmap projectPixmap = Core::FileIconProvider::overlayIcon(QStyle::SP_DirIcon,
|
||||||
|
projectBaseIcon,
|
||||||
|
desiredSize);
|
||||||
|
|
||||||
|
QIcon result;
|
||||||
|
result.addPixmap(projectPixmap);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
QIcon QbsProjectNode::m_projectIcon = generateIcon();
|
||||||
|
QIcon QbsProductNode::m_productIcon = generateIcon();
|
||||||
|
QIcon QbsGroupNode::m_groupIcon = generateIcon();
|
||||||
|
|
||||||
class FileTreeNode {
|
class FileTreeNode {
|
||||||
public:
|
public:
|
||||||
FileTreeNode(const QString &n, FileTreeNode *p = 0) :
|
FileTreeNode(const QString &n, FileTreeNode *p = 0) :
|
||||||
@@ -248,6 +269,7 @@ QbsGroupNode::QbsGroupNode(const qbs::GroupData *grp, const QString &productPath
|
|||||||
QbsBaseProjectNode(QString()),
|
QbsBaseProjectNode(QString()),
|
||||||
m_group(0)
|
m_group(0)
|
||||||
{
|
{
|
||||||
|
setIcon(m_groupIcon);
|
||||||
setGroup(grp, productPath);
|
setGroup(grp, productPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,6 +397,7 @@ QbsProductNode::QbsProductNode(const qbs::ProductData *prd) :
|
|||||||
QbsBaseProjectNode(prd->location().fileName),
|
QbsBaseProjectNode(prd->location().fileName),
|
||||||
m_product(0)
|
m_product(0)
|
||||||
{
|
{
|
||||||
|
setIcon(m_productIcon);
|
||||||
setProduct(prd);
|
setProduct(prd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,6 +477,7 @@ QbsProjectNode::QbsProjectNode(const QString &projectFile) :
|
|||||||
QbsBaseProjectNode(projectFile),
|
QbsBaseProjectNode(projectFile),
|
||||||
m_project(0), m_projectData(0)
|
m_project(0), m_projectData(0)
|
||||||
{
|
{
|
||||||
|
setIcon(m_projectIcon);
|
||||||
addFileNodes(QList<ProjectExplorer::FileNode *>()
|
addFileNodes(QList<ProjectExplorer::FileNode *>()
|
||||||
<< new ProjectExplorer::FileNode(projectFile, ProjectExplorer::ProjectFileType, false), this);
|
<< new ProjectExplorer::FileNode(projectFile, ProjectExplorer::ProjectFileType, false), this);
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,8 @@
|
|||||||
|
|
||||||
#include <api/projectdata.h>
|
#include <api/projectdata.h>
|
||||||
|
|
||||||
|
#include <QIcon>
|
||||||
|
|
||||||
namespace qbs { class Project; }
|
namespace qbs { class Project; }
|
||||||
|
|
||||||
namespace QbsProjectManager {
|
namespace QbsProjectManager {
|
||||||
@@ -128,6 +130,8 @@ private:
|
|||||||
|
|
||||||
const qbs::GroupData *m_group;
|
const qbs::GroupData *m_group;
|
||||||
QString m_productPath;
|
QString m_productPath;
|
||||||
|
|
||||||
|
static QIcon m_groupIcon;
|
||||||
};
|
};
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
@@ -150,6 +154,7 @@ private:
|
|||||||
QbsGroupNode *findGroupNode(const QString &name);
|
QbsGroupNode *findGroupNode(const QString &name);
|
||||||
|
|
||||||
const qbs::ProductData *m_product;
|
const qbs::ProductData *m_product;
|
||||||
|
static QIcon m_productIcon;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -174,6 +179,7 @@ private:
|
|||||||
|
|
||||||
const qbs::Project *m_project;
|
const qbs::Project *m_project;
|
||||||
const qbs::ProjectData *m_projectData;
|
const qbs::ProjectData *m_projectData;
|
||||||
|
static QIcon m_projectIcon;
|
||||||
};
|
};
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace QbsProjectManager
|
} // namespace QbsProjectManager
|
||||||
|
Reference in New Issue
Block a user