SettingsMenu.qml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //Copyright (c) 2020 Ultimaker B.V.
  2. //Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Controls 1.4
  5. import UM 1.2 as UM
  6. import Cura 1.0 as Cura
  7. Menu
  8. {
  9. id: base
  10. title: catalog.i18nc("@title:menu menubar:toplevel", "&Settings")
  11. PrinterMenu { title: catalog.i18nc("@title:menu menubar:settings", "&Printer") }
  12. property var activeMachine: Cura.MachineManager.activeMachine
  13. Instantiator
  14. {
  15. id: extruderInstantiator
  16. model: activeMachine == null ? null : activeMachine.extruderList
  17. Menu
  18. {
  19. title: modelData.name
  20. property var extruder: (base.activeMachine === null) ? null : activeMachine.extruderList[model.index]
  21. NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.activeMachine.hasVariants; extruderIndex: index }
  22. MaterialMenu
  23. {
  24. title: catalog.i18nc("@title:menu", "&Material")
  25. visible: Cura.MachineManager.activeMachine.hasMaterials
  26. extruderIndex: index
  27. updateModels: false
  28. onAboutToShow: updateModels = true
  29. onAboutToHide: updateModels = false
  30. }
  31. MenuSeparator
  32. {
  33. visible: Cura.MachineManager.activeMachine.hasVariants || Cura.MachineManager.activeMachine.hasMaterials
  34. }
  35. MenuItem
  36. {
  37. text: catalog.i18nc("@action:inmenu", "Set as Active Extruder")
  38. onTriggered: Cura.ExtruderManager.setActiveExtruderIndex(model.index)
  39. }
  40. MenuItem
  41. {
  42. text: catalog.i18nc("@action:inmenu", "Enable Extruder")
  43. onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, true)
  44. visible: (extruder === null || extruder === undefined) ? false : !extruder.isEnabled
  45. }
  46. MenuItem
  47. {
  48. text: catalog.i18nc("@action:inmenu", "Disable Extruder")
  49. onTriggered: Cura.MachineManager.setExtruderEnabled(index, false)
  50. visible: (extruder === null || extruder === undefined) ? false : extruder.isEnabled
  51. enabled: Cura.MachineManager.numberExtrudersEnabled > 1
  52. }
  53. }
  54. onObjectAdded: base.insertItem(index, object)
  55. onObjectRemoved: base.removeItem(object)
  56. }
  57. MenuSeparator { }
  58. MenuItem { action: Cura.Actions.configureSettingVisibility }
  59. }