Allow for custom descriptions/icons in packaged intents

CURA-9709
This commit is contained in:
c.lamboo 2023-05-31 12:54:56 +02:00
parent af12166595
commit 27cc89ff89
6 changed files with 72 additions and 54 deletions

View file

@ -1,4 +1,4 @@
// Copyright (c) 2022 Ultimaker B.V.
// Copyright (c) 2023 UltiMaker
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
@ -32,6 +32,7 @@ Item
{
profileName: model.name
icon: model.icon
custom_icon: model.custom_icon
tooltipText: model.description ? model.description : ""
selected: Cura.MachineManager.activeIntentCategory == model.intent_category

View file

@ -1,4 +1,4 @@
// Copyright (c) 2022 Ultimaker B.V.
// Copyright (c) 2023 UltiMaker
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
@ -19,6 +19,7 @@ Rectangle
property bool selected: false
property string profileName: ""
property string icon: ""
property string custom_icon: ""
property alias tooltipText: tooltip.text
signal clicked()
@ -55,22 +56,32 @@ Rectangle
id: intentIcon
width: UM.Theme.getSize("recommended_button_icon").width
height: UM.Theme.getSize("recommended_button_icon").height
UM.ColorImage
{
anchors.fill: parent
anchors.centerIn: parent
visible: icon != ""
visible: icon !== ""
source: UM.Theme.getIcon(icon)
color: UM.Theme.getColor("icon")
}
UM.ColorImage
{
anchors.fill: parent
anchors.centerIn: parent
visible: custom_icon !== ""
source: custom_icon
color: UM.Theme.getColor("icon")
}
Rectangle
{
id: circle
anchors.fill: parent
radius: width
anchors.verticalCenter: parent.verticalCenter
visible: icon == ""
visible: icon === "" && custom_icon === ""
border.width: UM.Theme.getSize("thick_lining").width
border.color: UM.Theme.getColor("text")