From b03695dec66ef5bb10a07222fb11d96e92eb1155 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 2 Nov 2018 09:33:27 +0100 Subject: [PATCH] Add print time information and material costs to the action panel. Contributes to CURA-5786. --- resources/qml/OutputProcessWidget.qml | 33 +++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/resources/qml/OutputProcessWidget.qml b/resources/qml/OutputProcessWidget.qml index d3f306fed5..435cc6da79 100644 --- a/resources/qml/OutputProcessWidget.qml +++ b/resources/qml/OutputProcessWidget.qml @@ -30,6 +30,7 @@ Column Column { id: timeAndCostsInformation + spacing: UM.Theme.getSize("thin_margin").height anchors { @@ -43,7 +44,9 @@ Column id: estimatedTime width: parent.width - text: "Time" + property var printDuration: PrintInformation.currentPrintTime + + text: printDuration.getDisplayString(UM.DurationFormat.Long) source: UM.Theme.getIcon("clock") font: UM.Theme.getFont("small") } @@ -53,7 +56,33 @@ Column id: estimatedCosts width: parent.width - text: "Material costs" + property var printMaterialLengths: PrintInformation.materialLengths + property var printMaterialWeights: PrintInformation.materialWeights + + function getText() + { + var lengths = [] + var weights = [] + if(printMaterialLengths) + { + for(var index = 0; index < printMaterialLengths.length; index++) + { + if(printMaterialLengths[index] > 0) + { + lengths.push(printMaterialLengths[index].toFixed(2)) + weights.push(String(Math.round(printMaterialWeights[index]))) + } + } + } + if(lengths.length == 0) + { + lengths = ["0.00"] + weights = ["0"] + } + return weights.join(" + ") + "g ยท " + lengths.join(" + ") + "m" + } + + text: getText() source: UM.Theme.getIcon("spool") font: UM.Theme.getFont("very_small") }