FileMenu.qml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Controls 1.1
  5. import UM 1.2 as UM
  6. import Cura 1.0 as Cura
  7. Menu
  8. {
  9. id: base
  10. title: catalog.i18nc("@title:menu menubar:toplevel", "&File")
  11. MenuItem
  12. {
  13. id: newProjectMenu
  14. action: Cura.Actions.newProject
  15. }
  16. MenuItem
  17. {
  18. id: openMenu
  19. action: Cura.Actions.open
  20. }
  21. RecentFilesMenu { }
  22. MenuItem
  23. {
  24. id: saveWorkspaceMenu
  25. shortcut: StandardKey.Save
  26. text: catalog.i18nc("@title:menu menubar:file", "&Save Project...")
  27. onTriggered:
  28. {
  29. var args = { "filter_by_machine": false, "file_type": "workspace", "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml" };
  30. if(UM.Preferences.getValue("cura/dialog_on_project_save"))
  31. {
  32. saveWorkspaceDialog.args = args
  33. saveWorkspaceDialog.open()
  34. }
  35. else
  36. {
  37. UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args)
  38. }
  39. }
  40. }
  41. MenuSeparator { }
  42. MenuItem
  43. {
  44. id: saveAsMenu
  45. text: catalog.i18nc("@title:menu menubar:file", "&Export...")
  46. onTriggered:
  47. {
  48. var localDeviceId = "local_file"
  49. UM.OutputDeviceManager.requestWriteToDevice(localDeviceId, PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"})
  50. }
  51. }
  52. MenuItem
  53. {
  54. id: exportSelectionMenu
  55. text: catalog.i18nc("@action:inmenu menubar:file", "Export Selection...")
  56. enabled: UM.Selection.hasSelection
  57. iconName: "document-save-as"
  58. onTriggered: UM.OutputDeviceManager.requestWriteSelectionToDevice("local_file", PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"})
  59. }
  60. MenuSeparator { }
  61. MenuItem
  62. {
  63. id: reloadAllMenu
  64. action: Cura.Actions.reloadAll
  65. }
  66. MenuSeparator { }
  67. MenuItem { action: Cura.Actions.quit }
  68. }