Add spinners and status icons per printer

These make use of the per-printer sync status to show either nothing, a spinner, a cross or a checkmark.

Contributes to issue CURA-8609.
This commit is contained in:
Ghostkeeper 2021-10-12 17:09:54 +02:00
parent 2b6a82ecf1
commit bfb39cf989
No known key found for this signature in database
GPG Key ID: 68F39EA88EEED5FF

View File

@ -258,11 +258,22 @@ Window
model: cloudPrinterList model: cloudPrinterList
delegate: Rectangle delegate: Rectangle
{ {
id: delegateContainer
border.color: UM.Theme.getColor("lining") border.color: UM.Theme.getColor("lining")
border.width: UM.Theme.getSize("default_lining").width border.width: UM.Theme.getSize("default_lining").width
width: printerListScrollView.width width: printerListScrollView.width
height: UM.Theme.getSize("card").height height: UM.Theme.getSize("card").height
property string syncStatus:
{
var printer_id = model.metadata["host_guid"]
if(syncModel.printerStatus[printer_id] === undefined) //No status information available. Could be added after we started syncing.
{
return "idle";
}
return syncModel.printerStatus[printer_id];
}
Cura.IconWithText Cura.IconWithText
{ {
anchors anchors
@ -309,6 +320,40 @@ Window
} }
} }
} }
UM.RecolorImage
{
width: UM.Theme.getSize("section_icon").width
height: width
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: Math.round((parent.height - height) / 2) //Same margin on the right as above and below.
visible: delegateContainer.syncStatus === "uploading"
source: UM.Theme.getIcon("ArrowDoubleCircleRight")
color: UM.Theme.getColor("primary")
RotationAnimator
{
target: printerStatusSyncingIcon
from: 0
to: 360
duration: 1000
loops: Animation.Infinite
running: true
}
}
UM.StatusIcon
{
width: UM.Theme.getSize("section_icon").width
height: width
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: Math.round((parent.height - height) / 2) //Same margin on the right as above and below.
visible: delegateContainer.syncStatus === "failed" || delegateContainer.syncStatus === "success"
status: delegateContainer.syncStatus === "success" ? UM.StatusIcon.Status.POSITIVE : UM.StatusIcon.Status.ERROR
}
} }
footer: Item footer: Item
@ -431,7 +476,7 @@ Window
to: 360 to: 360
duration: 1000 duration: 1000
loops: Animation.Infinite loops: Animation.Infinite
running: !syncButton.visible //Don't run while invisible. Would be a waste of render updates. running: true
} }
} }
Label Label