ClusterMonitorItem.qml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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: "#44c0ff" //TODO: should be linked to theme.
  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. text:
  26. {
  27. if (OutputDevice.connectedPrinters.length == 0){
  28. return 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)
  29. } else {
  30. return ""
  31. }
  32. }
  33. anchors.left: parent.left
  34. anchors.right: parent.right
  35. anchors.top: parent.top
  36. anchors.horizontalCenter: parent.horizontalCenter
  37. anchors.topMargin: UM.Theme.getSize("default_margin").height
  38. visible: OutputDevice.connectedPrinters.length == 0
  39. }
  40. Item
  41. {
  42. anchors.topMargin: UM.Theme.getSize("default_margin").height
  43. anchors.top: parent.top
  44. anchors.horizontalCenter: parent.horizontalCenter
  45. width: Math.min(800 * screenScaleFactor, maximumWidth)
  46. height: children.height
  47. visible: OutputDevice.connectedPrinters.length != 0
  48. Label
  49. {
  50. id: addRemovePrintersLabel
  51. anchors.right: parent.right
  52. text: "Add / remove printers"
  53. }
  54. MouseArea
  55. {
  56. anchors.fill: addRemovePrintersLabel
  57. onClicked: Cura.MachineManager.printerOutputDevices[0].openPrinterControlPanel()
  58. }
  59. }
  60. ScrollView
  61. {
  62. id: printerScrollView
  63. anchors.margins: UM.Theme.getSize("default_margin").width
  64. anchors.top: activePrintersLabel.bottom
  65. anchors.bottom: parent.bottom
  66. anchors.left: parent.left
  67. anchors.leftMargin: UM.Theme.getSize("default_lining").width // To ensure border can be drawn.
  68. anchors.rightMargin: UM.Theme.getSize("default_lining").width
  69. anchors.right: parent.right
  70. ListView
  71. {
  72. anchors.fill: parent
  73. spacing: -UM.Theme.getSize("default_lining").height
  74. model: OutputDevice.connectedPrinters
  75. delegate: PrinterInfoBlock
  76. {
  77. printer: modelData
  78. width: Math.min(800 * screenScaleFactor, maximumWidth)
  79. height: 125 * screenScaleFactor
  80. // Add a 1 pix margin, as the border is sometimes cut off otherwise.
  81. anchors.horizontalCenter: parent.horizontalCenter
  82. }
  83. }
  84. }
  85. PrinterVideoStream
  86. {
  87. visible: OutputDevice.selectedPrinterName != ""
  88. anchors.fill:parent
  89. }
  90. }
  91. }