Actions.qml 17 KB

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