MonitorPrinterConfiguration.qml 1.6 KB

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