forked from qt-creator/qt-creator
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:
@@ -181,6 +181,9 @@ const Icon COLLAPSE({
|
||||
const Icon COLLAPSE_TOOLBAR({
|
||||
{QLatin1String(":/utils/images/collapse.png"), Theme::IconsBaseColor}});
|
||||
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 Utils
|
||||
|
||||
@@ -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_TOOLBAR;
|
||||
QTCREATOR_UTILS_EXPORT extern const Icon EMPTY14;
|
||||
QTCREATOR_UTILS_EXPORT extern const Icon ENABLE_KIT_OVERLAY;
|
||||
|
||||
} // namespace Icons
|
||||
} // namespace Utils
|
||||
|
||||
BIN
src/plugins/projectexplorer/images/enablekitbackground.png
Normal file
BIN
src/plugins/projectexplorer/images/enablekitbackground.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 152 B |
BIN
src/plugins/projectexplorer/images/enablekitbackground@2x.png
Normal file
BIN
src/plugins/projectexplorer/images/enablekitbackground@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 174 B |
BIN
src/plugins/projectexplorer/images/enablekitforeground.png
Normal file
BIN
src/plugins/projectexplorer/images/enablekitforeground.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 95 B |
BIN
src/plugins/projectexplorer/images/enablekitforeground@2x.png
Normal file
BIN
src/plugins/projectexplorer/images/enablekitforeground@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 100 B |
@@ -73,5 +73,9 @@
|
||||
<file>images/fileoverlay_h@2x.png</file>
|
||||
<file>images/fileoverlay_unknown.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>
|
||||
</RCC>
|
||||
|
||||
@@ -57,11 +57,13 @@
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QApplication>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFileDialog>
|
||||
#include <QLabel>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QPainter>
|
||||
#include <QPushButton>
|
||||
#include <QTimer>
|
||||
#include <QToolTip>
|
||||
@@ -336,6 +338,20 @@ public:
|
||||
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
|
||||
{
|
||||
switch (role) {
|
||||
@@ -346,10 +362,10 @@ public:
|
||||
}
|
||||
|
||||
case Qt::DecorationRole: {
|
||||
if (!isEnabled())
|
||||
return Utils::Icons::PLUS.icon();
|
||||
Kit *k = KitManager::find(m_kitId);
|
||||
const Kit *k = KitManager::find(m_kitId);
|
||||
QTC_ASSERT(k, return QVariant());
|
||||
if (!isEnabled())
|
||||
return enableKitIcon(*k);
|
||||
if (!k->isValid())
|
||||
return Utils::Icons::ERROR.icon();
|
||||
if (k->hasWarning())
|
||||
|
||||
@@ -5949,5 +5949,39 @@
|
||||
cy="577.5"
|
||||
r="5.5" />
|
||||
</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>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 208 KiB After Width: | Height: | Size: 209 KiB |
Reference in New Issue
Block a user