MonitorExtruderConfiguration.qml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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.3 as UM
  6. /**
  7. * This component comprises a colored extruder icon, the material name, and the
  8. * print core name. It is used by the MonitorPrinterConfiguration component with
  9. * a sibling instance as well as a MonitorBuildplateConfiguration instance.
  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 material color
  19. property alias color: extruderIcon.color
  20. // The extruder position; NOTE: Decent human beings count from 0
  21. property alias position: extruderIcon.position
  22. // The material name
  23. property alias material: materialLabel.text
  24. // The print core name (referred to as hotendID in Python)
  25. property alias printCore: printCoreLabel.text
  26. // Height is 2 x 18px labels, plus 4px spacing between them
  27. height: 40 * screenScaleFactor // TODO: Theme!
  28. width: childrenRect.width
  29. MonitorIconExtruder
  30. {
  31. id: extruderIcon
  32. color: UM.Theme.getColor("monitor_skeleton_loading")
  33. position: 0
  34. }
  35. Rectangle
  36. {
  37. id: materialLabelWrapper
  38. anchors
  39. {
  40. left: extruderIcon.right
  41. leftMargin: 12 * screenScaleFactor // TODO: Theme!
  42. }
  43. color: materialLabel.visible > 0 ? "transparent" : UM.Theme.getColor("monitor_skeleton_loading")
  44. height: 18 * screenScaleFactor // TODO: Theme!
  45. width: Math.max(materialLabel.contentWidth, 60 * screenScaleFactor) // TODO: Theme!
  46. radius: 2 * screenScaleFactor // TODO: Theme!
  47. Label
  48. {
  49. id: materialLabel
  50. color: UM.Theme.getColor("text")
  51. elide: Text.ElideRight
  52. font: UM.Theme.getFont("default") // 12pt, regular
  53. text: ""
  54. visible: text !== ""
  55. // FIXED-LINE-HEIGHT:
  56. height: parent.height
  57. verticalAlignment: Text.AlignVCenter
  58. renderType: Text.NativeRendering
  59. }
  60. }
  61. Rectangle
  62. {
  63. id: printCoreLabelWrapper
  64. anchors
  65. {
  66. left: materialLabelWrapper.left
  67. bottom: parent.bottom
  68. }
  69. color: printCoreLabel.visible > 0 ? "transparent" : UM.Theme.getColor("monitor_skeleton_loading")
  70. height: 18 * screenScaleFactor // TODO: Theme!
  71. width: Math.max(printCoreLabel.contentWidth, 36 * screenScaleFactor) // TODO: Theme!
  72. radius: 2 * screenScaleFactor // TODO: Theme!
  73. Label
  74. {
  75. id: printCoreLabel
  76. color: UM.Theme.getColor("text")
  77. elide: Text.ElideRight
  78. font: UM.Theme.getFont("default_bold") // 12pt, bold
  79. text: ""
  80. visible: text !== ""
  81. // FIXED-LINE-HEIGHT:
  82. height: parent.height
  83. verticalAlignment: Text.AlignVCenter
  84. renderType: Text.NativeRendering
  85. }
  86. }
  87. }