From 05f46c47f72d0a520e74ee779791989a25e25227 Mon Sep 17 00:00:00 2001
From: 14bitVoid <14bitvoid@protonmail.com>
Date: Fri, 5 May 2017 02:31:16 +0200
Subject: [PATCH] Dynamically fill tooltip with time estimates
---
resources/qml/JobSpecs.qml | 42 ++++++++++++++++++++------------------
1 file changed, 22 insertions(+), 20 deletions(-)
diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml
index c702cb1ac2..849d9f43da 100644
--- a/resources/qml/JobSpecs.qml
+++ b/resources/qml/JobSpecs.qml
@@ -174,27 +174,29 @@ Item {
{
id: timeSpecPerFeatureTooltipArea
text: {
+ var order = ["inset_0", "inset_x", "skin", "infill", "support_infill", "support_interface", "support", "travel", "retract", "none"];
+ var visible_names = {
+ "inset_0": "Outer Wall",
+ "inset_x": "Inner Walls",
+ "skin": "Skin",
+ "infill": "Infill",
+ "support_infill": "Support",
+ "support_interface": "Support Interface",
+ "support": "Helper Structures",
+ "travel": "Travel",
+ "retract": "Retractions",
+ "none": "Other"
+ };
var result = "";
- if(base.printDurationPerFeature["inset_0"] && base.printDurationPerFeature["inset_0"].totalSeconds > 0)
- result += "Outer Walls: " + base.printDurationPerFeature["inset_0"].getDisplayString(UM.DurationFormat.Short)
- if(base.printDurationPerFeature["inset_x"] && base.printDurationPerFeature["inset_x"].totalSeconds > 0)
- result += "
Inner Walls: " + base.printDurationPerFeature["inset_x"].getDisplayString(UM.DurationFormat.Short)
- if(base.printDurationPerFeature["skin"] && base.printDurationPerFeature["skin"].totalSeconds > 0)
- result += "
Skin: " + base.printDurationPerFeature["skin"].getDisplayString(UM.DurationFormat.Short)
- if(base.printDurationPerFeature["infill"] && base.printDurationPerFeature["infill"].totalSeconds > 0)
- result += "
Infill: " + base.printDurationPerFeature["infill"].getDisplayString(UM.DurationFormat.Short)
- if(base.printDurationPerFeature["support_infill"] && base.printDurationPerFeature["support_infill"].totalSeconds > 0)
- result += "
Support: " + base.printDurationPerFeature["support_infill"].getDisplayString(UM.DurationFormat.Short)
- if(base.printDurationPerFeature["support_interface"] && base.printDurationPerFeature["support_interface"].totalSeconds > 0)
- result += "
Support Interface: " + base.printDurationPerFeature["support_interface"].getDisplayString(UM.DurationFormat.Short)
- if(base.printDurationPerFeature["support"] && base.printDurationPerFeature["support"].totalSeconds > 0)
- result += "
Helper Structures: " + base.printDurationPerFeature["support"].getDisplayString(UM.DurationFormat.Short)
- if(base.printDurationPerFeature["travel"] && base.printDurationPerFeature["travel"].totalSeconds > 0)
- result += "
Travel: " + base.printDurationPerFeature["travel"].getDisplayString(UM.DurationFormat.Short)
- if(base.printDurationPerFeature["retract"] && base.printDurationPerFeature["retract"].totalSeconds > 0)
- result += "
Retractions: " + base.printDurationPerFeature["retract"].getDisplayString(UM.DurationFormat.Short)
- if(base.printDurationPerFeature["none"] && base.printDurationPerFeature["none"].totalSeconds > 0)
- result += "
Other: " + base.printDurationPerFeature["none"].getDisplayString(UM.DurationFormat.Short)
+ for(var feature in order)
+ {
+ feature = order[feature];
+ if(base.printDurationPerFeature[feature] && base.printDurationPerFeature[feature].totalSeconds > 0)
+ {
+ result += "
" + visible_names[feature] + ": " + base.printDurationPerFeature[feature].getDisplayString(UM.DurationFormat.Short);
+ }
+ }
+ result = result.replace(/^\
/, ""); // remove newline before first item
return result;
}
width: childrenRect.width