Actions.qml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. // Copyright (c) 2022 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. pragma Singleton
  4. import QtQuick 2.10
  5. import QtQuick.Controls 2.4
  6. import UM 1.1 as UM
  7. import Cura 1.0 as Cura
  8. Item
  9. {
  10. property alias newProject: newProjectAction
  11. property alias open: openAction
  12. property alias quit: quitAction
  13. property alias undo: undoAction
  14. property alias redo: redoAction
  15. property alias view3DCamera: view3DCameraAction
  16. property alias viewFrontCamera: viewFrontCameraAction
  17. property alias viewTopCamera: viewTopCameraAction
  18. property alias viewBottomCamera: viewBottomCameraAction
  19. property alias viewLeftSideCamera: viewLeftSideCameraAction
  20. property alias viewRightSideCamera: viewRightSideCameraAction
  21. property alias deleteSelection: deleteSelectionAction
  22. property alias centerSelection: centerSelectionAction
  23. property alias multiplySelection: multiplySelectionAction
  24. property alias deleteObject: deleteObjectAction
  25. property alias centerObject: centerObjectAction
  26. property alias groupObjects: groupObjectsAction
  27. property alias unGroupObjects:unGroupObjectsAction
  28. property alias mergeObjects: mergeObjectsAction
  29. //property alias unMergeObjects: unMergeObjectsAction
  30. property alias multiplyObject: multiplyObjectAction
  31. property alias selectAll: selectAllAction
  32. property alias deleteAll: deleteAllAction
  33. property alias reloadAll: reloadAllAction
  34. property alias arrangeAll: arrangeAllAction
  35. property alias arrangeSelection: arrangeSelectionAction
  36. property alias resetAllTranslation: resetAllTranslationAction
  37. property alias resetAll: resetAllAction
  38. property alias addMachine: addMachineAction
  39. property alias configureMachines: settingsAction
  40. property alias addProfile: addProfileAction
  41. property alias updateProfile: updateProfileAction
  42. property alias resetProfile: resetProfileAction
  43. property alias manageProfiles: manageProfilesAction
  44. property alias manageMaterials: manageMaterialsAction
  45. property alias marketplaceMaterials: marketplaceMaterialsAction
  46. property alias preferences: preferencesAction
  47. property alias showProfileFolder: showProfileFolderAction
  48. property alias documentation: documentationAction
  49. property alias showTroubleshooting: showTroubleShootingAction
  50. property alias reportBug: reportBugAction
  51. property alias whatsNew: whatsNewAction
  52. property alias about: aboutAction
  53. property alias toggleFullScreen: toggleFullScreenAction
  54. property alias exitFullScreen: exitFullScreenAction
  55. property alias configureSettingVisibility: configureSettingVisibilityAction
  56. property alias browsePackages: browsePackagesAction
  57. UM.I18nCatalog{id: catalog; name: "cura"}
  58. Action
  59. {
  60. id: showTroubleShootingAction
  61. onTriggered: Qt.openUrlExternally("https://ultimaker.com/en/troubleshooting?utm_source=cura&utm_medium=software&utm_campaign=dropdown-troubleshooting")
  62. text: catalog.i18nc("@action:inmenu", "Show Online Troubleshooting")
  63. }
  64. Action
  65. {
  66. id: toggleFullScreenAction
  67. shortcut: StandardKey.FullScreen
  68. text: catalog.i18nc("@action:inmenu", "Toggle Full Screen")
  69. icon.name: "view-fullscreen"
  70. }
  71. Action
  72. {
  73. id: exitFullScreenAction
  74. shortcut: StandardKey.Cancel
  75. text: catalog.i18nc("@action:inmenu", "Exit Full Screen")
  76. icon.name: "view-fullscreen"
  77. }
  78. Action
  79. {
  80. id: undoAction
  81. text: catalog.i18nc("@action:inmenu menubar:edit", "&Undo")
  82. icon.name: "edit-undo"
  83. shortcut: StandardKey.Undo
  84. onTriggered: UM.OperationStack.undo()
  85. enabled: UM.OperationStack.canUndo
  86. }
  87. Action
  88. {
  89. id: redoAction
  90. text: catalog.i18nc("@action:inmenu menubar:edit", "&Redo")
  91. icon.name: "edit-redo"
  92. shortcut: StandardKey.Redo
  93. onTriggered: UM.OperationStack.redo()
  94. enabled: UM.OperationStack.canRedo
  95. }
  96. Action
  97. {
  98. id: quitAction
  99. //On MacOS, don't translate the "Quit" word.
  100. //Qt moves the "quit" entry to a different place, and if it got renamed can't find it again when it attempts to
  101. //delete the item upon closing the application, causing a crash.
  102. //In the new location, these items are translated automatically according to the system's language.
  103. //For more information, see:
  104. //- https://doc.qt.io/qt-5/macos-issues.html#menu-bar
  105. //- https://doc.qt.io/qt-5/qmenubar.html#qmenubar-as-a-global-menu-bar
  106. text: (Qt.platform.os == "osx") ? "&Quit" : catalog.i18nc("@action:inmenu menubar:file", "&Quit")
  107. icon.name: "application-exit"
  108. shortcut: StandardKey.Quit
  109. }
  110. Action
  111. {
  112. id: view3DCameraAction
  113. text: catalog.i18nc("@action:inmenu menubar:view", "3D View")
  114. onTriggered: UM.Controller.setCameraRotation("3d", 0)
  115. }
  116. Action
  117. {
  118. id: viewFrontCameraAction
  119. text: catalog.i18nc("@action:inmenu menubar:view", "Front View")
  120. onTriggered: UM.Controller.setCameraRotation("home", 0)
  121. }
  122. Action
  123. {
  124. id: viewTopCameraAction
  125. text: catalog.i18nc("@action:inmenu menubar:view", "Top View")
  126. onTriggered: UM.Controller.setCameraRotation("y", 90)
  127. }
  128. Action
  129. {
  130. id: viewBottomCameraAction
  131. text: catalog.i18nc("@action:inmenu menubar:view", "Bottom View")
  132. onTriggered: UM.Controller.setCameraRotation("y", -90)
  133. }
  134. Action
  135. {
  136. id: viewLeftSideCameraAction
  137. text: catalog.i18nc("@action:inmenu menubar:view", "Left Side View")
  138. onTriggered: UM.Controller.setCameraRotation("x", 90)
  139. }
  140. Action
  141. {
  142. id: viewRightSideCameraAction
  143. text: catalog.i18nc("@action:inmenu menubar:view", "Right Side View")
  144. onTriggered: UM.Controller.setCameraRotation("x", -90)
  145. }
  146. Action
  147. {
  148. id: preferencesAction
  149. //On MacOS, don't translate the "Configure" word.
  150. //Qt moves the "configure" entry to a different place, and if it got renamed can't find it again when it
  151. //attempts to delete the item upon closing the application, causing a crash.
  152. //In the new location, these items are translated automatically according to the system's language.
  153. //For more information, see:
  154. //- https://doc.qt.io/qt-5/macos-issues.html#menu-bar
  155. //- https://doc.qt.io/qt-5/qmenubar.html#qmenubar-as-a-global-menu-bar
  156. text: (Qt.platform.os == "osx") ? "Configure Cura..." : catalog.i18nc("@action:inmenu", "Configure Cura...")
  157. icon.name: "configure"
  158. }
  159. Action
  160. {
  161. id: addMachineAction
  162. text: catalog.i18nc("@action:inmenu menubar:printer", "&Add Printer...")
  163. }
  164. Action
  165. {
  166. id: settingsAction
  167. text: catalog.i18nc("@action:inmenu menubar:printer", "Manage Pr&inters...")
  168. icon.name: "configure"
  169. }
  170. Action
  171. {
  172. id: manageMaterialsAction
  173. text: catalog.i18nc("@action:inmenu", "Manage Materials...")
  174. icon.name: "configure"
  175. shortcut: "Ctrl+K"
  176. }
  177. Action
  178. {
  179. id: marketplaceMaterialsAction
  180. text: catalog.i18nc("@action:inmenu Marketplace is a brand name of Ultimaker's, so don't translate.", "Add more materials from Marketplace")
  181. }
  182. Action
  183. {
  184. id: updateProfileAction
  185. enabled: !Cura.MachineManager.stacksHaveErrors && Cura.MachineManager.hasUserSettings && Cura.MachineManager.activeQualityChangesGroup != null
  186. text: catalog.i18nc("@action:inmenu menubar:profile", "&Update profile with current settings/overrides");
  187. onTriggered: Cura.ContainerManager.updateQualityChanges()
  188. }
  189. Action
  190. {
  191. id: resetProfileAction
  192. enabled: Cura.MachineManager.hasUserSettings
  193. text: catalog.i18nc("@action:inmenu menubar:profile", "&Discard current changes")
  194. onTriggered:
  195. {
  196. forceActiveFocus()
  197. Cura.ContainerManager.clearUserContainers()
  198. }
  199. }
  200. Action
  201. {
  202. id: addProfileAction
  203. enabled: !Cura.MachineManager.stacksHaveErrors && Cura.MachineManager.hasUserSettings
  204. text: catalog.i18nc("@action:inmenu menubar:profile", "&Create profile from current settings/overrides...")
  205. }
  206. Action
  207. {
  208. id: manageProfilesAction
  209. text: catalog.i18nc("@action:inmenu menubar:profile", "Manage Profiles...")
  210. icon.name: "configure"
  211. shortcut: "Ctrl+J"
  212. }
  213. Action
  214. {
  215. id: documentationAction
  216. text: catalog.i18nc("@action:inmenu menubar:help", "Show Online &Documentation")
  217. icon.name: "help-contents"
  218. shortcut: StandardKey.Help
  219. onTriggered: CuraActions.openDocumentation()
  220. }
  221. Action {
  222. id: reportBugAction
  223. text: catalog.i18nc("@action:inmenu menubar:help", "Report a &Bug")
  224. icon.name: "tools-report-bug"
  225. onTriggered: CuraActions.openBugReportPage()
  226. }
  227. Action
  228. {
  229. id: whatsNewAction
  230. text: catalog.i18nc("@action:inmenu menubar:help", "What's New")
  231. }
  232. Action
  233. {
  234. id: aboutAction
  235. //On MacOS, don't translate the "About" word.
  236. //Qt moves the "about" entry to a different place, and if it got renamed can't find it again when it
  237. //attempts to delete the item upon closing the application, causing a crash.
  238. //In the new location, these items are translated automatically according to the system's language.
  239. //For more information, see:
  240. //- https://doc.qt.io/qt-5/macos-issues.html#menu-bar
  241. //- https://doc.qt.io/qt-5/qmenubar.html#qmenubar-as-a-global-menu-bar
  242. text: (Qt.platform.os == "osx") ? "About..." : catalog.i18nc("@action:inmenu menubar:help", "About...")
  243. icon.name: "help-about"
  244. }
  245. Action
  246. {
  247. id: deleteSelectionAction
  248. text: catalog.i18nc("@action:inmenu menubar:edit", "Delete Selected")
  249. enabled: UM.Controller.toolsEnabled && UM.Selection.hasSelection
  250. icon.name: "edit-delete"
  251. shortcut: StandardKey.Delete | "Backspace"
  252. onTriggered: CuraActions.deleteSelection()
  253. }
  254. Action
  255. {
  256. id: centerSelectionAction
  257. text: catalog.i18nc("@action:inmenu menubar:edit", "Center Selected")
  258. enabled: UM.Controller.toolsEnabled && UM.Selection.hasSelection
  259. icon.name: "align-vertical-center"
  260. onTriggered: CuraActions.centerSelection()
  261. }
  262. Action
  263. {
  264. id: multiplySelectionAction
  265. text: catalog.i18nc("@action:inmenu menubar:edit", "Multiply Selected")
  266. enabled: UM.Controller.toolsEnabled && UM.Selection.hasSelection
  267. icon.name: "edit-duplicate"
  268. shortcut: "Ctrl+M"
  269. }
  270. Action
  271. {
  272. id: deleteObjectAction
  273. text: catalog.i18nc("@action:inmenu","Delete Model")
  274. enabled: UM.Controller.toolsEnabled
  275. icon.name: "edit-delete"
  276. }
  277. Action
  278. {
  279. id: centerObjectAction
  280. text: catalog.i18nc("@action:inmenu","Ce&nter Model on Platform")
  281. }
  282. Action
  283. {
  284. id: groupObjectsAction
  285. text: catalog.i18nc("@action:inmenu menubar:edit","&Group Models")
  286. enabled: UM.Selection.selectionCount > 1 ? true: false
  287. icon.name: "object-group"
  288. shortcut: "Ctrl+G"
  289. onTriggered: CuraApplication.groupSelected()
  290. }
  291. Action
  292. {
  293. id: reloadQmlAction
  294. onTriggered:
  295. {
  296. CuraApplication.reloadQML()
  297. }
  298. shortcut: "Shift+F5"
  299. }
  300. Action
  301. {
  302. id: unGroupObjectsAction
  303. text: catalog.i18nc("@action:inmenu menubar:edit","Ungroup Models")
  304. enabled: UM.Selection.isGroupSelected
  305. icon.name: "object-ungroup"
  306. shortcut: "Ctrl+Shift+G"
  307. onTriggered: CuraApplication.ungroupSelected()
  308. }
  309. Action
  310. {
  311. id: mergeObjectsAction
  312. text: catalog.i18nc("@action:inmenu menubar:edit","&Merge Models")
  313. enabled: UM.Selection.selectionCount > 1 ? true: false
  314. icon.name: "merge"
  315. shortcut: "Ctrl+Alt+G"
  316. onTriggered: CuraApplication.mergeSelected()
  317. }
  318. Action
  319. {
  320. id: multiplyObjectAction
  321. text: catalog.i18nc("@action:inmenu","&Multiply Model...")
  322. icon.name: "edit-duplicate"
  323. }
  324. Action
  325. {
  326. id: selectAllAction
  327. text: catalog.i18nc("@action:inmenu menubar:edit","Select All Models")
  328. enabled: UM.Controller.toolsEnabled
  329. icon.name: "edit-select-all"
  330. shortcut: "Ctrl+A"
  331. onTriggered: CuraApplication.selectAll()
  332. }
  333. Action
  334. {
  335. id: deleteAllAction
  336. text: catalog.i18nc("@action:inmenu menubar:edit","Clear Build Plate")
  337. enabled: UM.Controller.toolsEnabled
  338. icon.name: "edit-delete"
  339. shortcut: "Ctrl+D"
  340. onTriggered: CuraApplication.deleteAll()
  341. }
  342. Action
  343. {
  344. id: reloadAllAction
  345. text: catalog.i18nc("@action:inmenu menubar:file","Reload All Models")
  346. icon.name: "document-revert"
  347. shortcut: "F5"
  348. onTriggered: CuraApplication.reloadAll()
  349. }
  350. Action
  351. {
  352. id: arrangeAllAction
  353. text: catalog.i18nc("@action:inmenu menubar:edit","Arrange All Models")
  354. onTriggered: Printer.arrangeAll()
  355. shortcut: "Ctrl+R"
  356. }
  357. Action
  358. {
  359. id: arrangeSelectionAction
  360. text: catalog.i18nc("@action:inmenu menubar:edit","Arrange Selection")
  361. onTriggered: Printer.arrangeSelection()
  362. }
  363. Action
  364. {
  365. id: resetAllTranslationAction
  366. text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Model Positions")
  367. onTriggered: CuraApplication.resetAllTranslation()
  368. }
  369. Action
  370. {
  371. id: resetAllAction
  372. text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Model Transformations")
  373. onTriggered: CuraApplication.resetAll()
  374. }
  375. Action
  376. {
  377. id: openAction
  378. property var fileProviderModel: CuraApplication.getFileProviderModel()
  379. text: catalog.i18nc("@action:inmenu menubar:file","&Open File(s)...")
  380. icon.name: "document-open"
  381. // Unassign the shortcut when there are more than one file providers, since then the file provider's shortcut is
  382. // enabled instead, and Ctrl+O is assigned to the local file provider
  383. shortcut: fileProviderModel.count == 1 ? StandardKey.Open : ""
  384. }
  385. Action
  386. {
  387. id: newProjectAction
  388. text: catalog.i18nc("@action:inmenu menubar:file","&New Project...")
  389. shortcut: StandardKey.New
  390. }
  391. Action
  392. {
  393. id: showProfileFolderAction
  394. text: catalog.i18nc("@action:inmenu menubar:help","Show Configuration Folder")
  395. }
  396. Action
  397. {
  398. id: configureSettingVisibilityAction
  399. text: catalog.i18nc("@action:menu", "Configure setting visibility...")
  400. icon.name: "configure"
  401. }
  402. Action
  403. {
  404. id: browsePackagesAction
  405. text: "&Marketplace"
  406. icon.name: "plugins_browse"
  407. }
  408. }