Remove superfluous item

This item was just transparently being the same size as its parent, no ID or nothing. We can just remove it.

Contributes to issue CURA-4149.
This commit is contained in:
Ghostkeeper 2017-08-14 09:12:21 +02:00
parent 0430a274d9
commit fb3a0b701c
No known key found for this signature in database
GPG Key ID: C5F96EE2BC0F7E75

View File

@ -410,128 +410,122 @@ Rectangle
anchors.bottomMargin: UM.Theme.getSize("default_margin").height anchors.bottomMargin: UM.Theme.getSize("default_margin").height
height: UM.Theme.getSize("jobspecs_line").height height: UM.Theme.getSize("jobspecs_line").height
Item UM.TooltipArea
{ {
width: parent.width id: timeSpecPerFeatureTooltipArea
height: parent.height text: {
var order = ["inset_0", "inset_x", "skin", "infill", "support_infill", "support_interface", "support", "travel", "retract", "none"];
UM.TooltipArea var visible_names = {
{ "inset_0": catalog.i18nc("@tooltip", "Outer Wall"),
id: timeSpecPerFeatureTooltipArea "inset_x": catalog.i18nc("@tooltip", "Inner Walls"),
text: { "skin": catalog.i18nc("@tooltip", "Skin"),
var order = ["inset_0", "inset_x", "skin", "infill", "support_infill", "support_interface", "support", "travel", "retract", "none"]; "infill": catalog.i18nc("@tooltip", "Infill"),
var visible_names = { "support_infill": catalog.i18nc("@tooltip", "Support Infill"),
"inset_0": catalog.i18nc("@tooltip", "Outer Wall"), "support_interface": catalog.i18nc("@tooltip", "Support Interface"),
"inset_x": catalog.i18nc("@tooltip", "Inner Walls"), "support": catalog.i18nc("@tooltip", "Support"),
"skin": catalog.i18nc("@tooltip", "Skin"), "travel": catalog.i18nc("@tooltip", "Travel"),
"infill": catalog.i18nc("@tooltip", "Infill"), "retract": catalog.i18nc("@tooltip", "Retractions"),
"support_infill": catalog.i18nc("@tooltip", "Support Infill"), "none": catalog.i18nc("@tooltip", "Other")
"support_interface": catalog.i18nc("@tooltip", "Support Interface"), };
"support": catalog.i18nc("@tooltip", "Support"), var result = "";
"travel": catalog.i18nc("@tooltip", "Travel"), for(var feature in order)
"retract": catalog.i18nc("@tooltip", "Retractions"), {
"none": catalog.i18nc("@tooltip", "Other") feature = order[feature];
}; if(base.printDurationPerFeature[feature] && base.printDurationPerFeature[feature].totalSeconds > 0)
var result = "";
for(var feature in order)
{ {
feature = order[feature]; result += "<br/>" + visible_names[feature] + ": " + base.printDurationPerFeature[feature].getDisplayString(UM.DurationFormat.Short);
if(base.printDurationPerFeature[feature] && base.printDurationPerFeature[feature].totalSeconds > 0)
{
result += "<br/>" + visible_names[feature] + ": " + base.printDurationPerFeature[feature].getDisplayString(UM.DurationFormat.Short);
}
} }
result = result.replace(/^\<br\/\>/, ""); // remove newline before first item
return result;
}
width: childrenRect.width
height: childrenRect.height
anchors.right: lengthIcon.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors.verticalCenter: parent.verticalCenter
UM.RecolorImage
{
id: timeIcon
anchors.left: parent.left
anchors.top: parent.top
anchors.verticalCenter: parent.verticalCenter
width: UM.Theme.getSize("save_button_specs_icons").width
height: UM.Theme.getSize("save_button_specs_icons").height
sourceSize.width: width
sourceSize.height: width
color: UM.Theme.getColor("text_subtext")
source: UM.Theme.getIcon("print_time")
}
Text
{
id: timeSpec
anchors.left: timeIcon.right
anchors.leftMargin: UM.Theme.getSize("default_margin").width / 2
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)
} }
result = result.replace(/^\<br\/\>/, ""); // remove newline before first item
return result;
} }
width: childrenRect.width
height: childrenRect.height
anchors.right: lengthIcon.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors.verticalCenter: parent.verticalCenter
UM.RecolorImage UM.RecolorImage
{ {
id: lengthIcon id: timeIcon
anchors.right: lengthSpec.left anchors.left: parent.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width/2 anchors.top: parent.top
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: UM.Theme.getSize("save_button_specs_icons").width width: UM.Theme.getSize("save_button_specs_icons").width
height: UM.Theme.getSize("save_button_specs_icons").height height: UM.Theme.getSize("save_button_specs_icons").height
sourceSize.width: width sourceSize.width: width
sourceSize.height: width sourceSize.height: width
color: UM.Theme.getColor("text_subtext") color: UM.Theme.getColor("text_subtext")
source: UM.Theme.getIcon("category_material") source: UM.Theme.getIcon("print_time")
} }
Text Text
{ {
id: lengthSpec id: timeSpec
anchors.right: parent.right anchors.left: timeIcon.right
anchors.verticalCenter: parent.verticalCenter anchors.leftMargin: UM.Theme.getSize("default_margin").width / 2
anchors.top: parent.top
font: UM.Theme.getFont("small") font: UM.Theme.getFont("small")
color: UM.Theme.getColor("text_subtext") color: UM.Theme.getColor("text_subtext")
text: text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short)
{ }
var lengths = []; }
var weights = []; UM.RecolorImage
var costs = []; {
var someCostsKnown = false; id: lengthIcon
if(base.printMaterialLengths) { anchors.right: lengthSpec.left
for(var index = 0; index < base.printMaterialLengths.length; index++) anchors.rightMargin: UM.Theme.getSize("default_margin").width/2
anchors.verticalCenter: parent.verticalCenter
width: UM.Theme.getSize("save_button_specs_icons").width
height: UM.Theme.getSize("save_button_specs_icons").height
sourceSize.width: width
sourceSize.height: width
color: UM.Theme.getColor("text_subtext")
source: UM.Theme.getIcon("category_material")
}
Text
{
id: lengthSpec
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
font: UM.Theme.getFont("small")
color: UM.Theme.getColor("text_subtext")
text:
{
var lengths = [];
var weights = [];
var costs = [];
var someCostsKnown = false;
if(base.printMaterialLengths) {
for(var index = 0; index < base.printMaterialLengths.length; index++)
{
if(base.printMaterialLengths[index] > 0)
{ {
if(base.printMaterialLengths[index] > 0) lengths.push(base.printMaterialLengths[index].toFixed(2));
weights.push(String(Math.floor(base.printMaterialWeights[index])));
var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2);
costs.push(cost);
if(cost > 0)
{ {
lengths.push(base.printMaterialLengths[index].toFixed(2)); someCostsKnown = true;
weights.push(String(Math.floor(base.printMaterialWeights[index])));
var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2);
costs.push(cost);
if(cost > 0)
{
someCostsKnown = true;
}
} }
} }
} }
if(lengths.length == 0) }
{ if(lengths.length == 0)
lengths = ["0.00"]; {
weights = ["0"]; lengths = ["0.00"];
costs = ["0.00"]; weights = ["0"];
} costs = ["0.00"];
if(someCostsKnown) }
{ if(someCostsKnown)
return catalog.i18nc("@label", "%1 m / ~ %2 g / ~ %4 %3").arg(lengths.join(" + ")) {
.arg(weights.join(" + ")).arg(costs.join(" + ")).arg(UM.Preferences.getValue("cura/currency")); return catalog.i18nc("@label", "%1 m / ~ %2 g / ~ %4 %3").arg(lengths.join(" + "))
} .arg(weights.join(" + ")).arg(costs.join(" + ")).arg(UM.Preferences.getValue("cura/currency"));
else }
{ else
return catalog.i18nc("@label", "%1 m / ~ %2 g").arg(lengths.join(" + ")).arg(weights.join(" + ")); {
} return catalog.i18nc("@label", "%1 m / ~ %2 g").arg(lengths.join(" + ")).arg(weights.join(" + "));
} }
} }
} }