MonitorQueue.qml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. UM.ColorImage
  39. {
  40. id: externalLinkIcon
  41. anchors.verticalCenter: manageQueueLabel.verticalCenter
  42. color: UM.Theme.getColor("text_link")
  43. source: UM.Theme.getIcon("LinkExternal")
  44. width: 16 * screenScaleFactor // TODO: Theme! (Y U NO USE 18 LIKE ALL OTHER ICONS?!)
  45. height: 16 * screenScaleFactor // TODO: Theme! (Y U NO USE 18 LIKE ALL OTHER ICONS?!)
  46. }
  47. UM.Label
  48. {
  49. id: manageQueueText
  50. anchors
  51. {
  52. left: externalLinkIcon.right
  53. leftMargin: UM.Theme.getSize("narrow_margin").width
  54. verticalCenter: externalLinkIcon.verticalCenter
  55. }
  56. color: UM.Theme.getColor("text_link")
  57. font: UM.Theme.getFont("medium") // 14pt, regular
  58. text: catalog.i18nc("@label link to connect manager", "Manage in browser")
  59. }
  60. }
  61. MouseArea
  62. {
  63. anchors.fill: manageQueueLabel
  64. onClicked: OutputDevice.openPrintJobControlPanel()
  65. onEntered: manageQueueText.font.underline = true
  66. onExited: manageQueueText.font.underline = false
  67. }
  68. Row
  69. {
  70. id: printJobQueueHeadings
  71. anchors
  72. {
  73. left: printJobList.left
  74. leftMargin: UM.Theme.getSize("narrow_margin").width
  75. top: queuedLabel.bottom
  76. topMargin: 24 * screenScaleFactor // TODO: Theme!
  77. }
  78. spacing: 18 * screenScaleFactor // TODO: Theme!
  79. UM.Label
  80. {
  81. text: catalog.i18nc("@label", "There are no print jobs in the queue. Slice and send a job to add one.")
  82. font: UM.Theme.getFont("medium")
  83. anchors.verticalCenter: parent.verticalCenter
  84. visible: printJobList.count === 0
  85. }
  86. UM.Label
  87. {
  88. text: catalog.i18nc("@label", "Print jobs")
  89. font: UM.Theme.getFont("medium") // 14pt, regular
  90. anchors.verticalCenter: parent.verticalCenter
  91. width: 284 * screenScaleFactor // TODO: Theme! (Should match column size)
  92. visible: printJobList.count > 0
  93. }
  94. UM.Label
  95. {
  96. text: catalog.i18nc("@label", "Total print time")
  97. font: UM.Theme.getFont("medium") // 14pt, regular
  98. anchors.verticalCenter: parent.verticalCenter
  99. width: UM.Theme.getSize("monitor_column").width
  100. visible: printJobList.count > 0
  101. }
  102. UM.Label
  103. {
  104. text: catalog.i18nc("@label", "Waiting for")
  105. font: UM.Theme.getFont("medium") // 14pt, regular
  106. anchors.verticalCenter: parent.verticalCenter
  107. width: UM.Theme.getSize("monitor_column").width
  108. visible: printJobList.count > 0
  109. }
  110. }
  111. ListView
  112. {
  113. id: printJobList
  114. anchors
  115. {
  116. bottom: parent.bottom
  117. horizontalCenter: parent.horizontalCenter
  118. top: printJobQueueHeadings.bottom
  119. topMargin: UM.Theme.getSize("default_margin").width
  120. }
  121. width: parent.width
  122. ScrollBar.vertical: UM.ScrollBar
  123. {
  124. id: printJobScrollBar
  125. }
  126. spacing: UM.Theme.getSize("narrow_margin").width
  127. clip: true
  128. delegate: MonitorPrintJobCard
  129. {
  130. anchors
  131. {
  132. left: parent.left
  133. right: parent.right
  134. rightMargin: printJobScrollBar.width
  135. }
  136. printJob: modelData
  137. }
  138. model:
  139. {
  140. if (OutputDevice.receivedData)
  141. {
  142. return OutputDevice.queuedPrintJobs
  143. }
  144. return [null, null]
  145. }
  146. }
  147. }