OutputDeviceHeader.qml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. Rectangle
  13. {
  14. anchors.fill: parent
  15. color: UM.Theme.getColor("setting_category")
  16. property var activePrinter: outputDevice != null ? outputDevice.activePrinter : null
  17. Label
  18. {
  19. id: outputDeviceNameLabel
  20. font: UM.Theme.getFont("large")
  21. color: UM.Theme.getColor("text")
  22. anchors.left: parent.left
  23. anchors.top: parent.top
  24. anchors.margins: UM.Theme.getSize("default_margin").width
  25. text: outputDevice != null ? activePrinter.name : ""
  26. }
  27. Label
  28. {
  29. id: outputDeviceAddressLabel
  30. text: (outputDevice != null && outputDevice.address != null) ? outputDevice.address : ""
  31. font: UM.Theme.getFont("small")
  32. color: UM.Theme.getColor("text_inactive")
  33. anchors.top: parent.top
  34. anchors.right: parent.right
  35. anchors.margins: UM.Theme.getSize("default_margin").width
  36. }
  37. Label
  38. {
  39. text: outputDevice != null ? "" : catalog.i18nc("@info:status", "The printer is not connected.")
  40. color: outputDevice != null && outputDevice.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
  41. font: UM.Theme.getFont("very_small")
  42. wrapMode: Text.WordWrap
  43. anchors.left: parent.left
  44. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  45. anchors.right: parent.right
  46. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  47. anchors.top: parent.top
  48. anchors.topMargin: UM.Theme.getSize("default_margin").height
  49. }
  50. }
  51. }