ViewMenu.qml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. // Copyright (c) 2018 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.2
  5. import UM 1.2 as UM
  6. import Cura 1.0 as Cura
  7. Menu
  8. {
  9. title: catalog.i18nc("@title:menu menubar:toplevel", "&View")
  10. id: base
  11. property var multiBuildPlateModel: CuraApplication.getMultiBuildPlateModel()
  12. Menu
  13. {
  14. title: catalog.i18nc("@action:inmenu menubar:view","&Camera position");
  15. MenuItem { action: Cura.Actions.view3DCamera; }
  16. MenuItem { action: Cura.Actions.viewFrontCamera; }
  17. MenuItem { action: Cura.Actions.viewTopCamera; }
  18. MenuItem { action: Cura.Actions.viewBottomCamera; }
  19. MenuItem { action: Cura.Actions.viewLeftSideCamera; }
  20. MenuItem { action: Cura.Actions.viewRightSideCamera; }
  21. }
  22. Menu
  23. {
  24. id: cameraViewMenu
  25. property string cameraMode: UM.Preferences.getValue("general/camera_perspective_mode")
  26. Connections
  27. {
  28. target: UM.Preferences
  29. function onPreferenceChanged(preference)
  30. {
  31. if (preference !== "general/camera_perspective_mode")
  32. {
  33. return
  34. }
  35. cameraViewMenu.cameraMode = UM.Preferences.getValue("general/camera_perspective_mode")
  36. }
  37. }
  38. title: catalog.i18nc("@action:inmenu menubar:view","Camera view")
  39. MenuItem
  40. {
  41. text: catalog.i18nc("@action:inmenu menubar:view", "Perspective")
  42. checkable: true
  43. checked: cameraViewMenu.cameraMode == "perspective"
  44. onTriggered:
  45. {
  46. UM.Preferences.setValue("general/camera_perspective_mode", "perspective")
  47. checked = cameraViewMenu.cameraMode == "perspective"
  48. }
  49. exclusiveGroup: group
  50. }
  51. MenuItem
  52. {
  53. text: catalog.i18nc("@action:inmenu menubar:view", "Orthographic")
  54. checkable: true
  55. checked: cameraViewMenu.cameraMode == "orthographic"
  56. onTriggered:
  57. {
  58. UM.Preferences.setValue("general/camera_perspective_mode", "orthographic")
  59. checked = cameraViewMenu.cameraMode == "orthographic"
  60. }
  61. exclusiveGroup: group
  62. }
  63. ExclusiveGroup { id: group }
  64. }
  65. MenuSeparator
  66. {
  67. visible: UM.Preferences.getValue("cura/use_multi_build_plate")
  68. }
  69. Menu
  70. {
  71. id: buildPlateMenu;
  72. title: catalog.i18nc("@action:inmenu menubar:view","&Build plate")
  73. visible: UM.Preferences.getValue("cura/use_multi_build_plate")
  74. Instantiator
  75. {
  76. model: base.multiBuildPlateModel
  77. MenuItem
  78. {
  79. text: base.multiBuildPlateModel.getItem(index).name;
  80. onTriggered: Cura.SceneController.setActiveBuildPlate(base.multiBuildPlateModel.getItem(index).buildPlateNumber)
  81. checkable: true
  82. checked: base.multiBuildPlateModel.getItem(index).buildPlateNumber == base.multiBuildPlateModel.activeBuildPlate
  83. exclusiveGroup: buildPlateGroup
  84. visible: UM.Preferences.getValue("cura/use_multi_build_plate")
  85. }
  86. onObjectAdded: buildPlateMenu.insertItem(index, object)
  87. onObjectRemoved: buildPlateMenu.removeItem(object)
  88. }
  89. ExclusiveGroup
  90. {
  91. id: buildPlateGroup
  92. }
  93. }
  94. MenuSeparator {}
  95. MenuItem
  96. {
  97. action: Cura.Actions.toggleFullScreen
  98. }
  99. }