mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Made time total & time remaining pretty
CURA-1036
This commit is contained in:
parent
168246d594
commit
ef9ce7ad55
1 changed files with 18 additions and 2 deletions
|
|
@ -34,6 +34,21 @@ Rectangle
|
||||||
tooltip.hide();
|
tooltip.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function strPadLeft(string, pad, length) {
|
||||||
|
return (new Array(length + 1).join(pad) + string).slice(-length);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPrettyTime(time)
|
||||||
|
{
|
||||||
|
var hours = Math.floor(time / 3600)
|
||||||
|
time -= hours * 3600
|
||||||
|
var minutes = Math.floor(time / 60);
|
||||||
|
time -= minutes * 60
|
||||||
|
var seconds = Math.floor(time);
|
||||||
|
|
||||||
|
var finalTime = strPadLeft(hours, "0", 2) + ':' + strPadLeft(minutes,'0',2)+ ':' + strPadLeft(seconds,'0',2);
|
||||||
|
return finalTime;
|
||||||
|
}
|
||||||
MouseArea
|
MouseArea
|
||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
@ -289,9 +304,10 @@ Rectangle
|
||||||
{
|
{
|
||||||
text: "Printing Time:"
|
text: "Printing Time:"
|
||||||
}
|
}
|
||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: " " + Cura.MachineManager.printerOutputDevices[0].timeTotal
|
text: " " + getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal)
|
||||||
}
|
}
|
||||||
|
|
||||||
Label
|
Label
|
||||||
|
|
@ -300,7 +316,7 @@ Rectangle
|
||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: " " + (Cura.MachineManager.printerOutputDevices[0].timeTotal - Cura.MachineManager.printerOutputDevices[0].timeElapsed)
|
text: " " + getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal - Cura.MachineManager.printerOutputDevices[0].timeElapsed)
|
||||||
}
|
}
|
||||||
|
|
||||||
Label
|
Label
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue