ViewMenu.qml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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.1
  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", "&View")
  11. Cura.Menu
  12. {
  13. title: catalog.i18nc("@action:inmenu menubar:view", "&Camera position")
  14. Cura.MenuItem { action: Cura.Actions.view3DCamera }
  15. Cura.MenuItem { action: Cura.Actions.viewFrontCamera }
  16. Cura.MenuItem { action: Cura.Actions.viewTopCamera }
  17. Cura.MenuItem { action: Cura.Actions.viewBottomCamera }
  18. Cura.MenuItem { action: Cura.Actions.viewLeftSideCamera }
  19. Cura.MenuItem { action: Cura.Actions.viewRightSideCamera }
  20. }
  21. Cura.Menu
  22. {
  23. id: cameraViewMenu
  24. title: catalog.i18nc("@action:inmenu menubar:view", "Camera view")
  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. Cura.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. }
  47. }
  48. Cura.MenuItem
  49. {
  50. text: catalog.i18nc("@action:inmenu menubar:view", "Orthographic")
  51. checkable: true
  52. checked: cameraViewMenu.cameraMode == "orthographic"
  53. onTriggered:
  54. {
  55. UM.Preferences.setValue("general/camera_perspective_mode", "orthographic")
  56. }
  57. }
  58. }
  59. Cura.MenuSeparator {}
  60. Cura.MenuItem
  61. {
  62. action: Cura.Actions.toggleFullScreen
  63. }
  64. }