mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 03:46:05 +08:00
Use enumeration to check and switch state of configuration menu
Instead of a string. This is a bit more restrictive. Contributes to issue CURA-5876.
This commit is contained in:
parent
7cc1f021c1
commit
347240410a
@ -28,6 +28,12 @@ Cura.ExpandableComponent
|
|||||||
name: "cura"
|
name: "cura"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum ConfigurationMethod
|
||||||
|
{
|
||||||
|
AUTO,
|
||||||
|
CUSTOM
|
||||||
|
}
|
||||||
|
|
||||||
iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
|
iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
|
||||||
headerItem: Item
|
headerItem: Item
|
||||||
{
|
{
|
||||||
@ -108,7 +114,7 @@ Cura.ExpandableComponent
|
|||||||
is_connected = Cura.MachineManager.activeMachineNetworkKey !== "" && Cura.MachineManager.printerConnected //Re-evaluate.
|
is_connected = Cura.MachineManager.activeMachineNetworkKey !== "" && Cura.MachineManager.printerConnected //Re-evaluate.
|
||||||
}
|
}
|
||||||
|
|
||||||
property var configuration_method: is_connected ? "auto" : "custom" //Auto if connected to a printer at start-up, or Custom if not.
|
property int configuration_method: is_connected ? ConfigurationMenu.ConfigurationMethod.AUTO : ConfigurationMenu.ConfigurationMethod.CUSTOM //Auto if connected to a printer at start-up, or Custom if not.
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
@ -117,13 +123,13 @@ Cura.ExpandableComponent
|
|||||||
AutoConfiguration
|
AutoConfiguration
|
||||||
{
|
{
|
||||||
id: autoConfiguration
|
id: autoConfiguration
|
||||||
visible: popupItem.configuration_method === "auto"
|
visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.AUTO
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomConfiguration
|
CustomConfiguration
|
||||||
{
|
{
|
||||||
id: customConfiguration
|
id: customConfiguration
|
||||||
visible: popupItem.configuration_method === "custom"
|
visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.CUSTOM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +156,7 @@ Cura.ExpandableComponent
|
|||||||
Cura.SecondaryButton
|
Cura.SecondaryButton
|
||||||
{
|
{
|
||||||
id: goToCustom
|
id: goToCustom
|
||||||
visible: popupItem.configuration_method === "auto"
|
visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.AUTO
|
||||||
text: catalog.i18nc("@label", "Custom")
|
text: catalog.i18nc("@label", "Custom")
|
||||||
|
|
||||||
anchors
|
anchors
|
||||||
@ -162,13 +168,13 @@ Cura.ExpandableComponent
|
|||||||
iconSource: UM.Theme.getIcon("arrow_right")
|
iconSource: UM.Theme.getIcon("arrow_right")
|
||||||
iconOnRightSide: true
|
iconOnRightSide: true
|
||||||
|
|
||||||
onClicked: popupItem.configuration_method = "custom"
|
onClicked: popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.CUSTOM
|
||||||
}
|
}
|
||||||
|
|
||||||
Cura.SecondaryButton
|
Cura.SecondaryButton
|
||||||
{
|
{
|
||||||
id: goToAuto
|
id: goToAuto
|
||||||
visible: popupItem.configuration_method === "custom"
|
visible: popupItem.configuration_method == ConfigurationMenu.ConfigurationMethod.CUSTOM
|
||||||
text: catalog.i18nc("@label", "Configurations")
|
text: catalog.i18nc("@label", "Configurations")
|
||||||
|
|
||||||
anchors
|
anchors
|
||||||
@ -179,7 +185,7 @@ Cura.ExpandableComponent
|
|||||||
|
|
||||||
iconSource: UM.Theme.getIcon("arrow_left")
|
iconSource: UM.Theme.getIcon("arrow_left")
|
||||||
|
|
||||||
onClicked: popupItem.configuration_method = "auto"
|
onClicked: popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.AUTO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user