FileMenu.qml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. property var fileProviderModel: CuraApplication.getFileProviderModel()
  12. MenuItem
  13. {
  14. id: newProjectMenu
  15. action: Cura.Actions.newProject
  16. }
  17. MenuItem
  18. {
  19. id: openMenu
  20. action: Cura.Actions.open
  21. visible: (base.fileProviderModel.count == 1)
  22. }
  23. OpenFilesMenu
  24. {
  25. id: openFilesMenu
  26. visible: (base.fileProviderModel.count > 1)
  27. }
  28. RecentFilesMenu { }
  29. MenuItem
  30. {
  31. id: saveWorkspaceMenu
  32. shortcut: StandardKey.Save
  33. text: catalog.i18nc("@title:menu menubar:file", "&Save Project...")
  34. onTriggered:
  35. {
  36. var args = { "filter_by_machine": false, "file_type": "workspace", "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml" };
  37. if(UM.Preferences.getValue("cura/dialog_on_project_save"))
  38. {
  39. saveWorkspaceDialog.args = args
  40. saveWorkspaceDialog.open()
  41. }
  42. else
  43. {
  44. UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args)
  45. }
  46. }
  47. }
  48. MenuSeparator { }
  49. MenuItem
  50. {
  51. id: saveAsMenu
  52. text: catalog.i18nc("@title:menu menubar:file", "&Export...")
  53. onTriggered:
  54. {
  55. var localDeviceId = "local_file"
  56. UM.OutputDeviceManager.requestWriteToDevice(localDeviceId, PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"})
  57. }
  58. }
  59. MenuItem
  60. {
  61. id: exportSelectionMenu
  62. text: catalog.i18nc("@action:inmenu menubar:file", "Export Selection...")
  63. enabled: UM.Selection.hasSelection
  64. iconName: "document-save-as"
  65. onTriggered: UM.OutputDeviceManager.requestWriteSelectionToDevice("local_file", PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"})
  66. }
  67. MenuSeparator { }
  68. MenuItem
  69. {
  70. id: reloadAllMenu
  71. action: Cura.Actions.reloadAll
  72. }
  73. MenuSeparator { }
  74. MenuItem { action: Cura.Actions.quit }
  75. }