MonitorQueue.qml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. // Copyright (c) 2022 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Controls 2.15
  5. import UM 1.5 as UM
  6. import Cura 1.0 as Cura
  7. /**
  8. * This component contains the print job queue, extracted from the primary
  9. * MonitorStage.qml file not for reusability but simply to keep it lean and more
  10. * readable.
  11. */
  12. Item
  13. {
  14. // If the printer is a cloud printer or not. Other items base their enabled state off of this boolean. In the future
  15. // they might not need to though.
  16. property bool cloudConnection: Cura.MachineManager.activeMachineIsUsingCloudConnection
  17. UM.Label
  18. {
  19. id: queuedLabel
  20. anchors
  21. {
  22. left: printJobList.left
  23. top: parent.top
  24. }
  25. font: UM.Theme.getFont("large")
  26. text: catalog.i18nc("@label", "Queued")
  27. }
  28. Item
  29. {
  30. id: manageQueueLabel
  31. anchors
  32. {
  33. right: printJobList.right
  34. verticalCenter: queuedLabel.verticalCenter
  35. }
  36. height: 18 * screenScaleFactor // TODO: Theme!
  37. width: childrenRect.width
  38. visible: OutputDevice.canReadPrinterDetails
  39. UM.ColorImage
  40. {
  41. id: externalLinkIcon
  42. anchors.verticalCenter: manageQueueLabel.verticalCenter
  43. color: UM.Theme.getColor("text_link")
  44. source: UM.Theme.getIcon("LinkExternal")
  45. width: 16 * screenScaleFactor // TODO: Theme! (Y U NO USE 18 LIKE ALL OTHER ICONS?!)
  46. height: 16 * screenScaleFactor // TODO: Theme! (Y U NO USE 18 LIKE ALL OTHER ICONS?!)
  47. }
  48. UM.Label
  49. {
  50. id: manageQueueText
  51. anchors
  52. {
  53. left: externalLinkIcon.right
  54. leftMargin: UM.Theme.getSize("narrow_margin").width
  55. verticalCenter: externalLinkIcon.verticalCenter
  56. }
  57. color: UM.Theme.getColor("text_link")
  58. font: UM.Theme.getFont("medium") // 14pt, regular
  59. text: catalog.i18nc("@label link to connect manager", "Manage in browser")
  60. }
  61. }
  62. MouseArea
  63. {
  64. anchors.fill: manageQueueLabel
  65. onClicked: OutputDevice.openPrintJobControlPanel()
  66. onEntered: manageQueueText.font.underline = true
  67. onExited: manageQueueText.font.underline = false
  68. }
  69. Row
  70. {
  71. id: printJobQueueHeadings
  72. anchors
  73. {
  74. left: printJobList.left
  75. leftMargin: UM.Theme.getSize("narrow_margin").width
  76. top: queuedLabel.bottom
  77. topMargin: 24 * screenScaleFactor // TODO: Theme!
  78. }
  79. spacing: 18 * screenScaleFactor // TODO: Theme!
  80. UM.Label
  81. {
  82. text: catalog.i18nc("@label", "There are no print jobs in the queue. Slice and send a job to add one.")
  83. font: UM.Theme.getFont("medium")
  84. anchors.verticalCenter: parent.verticalCenter
  85. visible: printJobList.count === 0
  86. }
  87. UM.Label
  88. {
  89. text: catalog.i18nc("@label", "Print jobs")
  90. font: UM.Theme.getFont("medium") // 14pt, regular
  91. anchors.verticalCenter: parent.verticalCenter
  92. width: 284 * screenScaleFactor // TODO: Theme! (Should match column size)
  93. visible: printJobList.count > 0
  94. }
  95. UM.Label
  96. {
  97. text: catalog.i18nc("@label", "Total print time")
  98. font: UM.Theme.getFont("medium") // 14pt, regular
  99. anchors.verticalCenter: parent.verticalCenter
  100. width: UM.Theme.getSize("monitor_column").width
  101. visible: printJobList.count > 0
  102. }
  103. UM.Label
  104. {
  105. text: catalog.i18nc("@label", "Waiting for")
  106. font: UM.Theme.getFont("medium") // 14pt, regular
  107. anchors.verticalCenter: parent.verticalCenter
  108. width: UM.Theme.getSize("monitor_column").width
  109. visible: printJobList.count > 0
  110. }
  111. }
  112. ListView
  113. {
  114. id: printJobList
  115. anchors
  116. {
  117. bottom: parent.bottom
  118. horizontalCenter: parent.horizontalCenter
  119. top: printJobQueueHeadings.bottom
  120. topMargin: UM.Theme.getSize("default_margin").width
  121. }
  122. width: parent.width
  123. ScrollBar.vertical: UM.ScrollBar
  124. {
  125. id: printJobScrollBar
  126. }
  127. spacing: UM.Theme.getSize("narrow_margin").width
  128. clip: true
  129. delegate: MonitorPrintJobCard
  130. {
  131. anchors
  132. {
  133. left: parent.left
  134. right: parent.right
  135. rightMargin: printJobScrollBar.width
  136. }
  137. printJob: modelData
  138. }
  139. model:
  140. {
  141. if (OutputDevice.receivedData)
  142. {
  143. return OutputDevice.queuedPrintJobs
  144. }
  145. return [null, null]
  146. }
  147. }
  148. }