Updated display states and fixed some more margins

CL-896
This commit is contained in:
Jaime van Kessel 2018-08-23 19:46:14 +02:00
parent e9d4c36b32
commit 6bfa2fed96

View file

@ -53,6 +53,7 @@ Component
right: parent.right right: parent.right
topMargin: UM.Theme.getSize("default_margin").height topMargin: UM.Theme.getSize("default_margin").height
bottom: parent.bottom bottom: parent.bottom
bottomMargin: UM.Theme.getSize("default_margin").height
} }
style: UM.Theme.styles.scrollview style: UM.Theme.styles.scrollview
@ -69,7 +70,6 @@ Component
rightMargin: 2 * UM.Theme.getSize("default_margin").width rightMargin: 2 * UM.Theme.getSize("default_margin").width
} }
spacing: UM.Theme.getSize("default_margin").height spacing: UM.Theme.getSize("default_margin").height
displayMarginBeginning: 2
model: OutputDevice.printers model: OutputDevice.printers
delegate: Rectangle delegate: Rectangle
@ -167,7 +167,7 @@ Component
height: !base.collapsed ? childrenRect.height : 0 height: !base.collapsed ? childrenRect.height : 0
opacity: visible ? 1 : 0 opacity: visible ? 1 : 0
Behavior on height { NumberAnimation { duration: 100 } } Behavior on height { NumberAnimation { duration: 100 } }
Behavior on opacity { NumberAnimation { duration: 50 } } Behavior on opacity { NumberAnimation { duration: 100 } }
Rectangle Rectangle
{ {
id: topSpacer id: topSpacer
@ -179,7 +179,7 @@ Component
right: parent.right right: parent.right
margins: UM.Theme.getSize("default_margin").width margins: UM.Theme.getSize("default_margin").width
top: parent.top top: parent.top
topMargin: 2 * UM.Theme.getSize("default_margin").width topMargin: UM.Theme.getSize("default_margin").width
} }
} }
@ -236,7 +236,7 @@ Component
anchors.right: parent.right anchors.right: parent.right
anchors.margins: UM.Theme.getSize("default_margin").width anchors.margins: UM.Theme.getSize("default_margin").width
anchors.leftMargin: 2 * UM.Theme.getSize("default_margin").width anchors.leftMargin: 2 * UM.Theme.getSize("default_margin").width
height: showJobInfo ? childrenRect.height + 3 * UM.Theme.getSize("default_margin").height: 0 height: showJobInfo ? childrenRect.height + 2 * UM.Theme.getSize("default_margin").height: 0
visible: showJobInfo visible: showJobInfo
Label Label
{ {
@ -286,6 +286,10 @@ Component
{ {
property var progress: property var progress:
{ {
if(modelData.activePrintJob == null)
{
return 0
}
var result = modelData.activePrintJob.timeElapsed / modelData.activePrintJob.timeTotal var result = modelData.activePrintJob.timeElapsed / modelData.activePrintJob.timeTotal
if(result > 1.0) if(result > 1.0)
{ {
@ -311,17 +315,23 @@ Component
return "" return ""
} }
if(modelData.activePrintJob.state == "wait_cleanup") switch(modelData.activePrintJob.state)
{ {
return "Finshed" case "wait_cleanup":
} return catalog.i18nc("@label:status", "Finshed")
else if(modelData.activePrintJob.state == "pre_print") case "pre_print":
{ case "sent_to_printer":
return "Preparing" return catalog.i18nc("@label:status", "Preparing")
} case "aborted":
else case "wait_user_action":
{ return catalog.i18nc("@label:status", "Aborted")
return OutputDevice.formatDuration(modelData.activePrintJob.timeTotal - modelData.activePrintJob.timeElapsed) case "pausing":
case "paused":
return catalog.i18nc("@label:status", "Paused")
case "resuming":
return catalog.i18nc("@label:status", "Resuming")
default:
OutputDevice.formatDuration(modelData.activePrintJob.timeTotal - modelData.activePrintJob.timeElapsed)
} }
} }