Actions.qml 15 KB

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