OutputProcessWidget.qml 4.4 KB

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