ViewMenu.qml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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.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. }
  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. }
  59. exclusiveGroup: group
  60. }
  61. ExclusiveGroup { id: group }
  62. }
  63. MenuSeparator
  64. {
  65. visible: UM.Preferences.getValue("cura/use_multi_build_plate")
  66. }
  67. Menu
  68. {
  69. id: buildPlateMenu;
  70. title: catalog.i18nc("@action:inmenu menubar:view","&Build plate")
  71. visible: UM.Preferences.getValue("cura/use_multi_build_plate")
  72. Instantiator
  73. {
  74. model: base.multiBuildPlateModel
  75. MenuItem
  76. {
  77. text: base.multiBuildPlateModel.getItem(index).name;
  78. onTriggered: Cura.SceneController.setActiveBuildPlate(base.multiBuildPlateModel.getItem(index).buildPlateNumber)
  79. checkable: true
  80. checked: base.multiBuildPlateModel.getItem(index).buildPlateNumber == base.multiBuildPlateModel.activeBuildPlate
  81. exclusiveGroup: buildPlateGroup
  82. visible: UM.Preferences.getValue("cura/use_multi_build_plate")
  83. }
  84. onObjectAdded: buildPlateMenu.insertItem(index, object)
  85. onObjectRemoved: buildPlateMenu.removeItem(object)
  86. }
  87. ExclusiveGroup
  88. {
  89. id: buildPlateGroup
  90. }
  91. }
  92. MenuSeparator {}
  93. MenuItem
  94. {
  95. action: Cura.Actions.toggleFullScreen
  96. }
  97. }