Actions.qml 15 KB

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