Actions.qml 17 KB

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