ActionPanelWidget.qml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. height: childrenRect.height
  15. visible: CuraApplication.platformActivity
  16. property bool hasPreviewButton: true
  17. Rectangle
  18. {
  19. id: actionPanelWidget
  20. width: UM.Theme.getSize("action_panel_widget").width
  21. height: childrenRect.height + 2 * UM.Theme.getSize("thick_margin").height
  22. anchors.right: parent.right
  23. color: UM.Theme.getColor("main_background")
  24. border.width: UM.Theme.getSize("default_lining").width
  25. border.color: UM.Theme.getColor("lining")
  26. radius: UM.Theme.getSize("default_radius").width
  27. z: 10
  28. property bool outputAvailable: UM.Backend.state == UM.Backend.Done || UM.Backend.state == UM.Backend.Disabled
  29. Loader
  30. {
  31. id: loader
  32. anchors
  33. {
  34. top: parent.top
  35. topMargin: UM.Theme.getSize("thick_margin").height
  36. left: parent.left
  37. leftMargin: UM.Theme.getSize("thick_margin").width
  38. right: parent.right
  39. rightMargin: UM.Theme.getSize("thick_margin").width
  40. }
  41. sourceComponent: actionPanelWidget.outputAvailable ? outputProcessWidget : sliceProcessWidget
  42. onLoaded:
  43. {
  44. if(actionPanelWidget.outputAvailable)
  45. {
  46. loader.item.hasPreviewButton = base.hasPreviewButton;
  47. }
  48. }
  49. }
  50. Component
  51. {
  52. id: sliceProcessWidget
  53. SliceProcessWidget { }
  54. }
  55. Component
  56. {
  57. id: outputProcessWidget
  58. OutputProcessWidget { }
  59. }
  60. }
  61. Item
  62. {
  63. id: additionalComponents
  64. width: childrenRect.width
  65. anchors.right: actionPanelWidget.left
  66. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  67. anchors.bottom: actionPanelWidget.bottom
  68. anchors.bottomMargin: UM.Theme.getSize("thick_margin").height * 2
  69. visible: actionPanelWidget.visible
  70. Row
  71. {
  72. id: additionalComponentsRow
  73. anchors.verticalCenter: parent.verticalCenter
  74. spacing: UM.Theme.getSize("default_margin").width
  75. }
  76. }
  77. Component.onCompleted: base.addAdditionalComponents()
  78. Connections
  79. {
  80. target: CuraApplication
  81. onAdditionalComponentsChanged: base.addAdditionalComponents()
  82. }
  83. function addAdditionalComponents()
  84. {
  85. for (var component in CuraApplication.additionalComponents["saveButton"])
  86. {
  87. CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow
  88. }
  89. }
  90. }