MonitorBuildplateConfiguration.qml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Copyright (c) 2019 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Controls 2.0
  5. import UM 1.5 as UM
  6. /**
  7. * This component comprises a buildplate icon and the buildplate name. It is
  8. * used by the MonitorPrinterConfiguration component along with two instances
  9. * of MonitorExtruderConfiguration.
  10. *
  11. * NOTE: For most labels, a fixed height with vertical alignment is used to make
  12. * layouts more deterministic (like the fixed-size textboxes used in original
  13. * mock-ups). This is also a stand-in for CSS's 'line-height' property. Denoted
  14. * with '// FIXED-LINE-HEIGHT:'.
  15. */
  16. Item
  17. {
  18. // The buildplate name
  19. property var buildplate: null
  20. // Height is one 18px label/icon
  21. height: 18 * screenScaleFactor // TODO: Theme!
  22. width: childrenRect.width
  23. Row
  24. {
  25. height: parent.height
  26. spacing: UM.Theme.getSize("print_setup_slider_handle").width // TODO: Theme! (Should be same as extruder spacing)
  27. // This wrapper ensures that the buildplate icon is located centered
  28. // below an extruder icon.
  29. Item
  30. {
  31. height: parent.height
  32. width: 32 * screenScaleFactor // Ensure the icon is centered under the extruder icon (same width)
  33. Rectangle
  34. {
  35. anchors.centerIn: parent
  36. height: parent.height
  37. width: height
  38. color: buildplateIcon.visible > 0 ? "transparent" : UM.Theme.getColor("monitor_skeleton_loading")
  39. radius: Math.floor(height / 2)
  40. }
  41. UM.RecolorImage
  42. {
  43. id: buildplateIcon
  44. anchors.centerIn: parent
  45. color: UM.Theme.getColor("monitor_icon_primary")
  46. height: UM.Theme.getSize("medium_button_icon").width
  47. source: UM.Theme.getIcon("Buildplate")
  48. width: height
  49. visible: buildplate
  50. }
  51. }
  52. UM.Label
  53. {
  54. id: buildplateLabel
  55. elide: Text.ElideRight
  56. text: buildplate ? buildplate : ""
  57. visible: text !== ""
  58. // FIXED-LINE-HEIGHT:
  59. height: 18 * screenScaleFactor // TODO: Theme!
  60. }
  61. }
  62. }