From 9c492342cb170385cc8c909d005b509e6970b04a Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Thu, 7 Jul 2016 22:17:35 +0200 Subject: [PATCH 1/2] Show each material length individually CURA-1687 --- resources/qml/JobSpecs.qml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index 0dec471a1c..b2ba575761 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -24,7 +24,7 @@ Rectangle { UM.I18nCatalog { id: catalog; name:"cura"} property variant printDuration: PrintInformation.currentPrintTime - property real printMaterialAmount: PrintInformation.materialAmounts[0] + property variant printMaterialAmounts: PrintInformation.materialAmounts height: childrenRect.height color: "transparent" @@ -192,7 +192,20 @@ Rectangle { anchors.verticalCenter: parent.verticalCenter font: UM.Theme.getFont("small") color: UM.Theme.getColor("text_subtext") - text: catalog.i18nc("@label", "%1 m").arg(base.printMaterialAmount > 0 ? base.printMaterialAmount : 0) + text: + { + var material_lengths; + if(base.printMaterialAmounts) { + material_lengths = "" + for(var index = 0; index < base.printMaterialAmounts.length; index++) { + material_lengths += base.printMaterialAmounts[index].toFixed(2).toString() + " + " + } + material_lengths = material_lengths.substr(0, material_lengths.length - 3) + } else { + material_lengths = "0.00" + } + return catalog.i18nc("@label", "%1 m").arg(material_lengths) + } } } } From 08f2143790b6e2e44a4a4c3b072787c08c9822d1 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Thu, 7 Jul 2016 23:58:14 +0200 Subject: [PATCH 2/2] Simplify showing each material length individually CURA-1687 --- resources/qml/JobSpecs.qml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index b2ba575761..db58b5ee4e 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -194,17 +194,15 @@ Rectangle { color: UM.Theme.getColor("text_subtext") text: { - var material_lengths; + var amounts = []; if(base.printMaterialAmounts) { - material_lengths = "" for(var index = 0; index < base.printMaterialAmounts.length; index++) { - material_lengths += base.printMaterialAmounts[index].toFixed(2).toString() + " + " + amounts.push(base.printMaterialAmounts[index].toFixed(2)); } - material_lengths = material_lengths.substr(0, material_lengths.length - 3) } else { - material_lengths = "0.00" + amounts = ["0.00"]; } - return catalog.i18nc("@label", "%1 m").arg(material_lengths) + return catalog.i18nc("@label", "%1 m").arg(amounts.join(" + ")); } } }