MonitorStage.qml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. // Copyright (c) 2022 UltiMaker
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.15
  4. import UM 1.5 as UM
  5. import Cura 1.0 as Cura
  6. // This is the root component for the monitor stage.
  7. Component
  8. {
  9. Rectangle
  10. {
  11. id: monitorFrame
  12. height: maximumHeight
  13. onVisibleChanged:
  14. {
  15. if (monitorFrame != null && !monitorFrame.visible)
  16. {
  17. OutputDevice.setActiveCameraUrl("")
  18. }
  19. }
  20. width: maximumWidth
  21. color: UM.Theme.getColor("monitor_stage_background")
  22. // Enable keyboard navigation. NOTE: This is done here so that we can also potentially
  23. // forward to the queue items in the future. (Deleting selected print job, etc.)
  24. Keys.forwardTo: carousel
  25. Component.onCompleted: forceActiveFocus()
  26. UM.I18nCatalog
  27. {
  28. id: catalog
  29. name: "cura"
  30. }
  31. Item
  32. {
  33. id: printers
  34. visible: !Cura.MachineManager.activeMachineIsAbstractCloudPrinter
  35. anchors
  36. {
  37. top: parent.top
  38. topMargin: 48 * screenScaleFactor // TODO: Theme!
  39. }
  40. width: parent.width
  41. height: 264 * screenScaleFactor // TODO: Theme!
  42. MonitorCarousel
  43. {
  44. id: carousel
  45. printers:
  46. {
  47. if (OutputDevice.receivedData)
  48. {
  49. return OutputDevice.printers
  50. }
  51. return [null]
  52. }
  53. }
  54. }
  55. MonitorQueue
  56. {
  57. id: queue
  58. width: Math.min(834 * screenScaleFactor, maximumWidth)
  59. anchors
  60. {
  61. bottom: parent.bottom
  62. horizontalCenter: parent.horizontalCenter
  63. top: printers.bottom
  64. topMargin: 48 * screenScaleFactor // TODO: Theme!
  65. }
  66. visible: OutputDevice.supportsPrintJobQueue && OutputDevice.canReadPrintJobs && !Cura.MachineManager.activeMachineIsAbstractCloudPrinter
  67. }
  68. PrinterVideoStream
  69. {
  70. anchors.fill: parent
  71. cameraUrl: OutputDevice.activeCameraUrl
  72. visible: OutputDevice.activeCameraUrl != "" && !Cura.MachineManager.activeMachineIsAbstractCloudPrinter
  73. }
  74. Rectangle
  75. {
  76. id: sendToFactoryCard
  77. visible: Cura.MachineManager.activeMachineIsAbstractCloudPrinter
  78. color: UM.Theme.getColor("monitor_stage_background")
  79. height: childrenRect.height + UM.Theme.getSize("default_margin").height * 2
  80. width: childrenRect.width + UM.Theme.getSize("wide_margin").width * 2
  81. anchors
  82. {
  83. horizontalCenter: parent.horizontalCenter
  84. top: parent.top
  85. topMargin: UM.Theme.getSize("wide_margin").height * screenScaleFactor * 2
  86. }
  87. Column
  88. {
  89. anchors.horizontalCenter: parent.horizontalCenter
  90. anchors.verticalCenter: parent.verticalCenter
  91. spacing: UM.Theme.getSize("wide_margin").height
  92. padding: UM.Theme.getSize("default_margin").width
  93. topPadding: 0
  94. Image
  95. {
  96. id: sendToFactoryImage
  97. anchors.horizontalCenter: parent.horizontalCenter
  98. source: UM.Theme.getImage("cura_connected_printers")
  99. }
  100. UM.Label
  101. {
  102. anchors.horizontalCenter: parent.horizontalCenter
  103. text: catalog.i18nc("@info", "Monitor your printers from everywhere using Ultimaker Digital Factory")
  104. font: UM.Theme.getFont("medium")
  105. width: sendToFactoryImage.width
  106. wrapMode: Text.WordWrap
  107. horizontalAlignment: Text.AlignHCenter
  108. verticalAlignment: Text.AlignVCenter
  109. }
  110. Cura.PrimaryButton
  111. {
  112. id: sendToFactoryButton
  113. anchors.horizontalCenter: parent.horizontalCenter
  114. text: catalog.i18nc("@button", "View printers in Digital Factory")
  115. onClicked: Qt.openUrlExternally("https://digitalfactory.ultimaker.com/app/welcome?utm_source=cura&utm_medium=software&utm_campaign=monitor-view-cloud-printer-type")
  116. }
  117. }
  118. }
  119. }
  120. }