MonitorPrinterCard.qml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.3
  4. import QtQuick.Controls 2.0
  5. import UM 1.3 as UM
  6. /**
  7. * A Printer Card is has two main components: the printer portion and the print
  8. * job portion, the latter being paired in the UI when a print job is paired
  9. * a printer in-cluster.
  10. *
  11. * NOTE: For most labels, a fixed height with vertical alignment is used to make
  12. * layouts more deterministic (like the fixed-size textboxes used in original
  13. * mock-ups). This is also a stand-in for CSS's 'line-height' property. Denoted
  14. * with '// FIXED-LINE-HEIGHT:'.
  15. */
  16. Item
  17. {
  18. id: base
  19. // The printer which all printer data is derived from
  20. property var printer: null
  21. property var borderSize: 1 * screenScaleFactor // TODO: Theme, and remove from here
  22. width: 834 * screenScaleFactor // TODO: Theme!
  23. height: 216 * screenScaleFactor // TODO: Theme!
  24. // Printer portion
  25. Rectangle
  26. {
  27. id: printerInfo
  28. border
  29. {
  30. color: "#EAEAEC" // TODO: Theme!
  31. width: borderSize // TODO: Remove once themed
  32. }
  33. color: "white" // TODO: Theme!
  34. width: parent.width
  35. height: 144 * screenScaleFactor // TODO: Theme!
  36. Row
  37. {
  38. anchors
  39. {
  40. left: parent.left
  41. leftMargin: 36 * screenScaleFactor // TODO: Theme!
  42. verticalCenter: parent.verticalCenter
  43. }
  44. spacing: 18 * screenScaleFactor // TODO: Theme!
  45. Image
  46. {
  47. id: printerImage
  48. width: 108 * screenScaleFactor // TODO: Theme!
  49. height: 108 * screenScaleFactor // TODO: Theme!
  50. fillMode: Image.PreserveAspectFit
  51. source:
  52. {
  53. console.log(printer)
  54. return "../png/ultimaker_s5.png"
  55. }
  56. mipmap: true
  57. }
  58. Item
  59. {
  60. anchors
  61. {
  62. verticalCenter: parent.verticalCenter
  63. }
  64. width: 216 * screenScaleFactor // TODO: Theme!
  65. height: printerNameLabel.height + printerFamilyPill.height + 6 * screenScaleFactor // TODO: Theme!
  66. Label
  67. {
  68. id: printerNameLabel
  69. text: printer && printer.name ? printer.name : ""
  70. color: "#414054" // TODO: Theme!
  71. elide: Text.ElideRight
  72. font: UM.Theme.getFont("large") // 16pt, bold
  73. width: parent.width
  74. // FIXED-LINE-HEIGHT:
  75. height: 18 * screenScaleFactor // TODO: Theme!
  76. verticalAlignment: Text.AlignVCenter
  77. }
  78. MonitorPrinterPill
  79. {
  80. id: printerFamilyPill
  81. anchors
  82. {
  83. top: printerNameLabel.bottom
  84. topMargin: 6 * screenScaleFactor // TODO: Theme!
  85. left: printerNameLabel.left
  86. }
  87. text: printer.type
  88. }
  89. }
  90. MonitorPrinterConfiguration
  91. {
  92. id: printerConfiguration
  93. anchors.verticalCenter: parent.verticalCenter
  94. buildplate: "Glass"
  95. configurations:
  96. [
  97. base.printer.printerConfiguration.extruderConfigurations[0],
  98. base.printer.printerConfiguration.extruderConfigurations[1]
  99. ]
  100. height: 72 * screenScaleFactor // TODO: Theme!
  101. }
  102. }
  103. PrintJobContextMenu
  104. {
  105. id: contextButton
  106. anchors
  107. {
  108. right: parent.right
  109. rightMargin: 12 * screenScaleFactor // TODO: Theme!
  110. top: parent.top
  111. topMargin: 12 * screenScaleFactor // TODO: Theme!
  112. }
  113. printJob: printer.activePrintJob
  114. width: 36 * screenScaleFactor // TODO: Theme!
  115. height: 36 * screenScaleFactor // TODO: Theme!
  116. }
  117. CameraButton
  118. {
  119. id: cameraButton;
  120. anchors
  121. {
  122. right: parent.right
  123. rightMargin: 20 * screenScaleFactor // TODO: Theme!
  124. bottom: parent.bottom
  125. bottomMargin: 20 * screenScaleFactor // TODO: Theme!
  126. }
  127. iconSource: "../svg/camera-icon.svg"
  128. }
  129. }
  130. // Print job portion
  131. Rectangle
  132. {
  133. id: printJobInfo
  134. anchors
  135. {
  136. top: printerInfo.bottom
  137. topMargin: -borderSize * screenScaleFactor // TODO: Theme!
  138. }
  139. border
  140. {
  141. color: "#EAEAEC" // TODO: Theme!
  142. width: borderSize // TODO: Remove once themed
  143. }
  144. color: "white" // TODO: Theme!
  145. height: 84 * screenScaleFactor + borderSize // TODO: Remove once themed
  146. width: parent.width
  147. Row
  148. {
  149. anchors
  150. {
  151. fill: parent
  152. topMargin: 12 * screenScaleFactor + borderSize // TODO: Theme!
  153. bottomMargin: 12 * screenScaleFactor // TODO: Theme!
  154. leftMargin: 36 * screenScaleFactor // TODO: Theme!
  155. }
  156. height: childrenRect.height
  157. spacing: 18 * screenScaleFactor // TODO: Theme!
  158. Item
  159. {
  160. anchors
  161. {
  162. verticalCenter: parent.verticalCenter
  163. }
  164. width: printerImage.width
  165. height: childrenRect.height
  166. MonitorPrintJobPreview
  167. {
  168. anchors.centerIn: parent
  169. printJob: base.printer.activePrintJob
  170. size: 60 * screenScaleFactor // TODO: Theme!
  171. }
  172. }
  173. Item
  174. {
  175. anchors
  176. {
  177. verticalCenter: parent.verticalCenter
  178. }
  179. width: 216 * screenScaleFactor // TODO: Theme!
  180. height: printerNameLabel.height + printerFamilyPill.height + 6 * screenScaleFactor // TODO: Theme!
  181. Label
  182. {
  183. id: printerJobNameLabel
  184. text: base.printer.activePrintJob ? base.printer.activePrintJob.name : "Untitled" // TODO: I18N
  185. color: "#414054" // TODO: Theme!
  186. elide: Text.ElideRight
  187. font: UM.Theme.getFont("large") // 16pt, bold
  188. width: parent.width
  189. // FIXED-LINE-HEIGHT:
  190. height: 18 * screenScaleFactor // TODO: Theme!
  191. verticalAlignment: Text.AlignVCenter
  192. }
  193. Label
  194. {
  195. id: printerJobOwnerLabel
  196. anchors
  197. {
  198. top: printerJobNameLabel.bottom
  199. topMargin: 6 * screenScaleFactor // TODO: Theme!
  200. left: printerJobNameLabel.left
  201. }
  202. text: printer.activePrintJob ? printer.activePrintJob.owner : "Anonymous" // TODO: I18N
  203. color: "#53657d" // TODO: Theme!
  204. elide: Text.ElideRight
  205. font: UM.Theme.getFont("very_small") // 12pt, regular
  206. width: parent.width
  207. // FIXED-LINE-HEIGHT:
  208. height: 18 * screenScaleFactor // TODO: Theme!
  209. verticalAlignment: Text.AlignVCenter
  210. }
  211. }
  212. MonitorPrintJobProgressBar
  213. {
  214. anchors
  215. {
  216. verticalCenter: parent.verticalCenter
  217. }
  218. printJob: printer.activePrintJob
  219. }
  220. }
  221. }
  222. }