MonitorExtruderConfiguration.qml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 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: "#eeeeee" // TODO: Theme!
  33. position: 0
  34. }
  35. Label
  36. {
  37. id: materialLabel
  38. anchors
  39. {
  40. left: extruderIcon.right
  41. leftMargin: 12 * screenScaleFactor // TODO: Theme!
  42. }
  43. color: "#191919" // TODO: Theme!
  44. elide: Text.ElideRight
  45. font: UM.Theme.getFont("very_small") // 12pt, regular
  46. text: ""
  47. // FIXED-LINE-HEIGHT:
  48. height: 18 * screenScaleFactor // TODO: Theme!
  49. verticalAlignment: Text.AlignVCenter
  50. }
  51. Label
  52. {
  53. id: printCoreLabel
  54. anchors
  55. {
  56. left: materialLabel.left
  57. bottom: parent.bottom
  58. }
  59. color: "#191919" // TODO: Theme!
  60. elide: Text.ElideRight
  61. font: UM.Theme.getFont("small") // 12pt, bold
  62. text: ""
  63. // FIXED-LINE-HEIGHT:
  64. height: 18 * screenScaleFactor // TODO: Theme!
  65. verticalAlignment: Text.AlignVCenter
  66. }
  67. }