Actions.qml 17 KB

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