ProjectExplorer: Icon for enabling kits in the project mode

Disabled kit icon plus small "+" overlay.

Change-Id: I58df0da662baf9977382733e8d003766bd232281
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Alessandro Portale
2016-09-28 22:15:47 +02:00
parent 7261276d0a
commit 7bbebdeb48
9 changed files with 61 additions and 3 deletions

View File

@@ -181,6 +181,9 @@ const Icon COLLAPSE({
const Icon COLLAPSE_TOOLBAR({ const Icon COLLAPSE_TOOLBAR({
{QLatin1String(":/utils/images/collapse.png"), Theme::IconsBaseColor}}); {QLatin1String(":/utils/images/collapse.png"), Theme::IconsBaseColor}});
const Icon EMPTY14(":/utils/images/empty14.png"); const Icon EMPTY14(":/utils/images/empty14.png");
const Icon ENABLE_KIT_OVERLAY({
{":/projectexplorer/images/enablekitbackground.png", Theme::IconsRunColor},
{":/projectexplorer/images/enablekitforeground.png", Theme::BackgroundColorNormal}}, Icon::Tint);
} // namespace Icons } // namespace Icons
} // namespace Utils } // namespace Utils

View File

@@ -107,6 +107,7 @@ QTCREATOR_UTILS_EXPORT extern const Icon EXPAND_TOOLBAR;
QTCREATOR_UTILS_EXPORT extern const Icon COLLAPSE; QTCREATOR_UTILS_EXPORT extern const Icon COLLAPSE;
QTCREATOR_UTILS_EXPORT extern const Icon COLLAPSE_TOOLBAR; QTCREATOR_UTILS_EXPORT extern const Icon COLLAPSE_TOOLBAR;
QTCREATOR_UTILS_EXPORT extern const Icon EMPTY14; QTCREATOR_UTILS_EXPORT extern const Icon EMPTY14;
QTCREATOR_UTILS_EXPORT extern const Icon ENABLE_KIT_OVERLAY;
} // namespace Icons } // namespace Icons
} // namespace Utils } // namespace Utils

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B

View File

@@ -73,5 +73,9 @@
<file>images/fileoverlay_h@2x.png</file> <file>images/fileoverlay_h@2x.png</file>
<file>images/fileoverlay_unknown.png</file> <file>images/fileoverlay_unknown.png</file>
<file>images/fileoverlay_unknown@2x.png</file> <file>images/fileoverlay_unknown@2x.png</file>
<file>images/enablekitbackground.png</file>
<file>images/enablekitbackground@2x.png</file>
<file>images/enablekitforeground.png</file>
<file>images/enablekitforeground@2x.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@@ -57,11 +57,13 @@
#include <utils/utilsicons.h> #include <utils/utilsicons.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QApplication>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QFileDialog> #include <QFileDialog>
#include <QLabel> #include <QLabel>
#include <QMenu> #include <QMenu>
#include <QMessageBox> #include <QMessageBox>
#include <QPainter>
#include <QPushButton> #include <QPushButton>
#include <QTimer> #include <QTimer>
#include <QToolTip> #include <QToolTip>
@@ -336,6 +338,20 @@ public:
return Qt::ItemFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); return Qt::ItemFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
} }
static QIcon enableKitIcon(const Kit &kit)
{
static const QIcon overlay = Utils::Icons::ENABLE_KIT_OVERLAY.icon();
const QSize iconSize(16, 16);
const QRect iconRect(QPoint(), iconSize);
QPixmap result(iconSize * qApp->devicePixelRatio());
result.fill(Qt::transparent);
result.setDevicePixelRatio(qApp->devicePixelRatio());
QPainter p(&result);
kit.icon().paint(&p, iconRect, Qt::AlignCenter, QIcon::Disabled);
overlay.paint(&p, iconRect);
return result;
}
QVariant data(int column, int role) const override QVariant data(int column, int role) const override
{ {
switch (role) { switch (role) {
@@ -346,10 +362,10 @@ public:
} }
case Qt::DecorationRole: { case Qt::DecorationRole: {
if (!isEnabled()) const Kit *k = KitManager::find(m_kitId);
return Utils::Icons::PLUS.icon();
Kit *k = KitManager::find(m_kitId);
QTC_ASSERT(k, return QVariant()); QTC_ASSERT(k, return QVariant());
if (!isEnabled())
return enableKitIcon(*k);
if (!k->isValid()) if (!k->isValid())
return Utils::Icons::ERROR.icon(); return Utils::Icons::ERROR.icon();
if (k->hasWarning()) if (k->hasWarning())

View File

@@ -5949,5 +5949,39 @@
cy="577.5" cy="577.5"
r="5.5" /> r="5.5" />
</g> </g>
<g
id="src/plugins/projectexplorer/images/enablekitbackground"
transform="translate(112,0)">
<rect
id="rect5759-5-9-0-8-6-3"
height="16"
width="16"
y="363"
x="570"
style="fill:#ffffff" />
<circle
style="opacity:1;fill:#000000"
id="path5134"
cx="582.5"
cy="375.5"
r="3.5" />
</g>
<g
id="src/plugins/projectexplorer/images/enablekitforeground"
transform="translate(128,0)">
<rect
id="rect5759-5-9-0-8-6-3-1"
height="16"
width="16"
y="363"
x="570"
style="fill:#ffffff" />
<path
style="fill:#000000;fill-opacity:1"
d="m 583,373 0,2 2,0 0,1 -2,0 0,2 -1,0 0,-2 -2,0 0,-1 2,0 0,-2 z"
id="path5157"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccccccc" />
</g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 208 KiB

After

Width:  |  Height:  |  Size: 209 KiB