mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 15:44:04 -06:00
Recolor placeholder icon for packages/plugins correctly in dark-mode
As we don't want to recolor the icon if the package has a custom icon a `Image` or `UM.RecolorImage` is shown conditionally. CURA-8975
This commit is contained in:
parent
0e2848796c
commit
70f66648f4
1 changed files with 29 additions and 12 deletions
|
@ -24,7 +24,7 @@ Item
|
||||||
height: UM.Theme.getSize("card").height
|
height: UM.Theme.getSize("card").height
|
||||||
|
|
||||||
// card icon
|
// card icon
|
||||||
Image
|
Item
|
||||||
{
|
{
|
||||||
id: packageItem
|
id: packageItem
|
||||||
anchors
|
anchors
|
||||||
|
@ -35,19 +35,36 @@ Item
|
||||||
}
|
}
|
||||||
width: UM.Theme.getSize("card_icon").width
|
width: UM.Theme.getSize("card_icon").width
|
||||||
height: width
|
height: width
|
||||||
sourceSize.height: height
|
|
||||||
sourceSize.width: width
|
property bool packageHasIcon: packageData.iconUrl != ""
|
||||||
source:
|
|
||||||
|
Image
|
||||||
{
|
{
|
||||||
if (packageData.iconUrl != "")
|
visible: parent.packageHasIcon
|
||||||
|
anchors.fill: parent
|
||||||
|
source: packageData.iconUrl
|
||||||
|
sourceSize.height: height
|
||||||
|
sourceSize.width: width
|
||||||
|
}
|
||||||
|
|
||||||
|
UM.RecolorImage
|
||||||
|
{
|
||||||
|
visible: !parent.packageHasIcon
|
||||||
|
anchors.fill: parent
|
||||||
|
sourceSize.height: height
|
||||||
|
sourceSize.width: width
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
|
source:
|
||||||
{
|
{
|
||||||
return packageData.iconUrl
|
switch (packageData.packageType)
|
||||||
}
|
{
|
||||||
switch (packageData.packageType)
|
case "plugin":
|
||||||
{
|
return "../images/Plugin.svg";
|
||||||
case "plugin": return "../images/Plugin.svg";
|
case "material":
|
||||||
case "material": return "../images/Spool.svg";
|
return "../images/Spool.svg";
|
||||||
default: return "../images/placeholder.svg";
|
default:
|
||||||
|
return "../images/placeholder.svg";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue