ViewMenu.qml 3.4 KB

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