OutputDeviceHeader.qml 2.2 KB

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