Monitor Tab - Grey progress bar for pause/abort

Contributes to CL-1047
This commit is contained in:
Ian Paschal 2018-09-07 16:46:11 +02:00
parent 97e8db577a
commit 79aeca9663

View file

@ -638,19 +638,24 @@ Component
style: ProgressBarStyle style: ProgressBarStyle
{ {
property var remainingTime:
{
if(modelData.activePrintJob == null)
{
return 0
}
/* Sometimes total minus elapsed is less than 0. Use Math.max() to prevent remaining
time from ever being less than 0. Negative durations cause strange behavior such
as displaying "-1h -1m". */
var activeJob = modelData.activePrintJob
return Math.max(activeJob.timeTotal - activeJob.timeElapsed, 0);
}
property var progressText: property var progressText:
{ {
if(modelData.activePrintJob == null) if(modelData.activePrintJob == null)
{ {
return "" return ""
} }
/* Sometimes total minus elapsed is less than 0. Use Math.max() to prevent remaining
time from ever being less than 0. Negative durations cause strange behavior such
as displaying "-1h -1m". */
var activeJob = modelData.activePrintJob
var remainingTime = Math.max(activeJob.timeTotal - activeJob.timeElapsed, 0);
switch(modelData.activePrintJob.state) switch(modelData.activePrintJob.state)
{ {
case "wait_cleanup": case "wait_cleanup":
@ -663,6 +668,7 @@ Component
case "sent_to_printer": case "sent_to_printer":
return catalog.i18nc("@label:status", "Preparing") return catalog.i18nc("@label:status", "Preparing")
case "aborted": case "aborted":
return catalog.i18nc("@label:status", "Aborted")
case "wait_user_action": case "wait_user_action":
return catalog.i18nc("@label:status", "Aborted") return catalog.i18nc("@label:status", "Aborted")
case "pausing": case "pausing":
@ -687,7 +693,24 @@ Component
progress: Rectangle progress: Rectangle
{ {
color: UM.Theme.getColor("primary") color:
{
var state = modelData.activePrintJob.state
var deactiveStates = [
"pausing",
"paused",
"resuming",
"wait_cleanup"
]
if(deactiveStates.indexOf(state) > -1 && remainingTime > 0)
{
return UM.Theme.getColor("monitor_secondary_text")
}
else
{
return UM.Theme.getColor("primary")
}
}
id: progressItem id: progressItem
function getTextOffset() function getTextOffset()
{ {