PrinterVideoStream.qml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. Item
  6. {
  7. Rectangle
  8. {
  9. anchors.fill:parent
  10. color: UM.Theme.getColor("viewport_overlay")
  11. opacity: 0.5
  12. }
  13. MouseArea
  14. {
  15. anchors.fill: parent
  16. onClicked: OutputDevice.selectAutomaticPrinter()
  17. z: 0
  18. }
  19. Button
  20. {
  21. id: backButton
  22. anchors.bottom: cameraImage.top
  23. anchors.bottomMargin: UM.Theme.getSize("default_margin").width
  24. anchors.right: cameraImage.right
  25. // TODO: Harcoded sizes
  26. width: 20 * screenScaleFactor
  27. height: 20 * screenScaleFactor
  28. onClicked: OutputDevice.selectAutomaticPrinter()
  29. style: ButtonStyle
  30. {
  31. label: Item
  32. {
  33. UM.RecolorImage
  34. {
  35. anchors.verticalCenter: parent.verticalCenter
  36. anchors.horizontalCenter: parent.horizontalCenter
  37. width: control.width
  38. height: control.height
  39. sourceSize.width: width
  40. sourceSize.height: width
  41. source: UM.Theme.getIcon("cross1")
  42. }
  43. }
  44. background: Item {}
  45. }
  46. }
  47. Image
  48. {
  49. id: cameraImage
  50. width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth)
  51. height: (sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width
  52. anchors.horizontalCenter: parent.horizontalCenter
  53. anchors.verticalCenter: parent.verticalCenter
  54. z: 1
  55. onVisibleChanged:
  56. {
  57. if(visible)
  58. {
  59. OutputDevice.startCamera()
  60. } else
  61. {
  62. OutputDevice.stopCamera()
  63. }
  64. }
  65. source:
  66. {
  67. if(OutputDevice.cameraImage)
  68. {
  69. return OutputDevice.cameraImage;
  70. }
  71. return "";
  72. }
  73. }
  74. MouseArea
  75. {
  76. anchors.fill: cameraImage
  77. onClicked: { /* no-op */ }
  78. z: 1
  79. }
  80. }