MonitorQueue.qml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. // Copyright (c) 2019 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("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("text_link")
  60. font: UM.Theme.getFont("medium") // 14pt, regular
  61. text: catalog.i18nc("@label link to connect manager", "Manage in browser")
  62. renderType: Text.NativeRendering
  63. }
  64. }
  65. MouseArea
  66. {
  67. anchors.fill: manageQueueLabel
  68. onClicked: OutputDevice.openPrintJobControlPanel()
  69. onEntered:
  70. {
  71. manageQueueText.font.underline = true
  72. }
  73. onExited:
  74. {
  75. manageQueueText.font.underline = false
  76. }
  77. }
  78. Row
  79. {
  80. id: printJobQueueHeadings
  81. anchors
  82. {
  83. left: queuedPrintJobs.left
  84. leftMargin: 6 * screenScaleFactor // TODO: Theme!
  85. top: queuedLabel.bottom
  86. topMargin: 24 * screenScaleFactor // TODO: Theme!
  87. }
  88. spacing: 18 * screenScaleFactor // TODO: Theme!
  89. Label
  90. {
  91. text: catalog.i18nc("@label", "There are no print jobs in the queue. Slice and send a job to add one.")
  92. color: UM.Theme.getColor("monitor_text_primary")
  93. elide: Text.ElideRight
  94. font: UM.Theme.getFont("medium") // 14pt, regular
  95. anchors.verticalCenter: parent.verticalCenter
  96. // FIXED-LINE-HEIGHT:
  97. height: 18 * screenScaleFactor // TODO: Theme!
  98. verticalAlignment: Text.AlignVCenter
  99. renderType: Text.NativeRendering
  100. visible: printJobList.count === 0
  101. }
  102. Label
  103. {
  104. text: catalog.i18nc("@label", "Print jobs")
  105. color: UM.Theme.getColor("monitor_text_primary")
  106. elide: Text.ElideRight
  107. font: UM.Theme.getFont("medium") // 14pt, regular
  108. anchors.verticalCenter: parent.verticalCenter
  109. width: 284 * screenScaleFactor // TODO: Theme! (Should match column size)
  110. // FIXED-LINE-HEIGHT:
  111. height: 18 * screenScaleFactor // TODO: Theme!
  112. verticalAlignment: Text.AlignVCenter
  113. renderType: Text.NativeRendering
  114. visible: printJobList.count > 0
  115. }
  116. Label
  117. {
  118. text: catalog.i18nc("@label", "Total print time")
  119. color: UM.Theme.getColor("monitor_text_primary")
  120. elide: Text.ElideRight
  121. font: UM.Theme.getFont("medium") // 14pt, regular
  122. anchors.verticalCenter: parent.verticalCenter
  123. width: UM.Theme.getSize("monitor_column").width
  124. // FIXED-LINE-HEIGHT:
  125. height: 18 * screenScaleFactor // TODO: Theme!
  126. verticalAlignment: Text.AlignVCenter
  127. renderType: Text.NativeRendering
  128. visible: printJobList.count > 0
  129. }
  130. Label
  131. {
  132. text: catalog.i18nc("@label", "Waiting for")
  133. color: UM.Theme.getColor("monitor_text_primary")
  134. elide: Text.ElideRight
  135. font: UM.Theme.getFont("medium") // 14pt, regular
  136. anchors.verticalCenter: parent.verticalCenter
  137. width: UM.Theme.getSize("monitor_column").width
  138. // FIXED-LINE-HEIGHT:
  139. height: 18 * screenScaleFactor // TODO: Theme!
  140. verticalAlignment: Text.AlignVCenter
  141. renderType: Text.NativeRendering
  142. visible: printJobList.count > 0
  143. }
  144. }
  145. ScrollView
  146. {
  147. id: queuedPrintJobs
  148. anchors
  149. {
  150. bottom: parent.bottom
  151. horizontalCenter: parent.horizontalCenter
  152. top: printJobQueueHeadings.bottom
  153. topMargin: 12 * screenScaleFactor // TODO: Theme!
  154. }
  155. style: UM.Theme.styles.scrollview
  156. width: parent.width
  157. ListView
  158. {
  159. id: printJobList
  160. anchors.fill: parent
  161. delegate: MonitorPrintJobCard
  162. {
  163. anchors
  164. {
  165. left: parent.left
  166. right: parent.right
  167. }
  168. printJob: modelData
  169. }
  170. model:
  171. {
  172. if (OutputDevice.receivedData)
  173. {
  174. return OutputDevice.queuedPrintJobs
  175. }
  176. return [null, null]
  177. }
  178. spacing: 6 // TODO: Theme!
  179. }
  180. }
  181. }