OutputDeviceHeader.qml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import QtQuick 2.2
  2. import QtQuick.Controls 1.1
  3. import QtQuick.Layouts 1.1
  4. import UM 1.2 as UM
  5. import Cura 1.0 as Cura
  6. Item
  7. {
  8. implicitWidth: parent.width
  9. implicitHeight: Math.floor(childrenRect.height + UM.Theme.getSize("default_margin").height * 2)
  10. property var outputDevice: null
  11. Connections
  12. {
  13. target: Cura.MachineManager
  14. function onGlobalContainerChanged()
  15. {
  16. outputDevice = Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null;
  17. }
  18. }
  19. Rectangle
  20. {
  21. height: childrenRect.height
  22. color: UM.Theme.getColor("setting_category")
  23. Label
  24. {
  25. id: outputDeviceNameLabel
  26. font: UM.Theme.getFont("large_bold")
  27. color: UM.Theme.getColor("text")
  28. anchors.left: parent.left
  29. anchors.top: parent.top
  30. anchors.margins: UM.Theme.getSize("default_margin").width
  31. text: outputDevice != null ? outputDevice.activePrinter.name : ""
  32. }
  33. Label
  34. {
  35. id: outputDeviceAddressLabel
  36. text: (outputDevice != null && outputDevice.address != null) ? outputDevice.address : ""
  37. font: UM.Theme.getFont("default_bold")
  38. color: UM.Theme.getColor("text_inactive")
  39. anchors.top: outputDeviceNameLabel.bottom
  40. anchors.left: parent.left
  41. anchors.margins: UM.Theme.getSize("default_margin").width
  42. }
  43. Label
  44. {
  45. text: outputDevice != null ? "" : catalog.i18nc("@info:status", "The printer is not connected.")
  46. color: outputDevice != null && outputDevice.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
  47. font: UM.Theme.getFont("default")
  48. wrapMode: Text.WordWrap
  49. anchors.left: parent.left
  50. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  51. anchors.right: parent.right
  52. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  53. anchors.top: parent.top
  54. anchors.topMargin: UM.Theme.getSize("default_margin").height
  55. }
  56. }
  57. }