From bfb39cf9890be9bbedac7b06148b566067b2d6a6 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 12 Oct 2021 17:09:54 +0200 Subject: [PATCH] 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. --- .../Materials/MaterialsSyncDialog.qml | 47 ++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml b/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml index 04f496d29a..a3a06f6242 100644 --- a/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml +++ b/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml @@ -258,11 +258,22 @@ Window model: cloudPrinterList delegate: Rectangle { + id: delegateContainer border.color: UM.Theme.getColor("lining") border.width: UM.Theme.getSize("default_lining").width width: printerListScrollView.width 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 { 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 @@ -431,7 +476,7 @@ Window to: 360 duration: 1000 loops: Animation.Infinite - running: !syncButton.visible //Don't run while invisible. Would be a waste of render updates. + running: true } } Label