SettingsMenu.qml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 2.4
  5. import UM 1.5 as UM
  6. import Cura 1.0 as Cura
  7. Cura.Menu
  8. {
  9. id: base
  10. title: catalog.i18nc("@title:menu menubar:toplevel", "&Settings")
  11. PrinterMenu { }
  12. property var activeMachine: Cura.MachineManager.activeMachine
  13. Instantiator
  14. {
  15. id: extruderInstantiator
  16. model: activeMachine == null ? null : activeMachine.extruderList
  17. Cura.Menu
  18. {
  19. title: modelData.name
  20. property var extruder: (base.activeMachine === null) ? null : activeMachine.extruderList[model.index]
  21. NozzleMenu
  22. {
  23. title: Cura.MachineManager.activeDefinitionVariantsName
  24. shouldBeVisible: activeMachine.hasVariants
  25. extruderIndex: index
  26. }
  27. MaterialMenu
  28. {
  29. title: catalog.i18nc("@title:menu", "&Material")
  30. shouldBeVisible: activeMachine.hasMaterials
  31. extruderIndex: index
  32. updateModels: false
  33. onAboutToShow: updateModels = true
  34. onAboutToHide: updateModels = false
  35. }
  36. Cura.MenuSeparator
  37. {
  38. visible: Cura.MachineManager.activeMachine.hasVariants || Cura.MachineManager.activeMachine.hasMaterials
  39. }
  40. Cura.MenuItem
  41. {
  42. text: catalog.i18nc("@action:inmenu", "Set as Active Extruder")
  43. onTriggered: Cura.ExtruderManager.setActiveExtruderIndex(model.index)
  44. }
  45. Cura.MenuItem
  46. {
  47. text: catalog.i18nc("@action:inmenu", "Enable Extruder")
  48. onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, true)
  49. visible: (extruder === null || extruder === undefined) ? false : !extruder.isEnabled
  50. height: visible ? implicitHeight: 0
  51. }
  52. Cura.MenuItem
  53. {
  54. text: catalog.i18nc("@action:inmenu", "Disable Extruder")
  55. onTriggered: Cura.MachineManager.setExtruderEnabled(index, false)
  56. visible: (extruder === null || extruder === undefined) ? false : extruder.isEnabled
  57. enabled: Cura.MachineManager.numberExtrudersEnabled > 1
  58. height: visible ? implicitHeight: 0
  59. }
  60. }
  61. onObjectAdded: function(index, object) { base.insertMenu(index, object) }
  62. onObjectRemoved:function(object) { base.removeMenu(object)}
  63. }
  64. Cura.MenuSeparator { }
  65. Cura.MenuItem { action: Cura.Actions.configureSettingVisibility }
  66. }