MonitorQueue.qml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Controls 1.4
  5. import QtQuick.Controls.Styles 1.4
  6. import UM 1.3 as UM
  7. import Cura 1.0 as Cura
  8. /**
  9. * This component contains the print job queue, extracted from the primary
  10. * MonitorStage.qml file not for reusability but simply to keep it lean and more
  11. * readable.
  12. */
  13. Item
  14. {
  15. // If the printer is a cloud printer or not. Other items base their enabled state off of this boolean. In the future
  16. // they might not need to though.
  17. property bool cloudConnection: Cura.MachineManager.activeMachineIsUsingCloudConnection
  18. Label
  19. {
  20. id: queuedLabel
  21. anchors
  22. {
  23. left: queuedPrintJobs.left
  24. top: parent.top
  25. }
  26. color: UM.Theme.getColor("monitor_text_primary")
  27. font: UM.Theme.getFont("large")
  28. text: catalog.i18nc("@label", "Queued")
  29. renderType: Text.NativeRendering
  30. }
  31. Item
  32. {
  33. id: manageQueueLabel
  34. anchors
  35. {
  36. right: queuedPrintJobs.right
  37. verticalCenter: queuedLabel.verticalCenter
  38. }
  39. height: 18 * screenScaleFactor // TODO: Theme!
  40. width: childrenRect.width
  41. UM.RecolorImage
  42. {
  43. id: externalLinkIcon
  44. anchors.verticalCenter: manageQueueLabel.verticalCenter
  45. color: UM.Theme.getColor("monitor_text_link")
  46. source: UM.Theme.getIcon("external_link")
  47. width: 16 * screenScaleFactor // TODO: Theme! (Y U NO USE 18 LIKE ALL OTHER ICONS?!)
  48. height: 16 * screenScaleFactor // TODO: Theme! (Y U NO USE 18 LIKE ALL OTHER ICONS?!)
  49. }
  50. Label
  51. {
  52. id: manageQueueText
  53. anchors
  54. {
  55. left: externalLinkIcon.right
  56. leftMargin: 6 * screenScaleFactor // TODO: Theme!
  57. verticalCenter: externalLinkIcon.verticalCenter
  58. }
  59. color: UM.Theme.getColor("monitor_text_link")
  60. font: UM.Theme.getFont("medium") // 14pt, regular
  61. linkColor: UM.Theme.getColor("monitor_text_link")
  62. text: catalog.i18nc("@label link to connect manager", "Manage in browser")
  63. renderType: Text.NativeRendering
  64. }
  65. }
  66. MouseArea
  67. {
  68. anchors.fill: manageQueueLabel
  69. onClicked: OutputDevice.openPrintJobControlPanel()
  70. onEntered:
  71. {
  72. manageQueueText.font.underline = true
  73. }
  74. onExited:
  75. {
  76. manageQueueText.font.underline = false
  77. }
  78. }
  79. Row
  80. {
  81. id: printJobQueueHeadings
  82. anchors
  83. {
  84. left: queuedPrintJobs.left
  85. leftMargin: 6 * screenScaleFactor // TODO: Theme!
  86. top: queuedLabel.bottom
  87. topMargin: 24 * screenScaleFactor // TODO: Theme!
  88. }
  89. spacing: 18 * screenScaleFactor // TODO: Theme!
  90. Label
  91. {
  92. text: catalog.i18nc("@label", "There are no print jobs in the queue. Slice and send a job to add one.")
  93. color: UM.Theme.getColor("monitor_text_primary")
  94. elide: Text.ElideRight
  95. font: UM.Theme.getFont("medium") // 14pt, regular
  96. anchors.verticalCenter: parent.verticalCenter
  97. width: 600 * screenScaleFactor // TODO: Theme! (Should match column size)
  98. // FIXED-LINE-HEIGHT:
  99. height: 18 * screenScaleFactor // TODO: Theme!
  100. verticalAlignment: Text.AlignVCenter
  101. renderType: Text.NativeRendering
  102. visible: printJobList.count === 0
  103. }
  104. Label
  105. {
  106. text: catalog.i18nc("@label", "Print jobs")
  107. color: UM.Theme.getColor("monitor_text_primary")
  108. elide: Text.ElideRight
  109. font: UM.Theme.getFont("medium") // 14pt, regular
  110. anchors.verticalCenter: parent.verticalCenter
  111. width: 284 * screenScaleFactor // TODO: Theme! (Should match column size)
  112. // FIXED-LINE-HEIGHT:
  113. height: 18 * screenScaleFactor // TODO: Theme!
  114. verticalAlignment: Text.AlignVCenter
  115. renderType: Text.NativeRendering
  116. visible: printJobList.count > 0
  117. }
  118. Label
  119. {
  120. text: catalog.i18nc("@label", "Total print time")
  121. color: UM.Theme.getColor("monitor_text_primary")
  122. elide: Text.ElideRight
  123. font: UM.Theme.getFont("medium") // 14pt, regular
  124. anchors.verticalCenter: parent.verticalCenter
  125. width: UM.Theme.getSize("monitor_column").width
  126. // FIXED-LINE-HEIGHT:
  127. height: 18 * screenScaleFactor // TODO: Theme!
  128. verticalAlignment: Text.AlignVCenter
  129. renderType: Text.NativeRendering
  130. visible: printJobList.count > 0
  131. }
  132. Label
  133. {
  134. text: catalog.i18nc("@label", "Waiting for")
  135. color: UM.Theme.getColor("monitor_text_primary")
  136. elide: Text.ElideRight
  137. font: UM.Theme.getFont("medium") // 14pt, regular
  138. anchors.verticalCenter: parent.verticalCenter
  139. width: UM.Theme.getSize("monitor_column").width
  140. // FIXED-LINE-HEIGHT:
  141. height: 18 * screenScaleFactor // TODO: Theme!
  142. verticalAlignment: Text.AlignVCenter
  143. renderType: Text.NativeRendering
  144. visible: printJobList.count > 0
  145. }
  146. }
  147. ScrollView
  148. {
  149. id: queuedPrintJobs
  150. anchors
  151. {
  152. bottom: parent.bottom
  153. horizontalCenter: parent.horizontalCenter
  154. top: printJobQueueHeadings.bottom
  155. topMargin: 12 * screenScaleFactor // TODO: Theme!
  156. }
  157. style: UM.Theme.styles.scrollview
  158. width: parent.width
  159. ListView
  160. {
  161. id: printJobList
  162. anchors.fill: parent
  163. delegate: MonitorPrintJobCard
  164. {
  165. anchors
  166. {
  167. left: parent.left
  168. right: parent.right
  169. }
  170. printJob: modelData
  171. }
  172. model:
  173. {
  174. // When printing over the cloud we don't recieve print jobs until there is one, so
  175. // unless there's at least one print job we'll be stuck with skeleton loading
  176. // indefinitely.
  177. if (Cura.MachineManager.activeMachineIsUsingCloudConnection || OutputDevice.receivedPrintJobs)
  178. {
  179. return OutputDevice.queuedPrintJobs
  180. }
  181. return [null, null]
  182. }
  183. spacing: 6 // TODO: Theme!
  184. }
  185. }
  186. }