Show time estimates per feature in tooltip

This commit is contained in:
14bitVoid 2017-05-05 01:34:09 +02:00
parent f15aa66751
commit 69a95e37a5
2 changed files with 59 additions and 6 deletions

View file

@ -24,6 +24,7 @@ Item {
UM.I18nCatalog { id: catalog; name:"cura"}
property variant printDuration: PrintInformation.currentPrintTime
property variant printDurationPerFeature: PrintInformation.printTimesPerFeature
property variant printMaterialLengths: PrintInformation.materialLengths
property variant printMaterialWeights: PrintInformation.materialWeights
property variant printMaterialCosts: PrintInformation.materialCosts
@ -159,7 +160,7 @@ Item {
UM.RecolorImage
{
id: timeIcon
anchors.right: timeSpec.left
anchors.right: timeSpecPerFeatureTooltipArea.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width/2
anchors.verticalCenter: parent.verticalCenter
width: UM.Theme.getSize("save_button_specs_icons").width
@ -169,15 +170,48 @@ Item {
color: UM.Theme.getColor("text_subtext")
source: UM.Theme.getIcon("print_time")
}
Text
UM.TooltipArea
{
id: timeSpec
id: timeSpecPerFeatureTooltipArea
text: {
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 += "<br/>Inner Walls: " + base.printDurationPerFeature["inset_x"].getDisplayString(UM.DurationFormat.Short)
if(base.printDurationPerFeature["skin"] && base.printDurationPerFeature["skin"].totalSeconds > 0)
result += "<br/>Skin: " + base.printDurationPerFeature["skin"].getDisplayString(UM.DurationFormat.Short)
if(base.printDurationPerFeature["infill"] && base.printDurationPerFeature["infill"].totalSeconds > 0)
result += "<br/>Infill: " + base.printDurationPerFeature["infill"].getDisplayString(UM.DurationFormat.Short)
if(base.printDurationPerFeature["support_infill"] && base.printDurationPerFeature["support_infill"].totalSeconds > 0)
result += "<br/>Support: " + base.printDurationPerFeature["support_infill"].getDisplayString(UM.DurationFormat.Short)
if(base.printDurationPerFeature["support_interface"] && base.printDurationPerFeature["support_interface"].totalSeconds > 0)
result += "<br/>Support Interface: " + base.printDurationPerFeature["support_interface"].getDisplayString(UM.DurationFormat.Short)
if(base.printDurationPerFeature["support"] && base.printDurationPerFeature["support"].totalSeconds > 0)
result += "<br/>Helper Structures: " + base.printDurationPerFeature["support"].getDisplayString(UM.DurationFormat.Short)
if(base.printDurationPerFeature["travel"] && base.printDurationPerFeature["travel"].totalSeconds > 0)
result += "<br/>Travel: " + base.printDurationPerFeature["travel"].getDisplayString(UM.DurationFormat.Short)
if(base.printDurationPerFeature["retract"] && base.printDurationPerFeature["retract"].totalSeconds > 0)
result += "<br/>Retractions: " + base.printDurationPerFeature["retract"].getDisplayString(UM.DurationFormat.Short)
if(base.printDurationPerFeature["none"] && base.printDurationPerFeature["none"].totalSeconds > 0)
result += "<br/>Other: " + base.printDurationPerFeature["none"].getDisplayString(UM.DurationFormat.Short)
return result;
}
width: childrenRect.width
height: childrenRect.height
anchors.right: lengthIcon.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors.verticalCenter: parent.verticalCenter
font: UM.Theme.getFont("small")
color: UM.Theme.getColor("text_subtext")
text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short)
Text
{
id: timeSpec
anchors.left: parent.left
anchors.top: parent.top
font: UM.Theme.getFont("small")
color: UM.Theme.getColor("text_subtext")
text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short)
}
}
UM.RecolorImage
{