Actions.qml 17 KB

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