PrintSelectorCard.qml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. import QtQuick 2.2
  2. import QtQuick.Controls 2.9
  3. import QtQuick.Layouts 2.10
  4. import UM 1.5 as UM
  5. import Cura 1.0 as Cura
  6. Rectangle {
  7. property alias name: printerTitle.text
  8. property var extruders
  9. width: parent.width
  10. height: childrenRect.height + 2 * UM.Theme.getSize("default_margin").height
  11. color: UM.Theme.getColor("background_1")
  12. border.color: UM.Theme.getColor("border_main")
  13. border.width: UM.Theme.getSize("default_lining").width
  14. RowLayout
  15. {
  16. anchors.left: parent.left
  17. anchors.right: parent.right
  18. anchors.top: parent.top
  19. anchors.margins: UM.Theme.getSize("default_margin").width
  20. Cura.IconWithText
  21. {
  22. id: printerTitle
  23. Layout.preferredWidth: parent.width / 3
  24. Layout.fillWidth: true
  25. Layout.alignment: Qt.AlignTop
  26. Layout.fillHeight: false
  27. source: UM.Theme.getIcon("Printer")
  28. spacing: UM.Theme.getSize("thin_margin").width
  29. iconSize: UM.Theme.getSize("medium_button_icon").width
  30. font: UM.Theme.getFont("medium_bold")
  31. }
  32. ColumnLayout
  33. {
  34. id: extruderInformation
  35. Layout.fillWidth: true
  36. Layout.preferredWidth: parent.width / 2
  37. Layout.alignment: Qt.AlignTop
  38. spacing: UM.Theme.getSize("default_margin").width
  39. Repeater
  40. {
  41. model: extruders
  42. Item
  43. {
  44. height: childrenRect.height
  45. Cura.ExtruderIcon
  46. {
  47. id: extruderIcon
  48. anchors.top: parent.top
  49. anchors.left: parent.left
  50. materialColor: modelData.materials.length == 1 ? modelData.materials[0].color : "white"
  51. iconSize: UM.Theme.getSize("medium_button_icon").width
  52. }
  53. UM.Label
  54. {
  55. id: extruderCore
  56. anchors.verticalCenter: extruderIcon.verticalCenter
  57. anchors.left: extruderIcon.right
  58. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  59. text: modelData.core
  60. font: UM.Theme.getFont("default_bold")
  61. }
  62. UM.Label
  63. {
  64. id: singleMaterialText
  65. anchors.left: extruderCore.right
  66. anchors.verticalCenter: extruderCore.verticalCenter
  67. text: modelData.materials.length == 1 ? modelDatamaterials[0].name : "test"
  68. visible: modelData.materials.length == 1
  69. }
  70. ColumnLayout
  71. {
  72. id: multiMaterialText
  73. anchors.top: extruderCore.bottom
  74. anchors.left: extruderCore.left
  75. anchors.topMargin: UM.Theme.getSize("narrow_margin").height
  76. Repeater
  77. {
  78. model: modelData.materials
  79. visible: modelData.materials.length > 1
  80. UM.Label
  81. {
  82. text: modelData.name
  83. }
  84. }
  85. }
  86. }
  87. }
  88. }
  89. Button
  90. {
  91. id: PrintButton
  92. implicitWidth: UM.Theme.getSize("medium_button").width
  93. implicitHeight: implicitWidth
  94. Layout.alignment: Qt.AlignTop
  95. padding: 0
  96. background: Rectangle
  97. {
  98. border.width: UM.Theme.getSize("default_lining").width
  99. border.color: UM.Theme.getColor("border_accent_1")
  100. color: control.hovered ? UM.Theme.getColor("toolbar_button_hover"): UM.Theme.getColor("background_1")
  101. }
  102. contentItem: Item
  103. {
  104. UM.ColorImage
  105. {
  106. anchors.centerIn: parent
  107. source: UM.Theme.getIcon("Printer")
  108. color: UM.Theme.getColor("border_accent_1")
  109. width: UM.Theme.getSize("small_button_icon").width
  110. height: width
  111. }
  112. }
  113. }
  114. }
  115. }