Skip to content

Commit 01680b2

Browse files
committed
Simplify version-specific profile selectors
1 parent 9b3e784 commit 01680b2

File tree

2 files changed

+26
-73
lines changed

2 files changed

+26
-73
lines changed

resources/qml/ProfileSelector51.qml

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,7 @@ Item
4747
Label
4848
{
4949
id: textLabel
50-
text:
51-
{
52-
if(isLE52) {
53-
return Cura.MachineManager.activeQualityDisplayNameMap["main"]
54-
} else {
55-
return Cura.MachineManager.activeQualityDisplayNameMainStringParts.join(" - ")
56-
}
57-
}
50+
text: Cura.MachineManager.activeQualityDisplayNameMap["main"]
5851
font: UM.Theme.getFont("default")
5952
color: UM.Theme.getColor("text")
6053
Layout.margins: 0
@@ -80,40 +73,29 @@ Item
8073

8174
function activeQualityDetailText()
8275
{
83-
if(isLE52) {
84-
var resultMap = Cura.MachineManager.activeQualityDisplayNameMap
85-
var resultSuffix = resultMap["suffix"]
86-
var result = ""
76+
var resultMap = Cura.MachineManager.activeQualityDisplayNameMap
77+
var resultSuffix = resultMap["suffix"]
78+
var result = ""
8779

88-
if (Cura.MachineManager.isActiveQualityExperimental)
89-
{
90-
resultSuffix += " (Experimental)"
91-
}
80+
if (Cura.MachineManager.isActiveQualityExperimental)
81+
{
82+
resultSuffix += " (Experimental)"
83+
}
9284

93-
if (Cura.MachineManager.isActiveQualitySupported)
85+
if (Cura.MachineManager.isActiveQualitySupported)
86+
{
87+
if (Cura.MachineManager.activeQualityLayerHeight > 0)
9488
{
95-
if (Cura.MachineManager.activeQualityLayerHeight > 0)
89+
if (resultSuffix)
9690
{
97-
if (resultSuffix)
98-
{
99-
result += " - " + resultSuffix
100-
}
101-
result += " - "
102-
result += Cura.MachineManager.activeQualityLayerHeight + "mm"
91+
result += " - " + resultSuffix
10392
}
104-
}
105-
return result
106-
} else {
107-
const string_parts = Cura.MachineManager.activeQualityDisplayNameTailStringParts;
108-
if (string_parts.length === 0)
109-
{
110-
return "";
111-
}
112-
else
113-
{
114-
return ` - ${string_parts.join(" - ")}`
93+
result += " - "
94+
result += Cura.MachineManager.activeQualityLayerHeight + "mm"
11595
}
11696
}
97+
98+
return result
11799
}
118100
}
119101
}

resources/qml/ProfileSelector53.qml

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ Item
4949
id: textLabel
5050
text:
5151
{
52-
if(isLE52) {
53-
return Cura.MachineManager.activeQualityDisplayNameMap["main"]
54-
} else {
55-
return Cura.MachineManager.activeQualityDisplayNameMainStringParts.join(" - ")
56-
}
52+
return Cura.MachineManager.activeQualityDisplayNameMainStringParts.join(" - ")
5753
}
5854
font: UM.Theme.getFont("default")
5955
color: UM.Theme.getColor("text")
@@ -80,39 +76,14 @@ Item
8076

8177
function activeQualityDetailText()
8278
{
83-
if(isLE52) {
84-
var resultMap = Cura.MachineManager.activeQualityDisplayNameMap
85-
var resultSuffix = resultMap["suffix"]
86-
var result = ""
87-
88-
if (Cura.MachineManager.isActiveQualityExperimental)
89-
{
90-
resultSuffix += " (Experimental)"
91-
}
92-
93-
if (Cura.MachineManager.isActiveQualitySupported)
94-
{
95-
if (Cura.MachineManager.activeQualityLayerHeight > 0)
96-
{
97-
if (resultSuffix)
98-
{
99-
result += " - " + resultSuffix
100-
}
101-
result += " - "
102-
result += Cura.MachineManager.activeQualityLayerHeight + "mm"
103-
}
104-
}
105-
return result
106-
} else {
107-
const string_parts = Cura.MachineManager.activeQualityDisplayNameTailStringParts;
108-
if (string_parts.length === 0)
109-
{
110-
return "";
111-
}
112-
else
113-
{
114-
return ` - ${string_parts.join(" - ")}`
115-
}
79+
const string_parts = Cura.MachineManager.activeQualityDisplayNameTailStringParts;
80+
if (string_parts.length === 0)
81+
{
82+
return "";
83+
}
84+
else
85+
{
86+
return ` - ${string_parts.join(" - ")}`
11687
}
11788
}
11889
}

0 commit comments

Comments
 (0)