ProjectExplorer: Show kit warnings and errors as overlay
Instead of having kits just a big warning or error icon Change-Id: I5b1c72c3c6ddd4cb646125c70d979431166d31f2 Reviewed-by: hjk <hjk@qt.io>
BIN
src/libs/utils/images/iconoverlay_add.png
Normal file
|
After Width: | Height: | Size: 186 B |
BIN
src/libs/utils/images/iconoverlay_add@2x.png
Normal file
|
After Width: | Height: | Size: 210 B |
BIN
src/libs/utils/images/iconoverlay_add_background.png
Normal file
|
After Width: | Height: | Size: 147 B |
BIN
src/libs/utils/images/iconoverlay_add_background@2x.png
Normal file
|
After Width: | Height: | Size: 225 B |
BIN
src/libs/utils/images/iconoverlay_error.png
Normal file
|
After Width: | Height: | Size: 157 B |
BIN
src/libs/utils/images/iconoverlay_error@2x.png
Normal file
|
After Width: | Height: | Size: 192 B |
BIN
src/libs/utils/images/iconoverlay_error_background.png
Normal file
|
After Width: | Height: | Size: 157 B |
BIN
src/libs/utils/images/iconoverlay_error_background@2x.png
Normal file
|
After Width: | Height: | Size: 177 B |
BIN
src/libs/utils/images/iconoverlay_warning.png
Normal file
|
After Width: | Height: | Size: 142 B |
BIN
src/libs/utils/images/iconoverlay_warning@2x.png
Normal file
|
After Width: | Height: | Size: 216 B |
BIN
src/libs/utils/images/iconoverlay_warning_background.png
Normal file
|
After Width: | Height: | Size: 141 B |
BIN
src/libs/utils/images/iconoverlay_warning_background@2x.png
Normal file
|
After Width: | Height: | Size: 221 B |
@@ -138,5 +138,17 @@
|
||||
<file>images/collapse@2x.png</file>
|
||||
<file>images/expand.png</file>
|
||||
<file>images/expand@2x.png</file>
|
||||
<file>images/iconoverlay_add.png</file>
|
||||
<file>images/iconoverlay_add@2x.png</file>
|
||||
<file>images/iconoverlay_add_background.png</file>
|
||||
<file>images/iconoverlay_add_background@2x.png</file>
|
||||
<file>images/iconoverlay_error.png</file>
|
||||
<file>images/iconoverlay_error@2x.png</file>
|
||||
<file>images/iconoverlay_error_background.png</file>
|
||||
<file>images/iconoverlay_error_background@2x.png</file>
|
||||
<file>images/iconoverlay_warning.png</file>
|
||||
<file>images/iconoverlay_warning@2x.png</file>
|
||||
<file>images/iconoverlay_warning_background.png</file>
|
||||
<file>images/iconoverlay_warning_background@2x.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -181,9 +181,15 @@ 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);
|
||||
const Icon OVERLAY_ADD({
|
||||
{":/utils/images/iconoverlay_add_background.png", Theme::BackgroundColorNormal},
|
||||
{":/utils/images/iconoverlay_add.png", Theme::IconsRunColor}}, Icon::Tint);
|
||||
const Icon OVERLAY_WARNING({
|
||||
{":/utils/images/iconoverlay_warning_background.png", Theme::BackgroundColorNormal},
|
||||
{":/utils/images/iconoverlay_warning.png", Theme::IconsWarningColor}}, Icon::Tint);
|
||||
const Icon OVERLAY_ERROR({
|
||||
{":/utils/images/iconoverlay_error_background.png", Theme::BackgroundColorNormal},
|
||||
{":/utils/images/iconoverlay_error.png", Theme::IconsErrorColor}}, Icon::Tint);
|
||||
|
||||
} // namespace Icons
|
||||
} // namespace Utils
|
||||
|
||||
@@ -107,7 +107,9 @@ 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;
|
||||
QTCREATOR_UTILS_EXPORT extern const Icon OVERLAY_ADD;
|
||||
QTCREATOR_UTILS_EXPORT extern const Icon OVERLAY_WARNING;
|
||||
QTCREATOR_UTILS_EXPORT extern const Icon OVERLAY_ERROR;
|
||||
|
||||
} // namespace Icons
|
||||
} // namespace Utils
|
||||
|
||||
|
Before Width: | Height: | Size: 152 B |
|
Before Width: | Height: | Size: 174 B |
|
Before Width: | Height: | Size: 95 B |
|
Before Width: | Height: | Size: 100 B |
@@ -73,9 +73,5 @@
|
||||
<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>
|
||||
|
||||
@@ -332,20 +332,6 @@ 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) {
|
||||
@@ -359,11 +345,11 @@ public:
|
||||
const Kit *k = KitManager::find(m_kitId);
|
||||
QTC_ASSERT(k, return QVariant());
|
||||
if (!isEnabled())
|
||||
return enableKitIcon(*k);
|
||||
return kitIconWithOverlay(*k, IconOverlay::Add);
|
||||
if (!k->isValid())
|
||||
return Utils::Icons::ERROR.icon();
|
||||
return kitIconWithOverlay(*k, IconOverlay::Error);
|
||||
if (k->hasWarning())
|
||||
return Utils::Icons::WARNING.icon();
|
||||
return kitIconWithOverlay(*k, IconOverlay::Warning);
|
||||
return k->icon();
|
||||
}
|
||||
|
||||
@@ -521,6 +507,45 @@ public:
|
||||
QPointer<Project> m_project; // Not owned.
|
||||
Id m_kitId;
|
||||
int m_currentChild = 1; // Use run page by default.
|
||||
|
||||
private:
|
||||
enum class IconOverlay {
|
||||
Add,
|
||||
Warning,
|
||||
Error
|
||||
};
|
||||
|
||||
static QIcon kitIconWithOverlay(const Kit &kit, IconOverlay overlayType)
|
||||
{
|
||||
QIcon overlayIcon;
|
||||
switch (overlayType) {
|
||||
case IconOverlay::Add: {
|
||||
static const QIcon add = Utils::Icons::OVERLAY_ADD.icon();
|
||||
overlayIcon = add;
|
||||
break;
|
||||
}
|
||||
case IconOverlay::Warning: {
|
||||
static const QIcon warning = Utils::Icons::OVERLAY_WARNING.icon();
|
||||
overlayIcon = warning;
|
||||
break;
|
||||
}
|
||||
case IconOverlay::Error: {
|
||||
static const QIcon err = Utils::Icons::OVERLAY_ERROR.icon();
|
||||
overlayIcon = err;
|
||||
break;
|
||||
}
|
||||
}
|
||||
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,
|
||||
overlayType == IconOverlay::Add ? QIcon::Disabled : QIcon::Normal);
|
||||
overlayIcon.paint(&p, iconRect);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
@@ -5950,7 +5950,7 @@
|
||||
r="5.5" />
|
||||
</g>
|
||||
<g
|
||||
id="src/plugins/projectexplorer/images/enablekitbackground"
|
||||
id="src/libs/utils/images/iconoverlay_add"
|
||||
transform="translate(112,0)">
|
||||
<rect
|
||||
id="rect5759-5-9-0-8-6-3"
|
||||
@@ -5962,15 +5962,38 @@
|
||||
<circle
|
||||
style="opacity:1;fill:#000000"
|
||||
id="path5134"
|
||||
cx="582.5"
|
||||
cy="375.5"
|
||||
r="3.5" />
|
||||
cx="580.5"
|
||||
cy="373.5"
|
||||
r="4.5" />
|
||||
<path
|
||||
style="fill:#ffffff;fill-opacity:1"
|
||||
d="m 581,371 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-7"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccccccccccc" />
|
||||
</g>
|
||||
<g
|
||||
id="src/plugins/projectexplorer/images/enablekitforeground"
|
||||
id="src/libs/utils/images/iconoverlay_add_background"
|
||||
transform="translate(128,0)">
|
||||
<rect
|
||||
id="rect5759-5-9-0-8-6-3-1"
|
||||
id="rect5759-5-9-0-8-6-3-0"
|
||||
height="16"
|
||||
width="16"
|
||||
y="363"
|
||||
x="570"
|
||||
style="fill:#ffffff" />
|
||||
<circle
|
||||
style="opacity:1;fill:#000000;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path5134-5"
|
||||
cx="580.5"
|
||||
cy="373.5"
|
||||
r="4.5" />
|
||||
</g>
|
||||
<g
|
||||
id="src/libs/utils/images/iconoverlay_warning"
|
||||
transform="translate(144,0)">
|
||||
<rect
|
||||
id="rect5759-5-9-0-8-6-3-9"
|
||||
height="16"
|
||||
width="16"
|
||||
y="363"
|
||||
@@ -5978,10 +6001,73 @@
|
||||
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"
|
||||
d="m 585,378 0,-0.45879 L 580.5,368.5 576,377.58517 576,378 Z"
|
||||
id="path5136"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccccccccccc" />
|
||||
sodipodi:nodetypes="cccccc" />
|
||||
<path
|
||||
id="path5164-0-1"
|
||||
style="fill:#ffffff;fill-opacity:1"
|
||||
d="m 581,376 0,1 -1,0 0,-1 z m 0,-4 -0.25,3 -0.5,0 -0.25,-3 z"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccccccc" />
|
||||
</g>
|
||||
<g
|
||||
id="src/libs/utils/images/iconoverlay_warning_background"
|
||||
transform="translate(160,0)">
|
||||
<rect
|
||||
id="rect5759-5-9-0-8-6-3-9-2"
|
||||
height="16"
|
||||
width="16"
|
||||
y="363"
|
||||
x="570"
|
||||
style="fill:#ffffff" />
|
||||
<path
|
||||
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 585,378 0,-0.45879 L 580.5,368.5 576,377.58517 576,378 Z"
|
||||
id="path5136-9"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccc" />
|
||||
</g>
|
||||
<g
|
||||
id="src/libs/utils/images/iconoverlay_error"
|
||||
transform="translate(176,0)">
|
||||
<rect
|
||||
id="rect5759-5-9-0-8-6-3-9-1"
|
||||
height="16"
|
||||
width="16"
|
||||
y="363"
|
||||
x="570"
|
||||
style="fill:#ffffff" />
|
||||
<path
|
||||
style="fill:#000000;fill-opacity:1"
|
||||
d="m 578.5,370 4,0 2.5,4 -2.5,4 -4,0 -2.5,-4 z"
|
||||
id="path5191"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccccc" />
|
||||
<path
|
||||
id="path5164-0"
|
||||
style="fill:#ffffff;fill-opacity:1"
|
||||
d="m 581,376 0,1 -1,0 0,-1 z m 0,-4 -0.25,3 -0.5,0 -0.25,-3 z"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccccccc" />
|
||||
</g>
|
||||
<g
|
||||
id="src/libs/utils/images/iconoverlay_error_background"
|
||||
transform="translate(192,0)">
|
||||
<rect
|
||||
id="rect5759-5-9-0-8-6-3-9-1-2"
|
||||
height="16"
|
||||
width="16"
|
||||
y="363"
|
||||
x="570"
|
||||
style="fill:#ffffff" />
|
||||
<path
|
||||
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 578.5,370 4,0 2.5,4 -2.5,4 -4,0 -2.5,-4 z"
|
||||
id="path5191-2"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccccc" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 209 KiB After Width: | Height: | Size: 212 KiB |