mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-25 11:51:41 -07:00
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:
parent
e8f6786e97
commit
52ee149edc
3 changed files with 46 additions and 71 deletions
|
|
@ -67,7 +67,7 @@ Item
|
|||
UM.Label
|
||||
{
|
||||
id: textLabel
|
||||
text: Cura.MachineManager.activeQualityDisplayNameMap["main"]
|
||||
text: Cura.MachineManager.activeQualityDisplayNameStringParts[0]
|
||||
Layout.margins: 0
|
||||
Layout.maximumWidth: Math.floor(parent.width * 0.7) // Always leave >= 30% for the rest of the row.
|
||||
height: contentHeight
|
||||
|
|
@ -77,7 +77,8 @@ Item
|
|||
|
||||
UM.Label
|
||||
{
|
||||
text: activeQualityDetailText()
|
||||
text: Cura.MachineManager.activeQualityDisplayNameStringParts.slice(1).join(" - ")
|
||||
|
||||
color: UM.Theme.getColor("text_detail")
|
||||
Layout.margins: 0
|
||||
Layout.fillWidth: true
|
||||
|
|
@ -85,32 +86,6 @@ Item
|
|||
height: contentHeight
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.NoWrap
|
||||
function activeQualityDetailText()
|
||||
{
|
||||
var resultMap = Cura.MachineManager.activeQualityDisplayNameMap
|
||||
var resultSuffix = resultMap["suffix"]
|
||||
var result = ""
|
||||
|
||||
if (Cura.MachineManager.isActiveQualityExperimental)
|
||||
{
|
||||
resultSuffix += " (Experimental)"
|
||||
}
|
||||
|
||||
if (Cura.MachineManager.isActiveQualitySupported)
|
||||
{
|
||||
if (Cura.MachineManager.activeQualityLayerHeight > 0)
|
||||
{
|
||||
if (resultSuffix)
|
||||
{
|
||||
result += " - " + resultSuffix
|
||||
}
|
||||
result += " - "
|
||||
result += Cura.MachineManager.activeQualityLayerHeight + "mm"
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue