Show syncing spinner while syncing

Rather than disabling the sync button, hide it completely and show this spinner instead.

Contributes to issue CURA-8609.
This commit is contained in:
Ghostkeeper 2021-10-11 14:30:10 +02:00
parent 56eb694745
commit ffee4a2443
No known key found for this signature in database
GPG Key ID: D2A8871EE34EC59A

View File

@ -1,7 +1,7 @@
//Copyright (c) 2021 Ultimaker B.V. //Copyright (c) 2021 Ultimaker B.V.
//Cura is released under the terms of the LGPLv3 or higher. //Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.1 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
@ -345,18 +345,60 @@ Window
} }
Cura.PrimaryButton Cura.PrimaryButton
{ {
id: syncButton
anchors.right: parent.right anchors.right: parent.right
text: catalog.i18nc("@button", "Sync") text: catalog.i18nc("@button", "Sync")
onClicked: materialManagementModel.exportUpload() onClicked: materialManagementModel.exportUpload()
enabled: visible:
{ {
if(!materialManagementModel) //When the dialog is created, this is not set yet. if(!materialManagementModel) //When the dialog is created, this is not set yet.
{ {
return false; return true;
} }
return materialManagementModel.exportUploadStatus != "uploading"; return materialManagementModel.exportUploadStatus != "uploading";
} }
} }
Item
{
anchors.right: parent.right
width: childrenRect.width
height: syncButton.height
visible: !syncButton.visible
UM.RecolorImage
{
id: syncingIcon
height: UM.Theme.getSize("action_button_icon").height
width: height
anchors.right: syncingLabel.left
anchors.rightMargin: UM.Theme.getSize("narrow_margin").width
anchors.verticalCenter: parent.verticalCenter
source: UM.Theme.getIcon("ArrowDoubleCircleRight")
color: UM.Theme.getColor("primary")
RotationAnimator
{
target: syncingIcon
from: 0
to: 360
duration: 1000
loops: Animation.Infinite
running: !syncButton.visible //Don't run while invisible. Would be a waste of render updates.
}
}
Label
{
id: syncingLabel
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
text: catalog.i18nc("@button", "Syncing")
color: UM.Theme.getColor("primary")
font: UM.Theme.getFont("medium")
}
}
} }
} }