OutputProcessWidget.qml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. property bool preSlicedData: PrintInformation.preSliced
  17. UM.I18nCatalog
  18. {
  19. id: catalog
  20. name: "cura"
  21. }
  22. Item
  23. {
  24. id: information
  25. width: parent.width
  26. height: childrenRect.height
  27. PrintInformationWidget
  28. {
  29. id: printInformationPanel
  30. visible: !preSlicedData
  31. anchors.right: parent.right
  32. }
  33. Column
  34. {
  35. id: timeAndCostsInformation
  36. spacing: UM.Theme.getSize("thin_margin").height
  37. anchors
  38. {
  39. left: parent.left
  40. right: parent.right
  41. }
  42. Cura.IconWithText
  43. {
  44. id: estimatedTime
  45. width: parent.width
  46. text: preSlicedData ? catalog.i18nc("@label", "No time estimation available") : PrintInformation.currentPrintTime.getDisplayString(UM.DurationFormat.Long)
  47. source: UM.Theme.getIcon("clock")
  48. font: UM.Theme.getFont("medium_bold")
  49. }
  50. Cura.IconWithText
  51. {
  52. id: estimatedCosts
  53. width: parent.width
  54. property var printMaterialLengths: PrintInformation.materialLengths
  55. property var printMaterialWeights: PrintInformation.materialWeights
  56. text:
  57. {
  58. if (preSlicedData)
  59. {
  60. return catalog.i18nc("@label", "No cost estimation available")
  61. }
  62. var totalLengths = 0
  63. var totalWeights = 0
  64. if (printMaterialLengths)
  65. {
  66. for(var index = 0; index < printMaterialLengths.length; index++)
  67. {
  68. if(printMaterialLengths[index] > 0)
  69. {
  70. totalLengths += printMaterialLengths[index]
  71. totalWeights += Math.round(printMaterialWeights[index])
  72. }
  73. }
  74. }
  75. return totalWeights + "g · " + totalLengths.toFixed(2) + "m"
  76. }
  77. source: UM.Theme.getIcon("spool")
  78. }
  79. }
  80. }
  81. Item
  82. {
  83. id: buttonRow
  84. anchors.right: parent.right
  85. anchors.left: parent.left
  86. height: UM.Theme.getSize("action_button").height
  87. Cura.SecondaryButton
  88. {
  89. id: previewStageShortcut
  90. anchors
  91. {
  92. left: parent.left
  93. right: outputDevicesButton.left
  94. rightMargin: UM.Theme.getSize("default_margin").width
  95. }
  96. height: UM.Theme.getSize("action_button").height
  97. text: catalog.i18nc("@button", "Preview")
  98. tooltip: text
  99. fixedWidthMode: true
  100. toolTipContentAlignment: Cura.ToolTip.ContentAlignment.AlignLeft
  101. onClicked: UM.Controller.setActiveStage("PreviewStage")
  102. visible: UM.Controller.activeStage != null && UM.Controller.activeStage.stageId != "PreviewStage"
  103. }
  104. Cura.OutputDevicesActionButton
  105. {
  106. id: outputDevicesButton
  107. anchors.right: parent.right
  108. width: previewStageShortcut.visible ? UM.Theme.getSize("action_button").width : parent.width
  109. height: UM.Theme.getSize("action_button").height
  110. }
  111. }
  112. }