ActionPanelWidget.qml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // Copyright (c) 2020 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.7
  4. import QtQuick.Controls 2.1
  5. import QtQuick.Layouts 1.3
  6. import UM 1.2 as UM
  7. import Cura 1.0 as Cura
  8. // This element hold all the elements needed for the user to trigger the slicing process, and later
  9. // to get information about the printing times, material consumption and the output process (such as
  10. // saving to a file, printing over network, ...
  11. Item
  12. {
  13. id: base
  14. width: actionPanelWidget.width + additionalComponents.width
  15. height: childrenRect.height
  16. visible: CuraApplication.platformActivity
  17. property bool hasPreviewButton: true
  18. Rectangle
  19. {
  20. id: actionPanelWidget
  21. width: UM.Theme.getSize("action_panel_widget").width
  22. height: childrenRect.height + 2 * UM.Theme.getSize("thick_margin").height
  23. anchors.right: parent.right
  24. color: UM.Theme.getColor("main_background")
  25. border.width: UM.Theme.getSize("default_lining").width
  26. border.color: UM.Theme.getColor("lining")
  27. radius: UM.Theme.getSize("default_radius").width
  28. z: 10
  29. property bool outputAvailable: UM.Backend.state == UM.Backend.Done || UM.Backend.state == UM.Backend.Disabled
  30. Loader
  31. {
  32. id: loader
  33. anchors
  34. {
  35. top: parent.top
  36. topMargin: UM.Theme.getSize("thick_margin").height
  37. left: parent.left
  38. leftMargin: UM.Theme.getSize("thick_margin").width
  39. right: parent.right
  40. rightMargin: UM.Theme.getSize("thick_margin").width
  41. }
  42. sourceComponent: actionPanelWidget.outputAvailable ? outputProcessWidget : sliceProcessWidget
  43. onLoaded:
  44. {
  45. if(actionPanelWidget.outputAvailable)
  46. {
  47. loader.item.hasPreviewButton = base.hasPreviewButton;
  48. }
  49. }
  50. }
  51. Component
  52. {
  53. id: sliceProcessWidget
  54. SliceProcessWidget { }
  55. }
  56. Component
  57. {
  58. id: outputProcessWidget
  59. OutputProcessWidget { }
  60. }
  61. }
  62. Item
  63. {
  64. id: additionalComponents
  65. width: childrenRect.width
  66. anchors.right: actionPanelWidget.left
  67. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  68. anchors.bottom: actionPanelWidget.bottom
  69. anchors.bottomMargin: UM.Theme.getSize("thick_margin").height * 2
  70. visible: actionPanelWidget.visible
  71. Row
  72. {
  73. id: additionalComponentsRow
  74. anchors.verticalCenter: parent.verticalCenter
  75. spacing: UM.Theme.getSize("default_margin").width
  76. }
  77. }
  78. Component.onCompleted: base.addAdditionalComponents()
  79. Connections
  80. {
  81. target: CuraApplication
  82. function onAdditionalComponentsChanged(areaId) { base.addAdditionalComponents() }
  83. }
  84. function addAdditionalComponents()
  85. {
  86. for (var component in CuraApplication.additionalComponents["saveButton"])
  87. {
  88. CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow
  89. }
  90. }
  91. }