ConfigurationItem.qml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. // Copyright (c) 2018 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.0
  5. import UM 1.2 as UM
  6. import Cura 1.0 as Cura
  7. Button
  8. {
  9. id: configurationItem
  10. property var configuration: null
  11. hoverEnabled: true
  12. height: background.height
  13. background: Rectangle
  14. {
  15. height: childrenRect.height
  16. color: parent.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")
  17. border.color: parent.checked ? UM.Theme.getColor("primary") : UM.Theme.getColor("lining")
  18. border.width: UM.Theme.getSize("default_lining").width
  19. radius: UM.Theme.getSize("default_radius").width
  20. Column
  21. {
  22. id: contentColumn
  23. width: parent.width
  24. padding: UM.Theme.getSize("wide_margin").width
  25. spacing: UM.Theme.getSize("narrow_margin").height
  26. Row
  27. {
  28. id: extruderRow
  29. anchors
  30. {
  31. left: parent.left
  32. leftMargin: parent.padding
  33. right: parent.right
  34. rightMargin: parent.padding
  35. }
  36. height: childrenRect.height
  37. spacing: UM.Theme.getSize("default_margin").width
  38. Repeater
  39. {
  40. id: repeater
  41. height: childrenRect.height
  42. model: configuration.extruderConfigurations
  43. delegate: PrintCoreConfiguration
  44. {
  45. width: Math.round(parent.width / 2)
  46. printCoreConfiguration: modelData
  47. }
  48. }
  49. }
  50. //Buildplate row separator
  51. Rectangle
  52. {
  53. id: separator
  54. visible: buildplateInformation.visible
  55. anchors
  56. {
  57. left: parent.left
  58. leftMargin: parent.padding
  59. right: parent.right
  60. rightMargin: parent.padding
  61. }
  62. height: visible ? Math.round(UM.Theme.getSize("default_lining").height / 2) : 0
  63. color: UM.Theme.getColor("lining")
  64. }
  65. Item
  66. {
  67. id: buildplateInformation
  68. anchors
  69. {
  70. left: parent.left
  71. leftMargin: parent.padding
  72. right: parent.right
  73. rightMargin: parent.padding
  74. }
  75. height: childrenRect.height
  76. visible: configuration.buildplateConfiguration != ""
  77. UM.RecolorImage
  78. {
  79. id: buildplateIcon
  80. anchors.left: parent.left
  81. width: UM.Theme.getSize("main_window_header_button_icon").width
  82. height: UM.Theme.getSize("main_window_header_button_icon").height
  83. source: UM.Theme.getIcon("buildplate")
  84. color: UM.Theme.getColor("text")
  85. }
  86. Label
  87. {
  88. id: buildplateLabel
  89. anchors.left: buildplateIcon.right
  90. anchors.verticalCenter: buildplateIcon.verticalCenter
  91. anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").height / 2)
  92. text: configuration.buildplateConfiguration
  93. renderType: Text.NativeRendering
  94. color: UM.Theme.getColor("text")
  95. }
  96. }
  97. }
  98. Connections
  99. {
  100. target: Cura.MachineManager
  101. onCurrentConfigurationChanged:
  102. {
  103. configurationItem.checked = Cura.MachineManager.matchesConfiguration(configuration)
  104. }
  105. }
  106. Component.onCompleted:
  107. {
  108. configurationItem.checked = Cura.MachineManager.matchesConfiguration(configuration)
  109. }
  110. }
  111. onClicked:
  112. {
  113. Cura.MachineManager.applyRemoteConfiguration(configuration)
  114. }
  115. }