PrintJobInfoBlock.qml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. import QtQuick 2.2
  2. import QtQuick.Controls 1.4
  3. import QtQuick.Controls.Styles 1.4
  4. import UM 1.3 as UM
  5. Item
  6. {
  7. property var printJob: null
  8. function getPrettyTime(time)
  9. {
  10. return OutputDevice.formatDuration(time)
  11. }
  12. Rectangle
  13. {
  14. id: background
  15. anchors.fill: parent
  16. Item
  17. {
  18. // Content on the left of the infobox
  19. anchors
  20. {
  21. top: parent.top
  22. bottom: parent.bottom
  23. left: parent.left
  24. right: parent.horizontalCenter
  25. margins: UM.Theme.getSize("default_margin").width
  26. }
  27. Label
  28. {
  29. id: printJobName
  30. text: "printJobName"
  31. }
  32. Label
  33. {
  34. id: ownerName
  35. anchors.top: printJobName.bottom
  36. text: "OwnerName"
  37. }
  38. Image
  39. {
  40. source: printJob.preview_image_url
  41. anchors.top: ownerName.bottom
  42. anchors.horizontalCenter: parent.horizontalCenter
  43. anchors.bottom: totalTimeLabel.top
  44. width: height
  45. }
  46. Label
  47. {
  48. id: totalTimeLabel
  49. anchors.bottom: parent.bottom
  50. anchors.right: parent.right
  51. text: printJob != null ? getPrettyTime(printJob.timeTotal) : "3h 12m"
  52. elide: Text.ElideRight
  53. }
  54. }
  55. Item
  56. {
  57. // Content on the right side of the infobox.
  58. anchors
  59. {
  60. top: parent.top
  61. bottom: parent.bottom
  62. left: parent.horizontalCenter
  63. right: parent.right
  64. margins: UM.Theme.getSize("default_margin").width
  65. }
  66. Label
  67. {
  68. id: targetPrinterLabel
  69. text: "Waiting for: first available"
  70. }
  71. Button
  72. {
  73. text: "..."
  74. anchors
  75. {
  76. right: parent.right
  77. top: parent.top
  78. }
  79. }
  80. // PrintCore && Material config
  81. Row
  82. {
  83. id: extruderInfo
  84. anchors.bottom: parent.bottom
  85. anchors
  86. {
  87. left: parent.left
  88. right: parent.right
  89. }
  90. height: childrenRect.height
  91. spacing: UM.Theme.getSize("default_margin").width
  92. PrintCoreConfiguration
  93. {
  94. id: leftExtruderInfo
  95. width: Math.round((parent.width - extruderSeperator.width) / 2)
  96. printCoreConfiguration: printJob.configuration.extruderConfigurations[0]
  97. }
  98. Rectangle
  99. {
  100. id: extruderSeperator
  101. width: UM.Theme.getSize("default_lining").width
  102. height: parent.height
  103. color: lineColor
  104. }
  105. PrintCoreConfiguration
  106. {
  107. id: rightExtruderInfo
  108. width: Math.round((parent.width - extruderSeperator.width) / 2)
  109. printCoreConfiguration: printJob.configuration.extruderConfigurations[1]
  110. }
  111. }
  112. }
  113. Rectangle
  114. {
  115. color: "grey"
  116. width: 1
  117. anchors.top: parent.top
  118. anchors.bottom: parent.bottom
  119. anchors.margins: UM.Theme.getSize("default_margin").height
  120. anchors.horizontalCenter: parent.horizontalCenter
  121. }
  122. }
  123. }