ClusterMonitorItem.qml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import QtQuick 2.2
  2. import QtQuick.Controls 1.4
  3. import QtQuick.Controls.Styles 1.4
  4. import UM 1.3 as UM
  5. import Cura 1.0 as Cura
  6. Component
  7. {
  8. Rectangle
  9. {
  10. width: maximumWidth
  11. height: maximumHeight
  12. color: UM.Theme.getColor("viewport_background")
  13. property var emphasisColor: UM.Theme.getColor("setting_control_border_highlight")
  14. property var lineColor: "#DCDCDC" // TODO: Should be linked to theme.
  15. property var cornerRadius: 4 * screenScaleFactor // TODO: Should be linked to theme.
  16. UM.I18nCatalog
  17. {
  18. id: catalog
  19. name: "cura"
  20. }
  21. Label
  22. {
  23. id: activePrintersLabel
  24. font: UM.Theme.getFont("large")
  25. anchors {
  26. top: parent.top
  27. topMargin: UM.Theme.getSize("default_margin").height * 2 // a bit more spacing to give it some breathing room
  28. horizontalCenter: parent.horizontalCenter
  29. }
  30. text: OutputDevice.printers.length == 0 ? catalog.i18nc("@label: arg 1 is group name", "%1 is not set up to host a group of connected Ultimaker 3 printers").arg(Cura.MachineManager.printerOutputDevices[0].name) : ""
  31. visible: OutputDevice.printers.length == 0
  32. }
  33. Item
  34. {
  35. anchors.topMargin: UM.Theme.getSize("default_margin").height
  36. anchors.top: parent.top
  37. anchors.horizontalCenter: parent.horizontalCenter
  38. width: Math.min(800 * screenScaleFactor, maximumWidth)
  39. height: children.height
  40. visible: OutputDevice.printers.length != 0
  41. Label
  42. {
  43. id: addRemovePrintersLabel
  44. anchors.right: parent.right
  45. text: catalog.i18nc("@label link to connect manager", "Add/Remove printers")
  46. font: UM.Theme.getFont("default")
  47. color: UM.Theme.getColor("text")
  48. linkColor: UM.Theme.getColor("text_link")
  49. }
  50. MouseArea
  51. {
  52. anchors.fill: addRemovePrintersLabel
  53. hoverEnabled: true
  54. onClicked: Cura.MachineManager.printerOutputDevices[0].openPrinterControlPanel()
  55. onEntered: addRemovePrintersLabel.font.underline = true
  56. onExited: addRemovePrintersLabel.font.underline = false
  57. }
  58. }
  59. ScrollView
  60. {
  61. id: printerScrollView
  62. anchors.margins: UM.Theme.getSize("default_margin").width
  63. anchors.top: activePrintersLabel.bottom
  64. anchors.bottom: parent.bottom
  65. anchors.left: parent.left
  66. anchors.leftMargin: UM.Theme.getSize("default_lining").width // To ensure border can be drawn.
  67. anchors.rightMargin: UM.Theme.getSize("default_lining").width
  68. anchors.right: parent.right
  69. ListView
  70. {
  71. anchors.fill: parent
  72. spacing: -UM.Theme.getSize("default_lining").height
  73. model: OutputDevice.printers
  74. delegate: PrinterInfoBlock
  75. {
  76. printer: modelData
  77. width: Math.min(800 * screenScaleFactor, maximumWidth)
  78. height: 125 * screenScaleFactor
  79. // Add a 1 pix margin, as the border is sometimes cut off otherwise.
  80. anchors.horizontalCenter: parent.horizontalCenter
  81. }
  82. }
  83. }
  84. PrinterVideoStream
  85. {
  86. visible: OutputDevice.activePrinter != null
  87. anchors.fill:parent
  88. }
  89. }
  90. }