OutputProcessWidget.qml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.7
  4. import QtQuick.Controls 2.1
  5. import QtQuick.Layouts 1.3
  6. import UM 1.1 as UM
  7. import Cura 1.0 as Cura
  8. // This element contains all the elements the user needs to visualize the data
  9. // that is gather after the slicing process, such as printint time, material usage, ...
  10. // There are also two buttons: one to previsualize the output layers, and the other to
  11. // select what to do with it (such as print over network, save to file, ...)
  12. Column
  13. {
  14. id: widget
  15. spacing: UM.Theme.getSize("thin_margin").height
  16. UM.I18nCatalog
  17. {
  18. id: catalog
  19. name: "cura"
  20. }
  21. Item
  22. {
  23. id: information
  24. width: parent.width
  25. height: childrenRect.height
  26. Column
  27. {
  28. id: timeAndCostsInformation
  29. spacing: UM.Theme.getSize("thin_margin").height
  30. anchors
  31. {
  32. left: parent.left
  33. right: printInformationPanel.left
  34. rightMargin: UM.Theme.getSize("thin_margin").height
  35. }
  36. Cura.IconLabel
  37. {
  38. id: estimatedTime
  39. width: parent.width
  40. text: PrintInformation.currentPrintTime.getDisplayString(UM.DurationFormat.Long)
  41. source: UM.Theme.getIcon("clock")
  42. font: UM.Theme.getFont("small")
  43. }
  44. Cura.IconLabel
  45. {
  46. id: estimatedCosts
  47. width: parent.width
  48. property var printMaterialLengths: PrintInformation.materialLengths
  49. property var printMaterialWeights: PrintInformation.materialWeights
  50. text:
  51. {
  52. var totalLengths = 0
  53. var totalWeights = 0
  54. if (printMaterialLengths)
  55. {
  56. for(var index = 0; index < printMaterialLengths.length; index++)
  57. {
  58. if(printMaterialLengths[index] > 0)
  59. {
  60. totalLengths += printMaterialLengths[index]
  61. totalWeights += Math.round(printMaterialWeights[index])
  62. }
  63. }
  64. }
  65. return totalWeights + "g · " + totalLengths.toFixed(2) + "m"
  66. }
  67. source: UM.Theme.getIcon("spool")
  68. font: UM.Theme.getFont("very_small")
  69. }
  70. }
  71. PrintInformationWidget
  72. {
  73. id: printInformationPanel
  74. anchors
  75. {
  76. right: parent.right
  77. verticalCenter: timeAndCostsInformation.verticalCenter
  78. }
  79. }
  80. }
  81. Row
  82. {
  83. id: buttonRow
  84. spacing: UM.Theme.getSize("default_margin").width
  85. Cura.ActionButton
  86. {
  87. id: previewStageShortcut
  88. leftPadding: UM.Theme.getSize("default_margin").width
  89. rightPadding: UM.Theme.getSize("default_margin").width
  90. height: UM.Theme.getSize("action_panel_button").height
  91. text: catalog.i18nc("@button", "Preview")
  92. color: UM.Theme.getColor("secondary")
  93. hoverColor: UM.Theme.getColor("secondary")
  94. textColor: UM.Theme.getColor("primary")
  95. textHoverColor: UM.Theme.getColor("text")
  96. onClicked: UM.Controller.setActiveStage("PreviewStage")
  97. visible: UM.Controller.activeStage != null && UM.Controller.activeStage.stageId != "PreviewStage"
  98. }
  99. Cura.OutputDevicesActionButton
  100. {
  101. width: previewStageShortcut.visible ? UM.Theme.getSize("action_panel_button").width : parent.width
  102. height: UM.Theme.getSize("action_panel_button").height
  103. }
  104. }
  105. }