Actions.qml 15 KB

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