Actions.qml 16 KB

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