MonitorBuildplateConfiguration.qml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Copyright (c) 2018 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.3 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: parent.height
  47. source: "../svg/icons/buildplate.svg"
  48. width: height
  49. visible: buildplate
  50. }
  51. }
  52. Label
  53. {
  54. id: buildplateLabel
  55. color: UM.Theme.getColor("monitor_text_primary")
  56. elide: Text.ElideRight
  57. font: UM.Theme.getFont("default") // 12pt, regular
  58. text: buildplate ? buildplate : ""
  59. visible: text !== ""
  60. // FIXED-LINE-HEIGHT:
  61. height: 18 * screenScaleFactor // TODO: Theme!
  62. verticalAlignment: Text.AlignVCenter
  63. renderType: Text.NativeRendering
  64. }
  65. }
  66. }