MonitorQueue.qml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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("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. // FIXED-LINE-HEIGHT:
  98. height: 18 * screenScaleFactor // TODO: Theme!
  99. verticalAlignment: Text.AlignVCenter
  100. renderType: Text.NativeRendering
  101. visible: printJobList.count === 0
  102. }
  103. Label
  104. {
  105. text: catalog.i18nc("@label", "Print jobs")
  106. color: UM.Theme.getColor("monitor_text_primary")
  107. elide: Text.ElideRight
  108. font: UM.Theme.getFont("medium") // 14pt, regular
  109. anchors.verticalCenter: parent.verticalCenter
  110. width: 284 * screenScaleFactor // TODO: Theme! (Should match column size)
  111. // FIXED-LINE-HEIGHT:
  112. height: 18 * screenScaleFactor // TODO: Theme!
  113. verticalAlignment: Text.AlignVCenter
  114. renderType: Text.NativeRendering
  115. visible: printJobList.count > 0
  116. }
  117. Label
  118. {
  119. text: catalog.i18nc("@label", "Total print time")
  120. color: UM.Theme.getColor("monitor_text_primary")
  121. elide: Text.ElideRight
  122. font: UM.Theme.getFont("medium") // 14pt, regular
  123. anchors.verticalCenter: parent.verticalCenter
  124. width: UM.Theme.getSize("monitor_column").width
  125. // FIXED-LINE-HEIGHT:
  126. height: 18 * screenScaleFactor // TODO: Theme!
  127. verticalAlignment: Text.AlignVCenter
  128. renderType: Text.NativeRendering
  129. visible: printJobList.count > 0
  130. }
  131. Label
  132. {
  133. text: catalog.i18nc("@label", "Waiting for")
  134. color: UM.Theme.getColor("monitor_text_primary")
  135. elide: Text.ElideRight
  136. font: UM.Theme.getFont("medium") // 14pt, regular
  137. anchors.verticalCenter: parent.verticalCenter
  138. width: UM.Theme.getSize("monitor_column").width
  139. // FIXED-LINE-HEIGHT:
  140. height: 18 * screenScaleFactor // TODO: Theme!
  141. verticalAlignment: Text.AlignVCenter
  142. renderType: Text.NativeRendering
  143. visible: printJobList.count > 0
  144. }
  145. }
  146. ScrollView
  147. {
  148. id: queuedPrintJobs
  149. anchors
  150. {
  151. bottom: parent.bottom
  152. horizontalCenter: parent.horizontalCenter
  153. top: printJobQueueHeadings.bottom
  154. topMargin: 12 * screenScaleFactor // TODO: Theme!
  155. }
  156. style: UM.Theme.styles.scrollview
  157. width: parent.width
  158. ListView
  159. {
  160. id: printJobList
  161. anchors.fill: parent
  162. delegate: MonitorPrintJobCard
  163. {
  164. anchors
  165. {
  166. left: parent.left
  167. right: parent.right
  168. }
  169. printJob: modelData
  170. }
  171. model:
  172. {
  173. if (OutputDevice.receivedData)
  174. {
  175. return OutputDevice.queuedPrintJobs
  176. }
  177. return [null, null]
  178. }
  179. spacing: 6 // TODO: Theme!
  180. }
  181. }
  182. }