diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml
index 31bda45b56..bed5b4c873 100644
--- a/resources/qml/Sidebar.qml
+++ b/resources/qml/Sidebar.qml
@@ -350,21 +350,20 @@ Rectangle
var total_seconds = parseInt(base.printDuration.getDisplayString(UM.DurationFormat.Seconds))
// A message is created and displayed when the user hover the time label
- var content = catalog.i18nc("@tooltip", "Time specification
");
+ var tooltip_html = "%1
".arg(catalog.i18nc("@tooltip", "Time specification"));
for(var feature in print_time)
{
if(!print_time[feature].isTotalDurationZero)
{
- content += "" + feature + " |
" +
- "" +
- "" + print_time[feature].getDisplayString(UM.DurationFormat.Short) + " | " +
- " " + Math.round(100 * parseInt(print_time[feature].getDisplayString(UM.DurationFormat.Seconds)) / total_seconds) + "%" +
+ tooltip_html += " |
" + feature + ": | " +
+ " %1 | ".arg(print_time[feature].getDisplayString(UM.DurationFormat.ISO8601).slice(0,-3)) +
+ " %1% | ".arg(Math.round(100 * parseInt(print_time[feature].getDisplayString(UM.DurationFormat.Seconds)) / total_seconds)) +
"
";
}
}
- content += "
";
+ tooltip_html += "
";
- base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), content);
+ base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), tooltip_html);
}
}
onExited:
@@ -376,9 +375,26 @@ Rectangle
Label
{
+ function formatRow(items)
+ {
+ var row_html = "";
+ for(var item = 0; item < items.length; item++)
+ {
+ if (item == 0)
+ {
+ row_html += "%1 | ".arg(items[item]);
+ }
+ else
+ {
+ row_html += " %1 | ".arg(items[item]);
+ }
+ }
+ row_html += "
";
+ return row_html;
+ }
- function getSpecsData(){
-
+ function getSpecsData()
+ {
var lengths = [];
var total_length = 0;
var weights = [];
@@ -387,7 +403,8 @@ Rectangle
var total_cost = 0;
var some_costs_known = false;
var names = [];
- if(base.printMaterialLengths) {
+ if(base.printMaterialLengths)
+ {
for(var index = 0; index < base.printMaterialLengths.length; index++)
{
if(base.printMaterialLengths[index] > 0)
@@ -415,34 +432,28 @@ Rectangle
costs = ["0.00"];
}
- var tooltip_html = "%1
".arg(catalog.i18nc("@label", "Cost specification"));
+ var tooltip_html = "%1
".arg(catalog.i18nc("@label", "Cost specification"));
for(var index = 0; index < lengths.length; index++)
{
- var item_strings = [
+ tooltip_html += formatRow([
"%1:".arg(names[index]),
catalog.i18nc("@label m for meter", "%1m").arg(lengths[index]),
catalog.i18nc("@label g for grams", "%1g").arg(weights[index]),
- "%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(costs[index]),
- ];
- tooltip_html += "";
- for(var item = 0; item < item_strings.length; item++) {
- tooltip_html += "%1 | ".arg(item_strings[item]);
- }
+ "%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(costs[index]),
+ ]);
}
- var item_strings = [
- catalog.i18nc("@label", "Total:"),
- catalog.i18nc("@label m for meter", "%1m").arg(total_length.toFixed(2)),
- catalog.i18nc("@label g for grams", "%1g").arg(Math.round(total_weight)),
- "%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(total_cost.toFixed(2)),
- ];
- tooltip_html += "
";
- for(var item = 0; item < item_strings.length; item++) {
- tooltip_html += "%1 | ".arg(item_strings[item]);
+ if(lengths.length > 1)
+ {
+ tooltip_html += formatRow([
+ catalog.i18nc("@label", "Total:"),
+ catalog.i18nc("@label m for meter", "%1m").arg(total_length.toFixed(2)),
+ catalog.i18nc("@label g for grams", "%1g").arg(Math.round(total_weight)),
+ "%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(total_cost.toFixed(2)),
+ ]);
}
- tooltip_html += "
";
+ tooltip_html += "
";
tooltipText = tooltip_html;
-
return tooltipText
}