Improve printer status and progress bar

Contributes to CL-1153
This commit is contained in:
Ian Paschal 2018-12-03 14:41:22 +01:00
parent a28cae0a43
commit c9ed044205
3 changed files with 99 additions and 86 deletions

View file

@ -21,7 +21,18 @@ Item
{
id: previewImage
anchors.fill: parent
opacity: printJob && printJob.state == "error" ? 0.5 : 1.0
opacity:
{
if (!printJob)
{
return 0
}
if (printJob.state == "error" || !printJob.isActive)
{
return 0.5
}
return 1.0
}
source: printJob ? printJob.previewImageUrl : ""
visible: printJob
}
@ -47,11 +58,32 @@ Item
UM.RecolorImage
{
id: statusImage
id: overlayIcon
anchors.centerIn: printJobPreview
color: UM.Theme.getColor("monitor_image_overlay")
height: 0.5 * printJobPreview.height
source: printJob && printJob.state == "error" ? "../svg/aborted-icon.svg" : ""
source:
{
switch(printJob.state)
{
case "error":
return "../svg/aborted-icon.svg"
case "wait_cleanup":
if (printJob.state == "wait_cleanup" && printJob.timeTotal > printJob.timeElapsed)
{
return "../svg/aborted-icon.svg"
}
break;
case "pausing":
return "../svg/paused-icon.svg"
case "paused":
return "../svg/paused-icon.svg"
case "resuming":
return "../svg/paused-icon.svg"
default:
return ""
}
}
sourceSize
{
height: height