ClusterControlItem.qml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. import QtQuick 2.2
  2. import QtQuick.Controls 1.4
  3. import UM 1.3 as UM
  4. import Cura 1.0 as Cura
  5. Component
  6. {
  7. Rectangle
  8. {
  9. id: base
  10. property var manager: Cura.MachineManager.printerOutputDevices[0]
  11. property var lineColor: "#DCDCDC" // TODO: Should be linked to theme.
  12. property var cornerRadius: 4 * screenScaleFactor // TODO: Should be linked to theme.
  13. visible: manager != null
  14. anchors.fill: parent
  15. color: UM.Theme.getColor("viewport_background")
  16. UM.I18nCatalog
  17. {
  18. id: catalog
  19. name: "cura"
  20. }
  21. Label
  22. {
  23. id: activePrintersLabel
  24. font: UM.Theme.getFont("large")
  25. anchors.horizontalCenter: parent.horizontalCenter
  26. anchors.topMargin: UM.Theme.getSize("default_margin").height
  27. anchors.top: parent.top
  28. text: Cura.MachineManager.printerOutputDevices[0].name
  29. }
  30. Rectangle
  31. {
  32. id: printJobArea
  33. border.width: UM.Theme.getSize("default_lining").width
  34. border.color: lineColor
  35. anchors.top: activePrintersLabel.bottom
  36. anchors.topMargin: UM.Theme.getSize("default_margin").height
  37. anchors.left: parent.left
  38. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  39. anchors.right: parent.right
  40. anchors.rightMargin:UM.Theme.getSize("default_margin").width
  41. radius: cornerRadius
  42. height: childrenRect.height
  43. Item
  44. {
  45. id: printJobTitleBar
  46. width: parent.width
  47. height: printJobTitleLabel.height + 2 * UM.Theme.getSize("default_margin").height
  48. Label
  49. {
  50. id: printJobTitleLabel
  51. anchors.left: parent.left
  52. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  53. anchors.top: parent.top
  54. anchors.topMargin: UM.Theme.getSize("default_margin").height
  55. text: catalog.i18nc("@title", "Print jobs")
  56. font: UM.Theme.getFont("default")
  57. opacity: 0.75
  58. }
  59. Rectangle
  60. {
  61. anchors.bottom: parent.bottom
  62. height: UM.Theme.getSize("default_lining").width
  63. color: lineColor
  64. width: parent.width
  65. }
  66. }
  67. Column
  68. {
  69. id: printJobColumn
  70. anchors.top: printJobTitleBar.bottom
  71. anchors.topMargin: UM.Theme.getSize("default_margin").height
  72. anchors.left: parent.left
  73. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  74. anchors.right: parent.right
  75. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  76. Item
  77. {
  78. width: parent.width
  79. height: childrenRect.height
  80. opacity: 0.65
  81. Label
  82. {
  83. text: catalog.i18nc("@label", "Printing")
  84. font: UM.Theme.getFont("very_small")
  85. }
  86. Label
  87. {
  88. text: manager.activePrintJobs.length
  89. font: UM.Theme.getFont("small")
  90. anchors.right: parent.right
  91. }
  92. }
  93. Item
  94. {
  95. width: parent.width
  96. height: childrenRect.height
  97. opacity: 0.65
  98. Label
  99. {
  100. text: catalog.i18nc("@label", "Queued")
  101. font: UM.Theme.getFont("very_small")
  102. }
  103. Label
  104. {
  105. text: manager.queuedPrintJobs.length
  106. font: UM.Theme.getFont("small")
  107. anchors.right: parent.right
  108. }
  109. }
  110. }
  111. OpenPanelButton
  112. {
  113. anchors.top: printJobColumn.bottom
  114. anchors.left: parent.left
  115. anchors.right: parent.right
  116. anchors.margins: UM.Theme.getSize("default_margin").height
  117. id: configButton
  118. onClicked: base.manager.openPrintJobControlPanel()
  119. text: catalog.i18nc("@action:button", "View print jobs")
  120. }
  121. Item
  122. {
  123. // spacer
  124. anchors.top: configButton.bottom
  125. width: UM.Theme.getSize("default_margin").width
  126. height: UM.Theme.getSize("default_margin").height
  127. }
  128. }
  129. Rectangle
  130. {
  131. id: printersArea
  132. border.width: UM.Theme.getSize("default_lining").width
  133. border.color: lineColor
  134. anchors.top: printJobArea.bottom
  135. anchors.topMargin: UM.Theme.getSize("default_margin").height
  136. anchors.left: parent.left
  137. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  138. anchors.right: parent.right
  139. anchors.rightMargin:UM.Theme.getSize("default_margin").width
  140. radius: cornerRadius
  141. height: childrenRect.height
  142. Item
  143. {
  144. id: printersTitleBar
  145. width: parent.width
  146. height: printJobTitleLabel.height + 2 * UM.Theme.getSize("default_margin").height
  147. Label
  148. {
  149. id: printersTitleLabel
  150. anchors.left: parent.left
  151. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  152. anchors.top: parent.top
  153. anchors.topMargin: UM.Theme.getSize("default_margin").height
  154. text: catalog.i18nc("@label:title", "Printers")
  155. font: UM.Theme.getFont("default")
  156. opacity: 0.75
  157. }
  158. Rectangle
  159. {
  160. anchors.bottom: parent.bottom
  161. height: UM.Theme.getSize("default_lining").width
  162. color: lineColor
  163. width: parent.width
  164. }
  165. }
  166. Column
  167. {
  168. id: printersColumn
  169. anchors.top: printersTitleBar.bottom
  170. anchors.topMargin: UM.Theme.getSize("default_margin").height
  171. anchors.left: parent.left
  172. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  173. anchors.right: parent.right
  174. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  175. Repeater
  176. {
  177. model: manager.connectedPrintersTypeCount
  178. Item
  179. {
  180. width: parent.width
  181. height: childrenRect.height
  182. opacity: 0.65
  183. Label
  184. {
  185. text: modelData.machine_type
  186. font: UM.Theme.getFont("very_small")
  187. }
  188. Label
  189. {
  190. text: modelData.count
  191. font: UM.Theme.getFont("small")
  192. anchors.right: parent.right
  193. }
  194. }
  195. }
  196. }
  197. OpenPanelButton
  198. {
  199. anchors.top: printersColumn.bottom
  200. anchors.left: parent.left
  201. anchors.right: parent.right
  202. anchors.margins: UM.Theme.getSize("default_margin").height
  203. id: printerConfigButton
  204. onClicked: base.manager.openPrinterControlPanel()
  205. text: catalog.i18nc("@action:button", "View printers")
  206. }
  207. Item
  208. {
  209. // spacer
  210. anchors.top: printerConfigButton.bottom
  211. width: UM.Theme.getSize("default_margin").width
  212. height: UM.Theme.getSize("default_margin").height
  213. }
  214. }
  215. }
  216. }