MonitorPrinterConfiguration.qml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. * The MonitorPrinterConfiguration accepts 2 configuration objects as input and
  8. * applies them to a MonitorBuildplateConfiguration instance and two instances
  9. * of MonitorExtruderConfiguration. It's used in both the MonitorPrintJobCard
  10. * component as well as the MonitorPrinterCard component.
  11. */
  12. Item
  13. {
  14. id: base
  15. // Extracted buildplate configuration
  16. property alias buildplate: buildplateConfig.buildplate
  17. // Array of extracted extruder configurations
  18. property var configurations: [null,null]
  19. // Default size, but should be stretched to fill parent
  20. height: 72 * parent.height
  21. width: 450 * screenScaleFactor // TODO: Theme!
  22. Row
  23. {
  24. id: extruderConfigurationRow
  25. spacing: 18 * screenScaleFactor // TODO: Theme!
  26. Repeater
  27. {
  28. id: extruderConfigurationRepeater
  29. model: configurations
  30. MonitorExtruderConfiguration
  31. {
  32. color: modelData && modelData.activeMaterial ? modelData.activeMaterial.color : UM.Theme.getColor("monitor_skeleton_loading")
  33. material: modelData && modelData.activeMaterial ? modelData.activeMaterial.name : ""
  34. position: modelData && typeof(modelData.position) === "number" ? modelData.position : -1 // Use negative one to create empty extruder number
  35. printCore: modelData ? modelData.hotendID : ""
  36. // Keep things responsive!
  37. width: Math.floor((base.width - (configurations.length - 1) * extruderConfigurationRow.spacing) / configurations.length)
  38. }
  39. }
  40. }
  41. MonitorBuildplateConfiguration
  42. {
  43. id: buildplateConfig
  44. anchors.bottom: parent.bottom
  45. buildplate: null
  46. }
  47. }