MonitorQueue.qml 5.4 KB

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