Unify activeQualityDisplayNameMap string creation

Generation quality display names in `CustomPrintSetup.qml` and `PrintSetupSelectorHeader.qml` were so similar that I decided to combine the logic.

Cura-9773
This commit is contained in:
c.lamboo 2022-11-25 16:09:55 +01:00
parent e8f6786e97
commit 52ee149edc
3 changed files with 46 additions and 71 deletions

View file

@ -17,26 +17,8 @@ RowLayout
{
source: UM.Theme.getIcon("Sliders", "medium")
iconSize: UM.Theme.getSize("button_icon").width
text:
{
if (Cura.MachineManager.activeStack)
{
var resultMap = Cura.MachineManager.activeQualityDisplayNameMap
var text = resultMap["main"]
if (resultMap["suffix"])
{
text += " - " + resultMap["suffix"]
}
if (!Cura.MachineManager.hasNotSupportedQuality)
{
text += " - " + layerHeight.properties.value + "mm"
text += Cura.MachineManager.isActiveQualityExperimental ? " - " + catalog.i18nc("@label", "Experimental") : ""
}
return text
}
return ""
}
text: Cura.MachineManager.activeQualityDisplayNameStringParts.join(" - ")
font: UM.Theme.getFont("medium")
elide: Text.ElideMiddle
wrapMode: Text.NoWrap