mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 18:36:05 +08:00
Add menu to react on the hamburger menu
CURA-8949
This commit is contained in:
parent
8feaa32769
commit
2d0ce01ff5
@ -20,6 +20,7 @@ UM.ManagementPage
|
|||||||
|
|
||||||
activeId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id: ""
|
activeId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id: ""
|
||||||
activeIndex: activeMachineIndex()
|
activeIndex: activeMachineIndex()
|
||||||
|
onHamburgeButtonClicked: menu.popup(content_item, content_item.width - menu.width, hamburger_button.height)
|
||||||
|
|
||||||
function activeMachineIndex()
|
function activeMachineIndex()
|
||||||
{
|
{
|
||||||
@ -34,44 +35,21 @@ UM.ManagementPage
|
|||||||
}
|
}
|
||||||
|
|
||||||
buttons: [
|
buttons: [
|
||||||
Button
|
Cura.SecondaryButton
|
||||||
{
|
|
||||||
id: activateMenuButton
|
|
||||||
text: catalog.i18nc("@action:button", "Activate")
|
|
||||||
icon.name: "list-activate"
|
|
||||||
enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMachine.id
|
|
||||||
onClicked: Cura.MachineManager.setActiveMachine(base.currentItem.id)
|
|
||||||
},
|
|
||||||
Button
|
|
||||||
{
|
{
|
||||||
id: addMenuButton
|
id: addMenuButton
|
||||||
text: catalog.i18nc("@action:button", "Add")
|
text: catalog.i18nc("@action:button", "Add New")
|
||||||
icon.name: "list-add"
|
|
||||||
onClicked: Cura.Actions.addMachine.trigger()
|
onClicked: Cura.Actions.addMachine.trigger()
|
||||||
},
|
|
||||||
Button
|
|
||||||
{
|
|
||||||
id: removeMenuButton
|
|
||||||
text: catalog.i18nc("@action:button", "Remove")
|
|
||||||
icon.name: "list-remove"
|
|
||||||
enabled: base.currentItem != null && model.count > 1
|
|
||||||
onClicked: confirmDialog.open()
|
|
||||||
},
|
|
||||||
Button
|
|
||||||
{
|
|
||||||
id: renameMenuButton
|
|
||||||
text: catalog.i18nc("@action:button", "Rename")
|
|
||||||
icon.name: "edit-rename"
|
|
||||||
enabled: base.currentItem != null && base.currentItem.metadata.group_name == null
|
|
||||||
onClicked: renameDialog.open()
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
|
id: content_item
|
||||||
visible: base.currentItem != null
|
visible: base.currentItem != null
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
|
||||||
UM.Label
|
UM.Label
|
||||||
{
|
{
|
||||||
id: machineName
|
id: machineName
|
||||||
@ -167,6 +145,28 @@ UM.ManagementPage
|
|||||||
objectList.onCurrentIndexChanged()
|
objectList.onCurrentIndexChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Cura.Menu
|
||||||
|
{
|
||||||
|
id: menu
|
||||||
|
Cura.MenuItem
|
||||||
|
{
|
||||||
|
text: catalog.i18nc("@action:button", "Activate")
|
||||||
|
enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMachine.id
|
||||||
|
onTriggered: Cura.MachineManager.setActiveMachine(base.currentItem.id)
|
||||||
|
}
|
||||||
|
Cura.MenuItem
|
||||||
|
{
|
||||||
|
text: catalog.i18nc("@action:button", "Remove")
|
||||||
|
enabled: base.currentItem != null && model.count > 1
|
||||||
|
onTriggered: confirmDialog.open()
|
||||||
|
}
|
||||||
|
Cura.MenuItem
|
||||||
|
{
|
||||||
|
text: catalog.i18nc("@action:button", "Rename")
|
||||||
|
enabled: base.currentItem != null && base.currentItem.metadata.group_name == null
|
||||||
|
onTriggered: renameDialog.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Connections
|
Connections
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user