blob: cde2cd8dfcb212476c9394292444ab46e13d787f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
|
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Controls 1.4 as OldControls
import QtQuick.Layouts 1.3
import UM 1.3 as UM
import Cura 1.6 as Cura
import ".."
Item
{
id: customPrintSetup
property real padding: UM.Theme.getSize("default_margin").width
property bool multipleExtruders: extrudersModel.count > 1
property var extrudersModel: CuraApplication.getExtrudersModel()
Item
{
id: intent
height: childrenRect.height
anchors
{
top: parent.top
topMargin: UM.Theme.getSize("default_margin").height
left: parent.left
leftMargin: parent.padding
right: parent.right
rightMargin: parent.padding
}
Label
{
id: profileLabel
anchors
{
top: parent.top
bottom: parent.bottom
left: parent.left
right: intentSelection.left
}
text: catalog.i18nc("@label", "Profile")
font: UM.Theme.getFont("medium")
renderType: Text.NativeRendering
color: UM.Theme.getColor("text")
verticalAlignment: Text.AlignVCenter
}
NoIntentIcon
{
affected_extruders: Cura.MachineManager.extruderPositionsWithNonActiveIntent
intent_type: Cura.MachineManager.activeIntentCategory
anchors.right: intentSelection.left
anchors.rightMargin: UM.Theme.getSize("narrow_margin").width
width: Math.round(profileLabel.height * 0.5)
anchors.verticalCenter: parent.verticalCenter
height: width
visible: affected_extruders.length
}
Button
{
id: intentSelection
onClicked: menu.opened ? menu.close() : menu.open()
anchors.right: parent.right
width: UM.Theme.getSize("print_setup_big_item").width
height: textLabel.contentHeight + 2 * UM.Theme.getSize("narrow_margin").height
hoverEnabled: true
contentItem: RowLayout
{
spacing: 0
anchors.left: parent.left
anchors.right: customisedSettings.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
Label
{
id: textLabel
text: Cura.MachineManager.activeQualityDisplayNameMap["main"]
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text")
Layout.margins: 0
Layout.maximumWidth: Math.floor(parent.width * 0.7) // Always leave >= 30% for the rest of the row.
height: contentHeight
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
elide: Text.ElideRight
}
Label
{
text: activeQualityDetailText()
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text_detail")
Layout.margins: 0
Layout.fillWidth: true
height: contentHeight
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
elide: Text.ElideRight
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
}
}
}
background: Rectangle
{
id: backgroundItem
border.color: intentSelection.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
border.width: UM.Theme.getSize("default_lining").width
radius: UM.Theme.getSize("default_radius").width
color: UM.Theme.getColor("main_background")
}
UM.SimpleButton
{
id: customisedSettings
visible: Cura.MachineManager.hasUserSettings
width: UM.Theme.getSize("print_setup_icon").width
height: UM.Theme.getSize("print_setup_icon").height
anchors.verticalCenter: parent.verticalCenter
anchors.right: downArrow.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button");
iconSource: UM.Theme.getIcon("StarFilled")
onClicked:
{
forceActiveFocus();
Cura.Actions.manageProfiles.trigger()
}
onEntered:
{
var content = catalog.i18nc("@tooltip", "Some setting/override values are different from the values stored in the profile.\n\nClick to open the profile manager.")
base.showTooltip(intent, Qt.point(-UM.Theme.getSize("default_margin").width, 0), content)
}
onExited: base.hideTooltip()
}
UM.RecolorImage
{
id: downArrow
source: UM.Theme.getIcon("ChevronSingleDown")
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
anchors
{
right: parent.right
verticalCenter: parent.verticalCenter
rightMargin: UM.Theme.getSize("default_margin").width
}
color: UM.Theme.getColor("setting_control_button")
}
}
QualitiesWithIntentMenu
{
id: menu
y: intentSelection.y + intentSelection.height
x: intentSelection.x
width: intentSelection.width
}
}
UM.TabRow
{
id: tabBar
visible: multipleExtruders // The tab row is only visible when there are more than 1 extruder
anchors
{
top: intent.bottom
topMargin: UM.Theme.getSize("default_margin").height
left: parent.left
leftMargin: parent.padding
right: parent.right
rightMargin: parent.padding
}
Repeater
{
id: repeater
model: extrudersModel
delegate: UM.TabRowButton
{
contentItem: Item
{
Cura.ExtruderIcon
{
anchors.centerIn: parent
materialColor: model.color
extruderEnabled: model.enabled
iconVariant: "default"
height: parent.height
width: height
}
}
onClicked:
{
Cura.ExtruderManager.setActiveExtruderIndex(tabBar.currentIndex)
}
}
}
//When active extruder changes for some other reason, switch tabs.
//Don't directly link currentIndex to Cura.ExtruderManager.activeExtruderIndex!
//This causes a segfault in Qt 5.11. Something with VisualItemModel removing index -1. We have to use setCurrentIndex instead.
Connections
{
target: Cura.ExtruderManager
function onActiveExtruderChanged()
{
tabBar.setCurrentIndex(Cura.ExtruderManager.activeExtruderIndex);
}
}
//When the model of the extruders is rebuilt, the list of extruders is briefly emptied and rebuilt.
//This causes the currentIndex of the tab to be in an invalid position which resets it to 0.
//Therefore we need to change it back to what it was: The active extruder index.
Connections
{
target: repeater.model
function onModelChanged()
{
tabBar.setCurrentIndex(Cura.ExtruderManager.activeExtruderIndex)
}
}
}
Rectangle
{
anchors
{
top: tabBar.visible ? tabBar.bottom : intent.bottom
topMargin: -UM.Theme.getSize("default_lining").width
left: parent.left
leftMargin: parent.padding
right: parent.right
rightMargin: parent.padding
bottom: parent.bottom
}
z: tabBar.z - 1
// Don't show the border when only one extruder
border.color: tabBar.visible ? UM.Theme.getColor("lining") : "transparent"
border.width: UM.Theme.getSize("default_lining").width
color: UM.Theme.getColor("main_background")
Cura.SettingView
{
anchors
{
fill: parent
topMargin: UM.Theme.getSize("default_margin").height
leftMargin: UM.Theme.getSize("default_margin").width
// Small space for the scrollbar
rightMargin: UM.Theme.getSize("narrow_margin").width
// Compensate for the negative margin in the parent
bottomMargin: UM.Theme.getSize("default_lining").width
}
}
}
}
|