|
27 | 27 | width: parent.width |
28 | 28 | height: childrenRect.height |
29 | 29 |
|
30 | | - UM.Label |
| 30 | + UM.SettingPropertyProvider |
31 | 31 | { |
32 | | - id: header |
33 | | - text: catalog.i18nc("@header", "Custom") |
34 | | - font: UM.Theme.getFont("medium") |
35 | | - color: UM.Theme.getColor("small_button_text") |
36 | | - height: contentHeight |
| 32 | + id: machineExtruderCountProvider |
| 33 | + containerStack: Cura.MachineManager.activeMachine |
| 34 | + key: "machine_extruder_count" |
| 35 | + watchedProperties: ["value"] |
| 36 | + storeIndex: 0 |
| 37 | + } |
| 38 | + |
| 39 | + property int currentExtruderCount: machineExtruderCountProvider.properties.value ? machineExtruderCountProvider.properties.value : 1 |
| 40 | + property int maxExtruderCount: Cura.MachineManager.activeMachine ? Cura.MachineManager.activeMachine.maxExtruderCount : 1 |
| 41 | + |
| 42 | + Row |
| 43 | + { |
| 44 | + id: headerRow |
| 45 | + width: parent.width |
| 46 | + height: header.height |
| 47 | + spacing: UM.Theme.getSize("default_margin").width |
37 | 48 |
|
38 | 49 | anchors |
39 | 50 | { |
40 | 51 | top: parent.top |
41 | 52 | left: parent.left |
42 | 53 | right: parent.right |
43 | 54 | } |
| 55 | + |
| 56 | + UM.Label |
| 57 | + { |
| 58 | + id: header |
| 59 | + text: catalog.i18nc("@header", "Custom") |
| 60 | + font: UM.Theme.getFont("medium") |
| 61 | + color: UM.Theme.getColor("small_button_text") |
| 62 | + height: contentHeight |
| 63 | + anchors.verticalCenter: parent.verticalCenter |
| 64 | + } |
| 65 | + |
| 66 | + // Spacer to push buttons to the right |
| 67 | + Item |
| 68 | + { |
| 69 | + width: parent.width - header.width - decreaseExtruderButton.width - increaseExtruderButton.width - parent.spacing * 3 |
| 70 | + height: 1 |
| 71 | + } |
| 72 | + |
| 73 | + UM.SimpleButton |
| 74 | + { |
| 75 | + id: decreaseExtruderButton |
| 76 | + width: UM.Theme.getSize("medium_button_icon").width |
| 77 | + height: UM.Theme.getSize("medium_button_icon").height |
| 78 | + iconSource: UM.Theme.getIcon("Minus") |
| 79 | + color: UM.Theme.getColor("icon") |
| 80 | + hoverColor: UM.Theme.getColor("icon_hover") |
| 81 | + anchors.verticalCenter: parent.verticalCenter |
| 82 | + |
| 83 | + enabled: currentExtruderCount > 1 |
| 84 | + |
| 85 | + onClicked: |
| 86 | + { |
| 87 | + if (currentExtruderCount > 1) |
| 88 | + { |
| 89 | + Cura.MachineManager.setActiveMachineExtruderCount(currentExtruderCount - 1); |
| 90 | + } |
| 91 | + } |
| 92 | + } |
| 93 | + |
| 94 | + UM.SimpleButton |
| 95 | + { |
| 96 | + id: increaseExtruderButton |
| 97 | + width: UM.Theme.getSize("medium_button_icon").width |
| 98 | + height: UM.Theme.getSize("medium_button_icon").height |
| 99 | + iconSource: UM.Theme.getIcon("Plus") |
| 100 | + color: UM.Theme.getColor("icon") |
| 101 | + hoverColor: UM.Theme.getColor("icon_hover") |
| 102 | + anchors.verticalCenter: parent.verticalCenter |
| 103 | + |
| 104 | + enabled: currentExtruderCount < maxExtruderCount |
| 105 | + |
| 106 | + onClicked: |
| 107 | + { |
| 108 | + if (currentExtruderCount < maxExtruderCount) |
| 109 | + { |
| 110 | + Cura.MachineManager.setActiveMachineExtruderCount(currentExtruderCount + 1); |
| 111 | + } |
| 112 | + } |
| 113 | + } |
44 | 114 | } |
45 | 115 |
|
46 | 116 | UM.TabRow |
47 | 117 | { |
48 | 118 | id: tabBar |
49 | | - anchors.top: header.bottom |
| 119 | + anchors.top: headerRow.bottom |
50 | 120 | anchors.topMargin: UM.Theme.getSize("default_margin").height |
51 | 121 | visible: extrudersModel.count > 1 |
52 | 122 |
|
|
0 commit comments