Add state for when it's loading

This has a slight bug in that the icon will immediately change to an arrow once loading has completed, but will slowly rotate back to angle 0. You don't see this, since the new plug-ins will come in between. The new plug-ins will always be a full page, or otherwise the icon disappears altogether and it's not visible anyway. But if you hold down the scrollbar while loading and quickly scroll down when loading completed, you can see this happen. I don't think anyone will really mind though.

Contributes to issue CURA-8556.
This commit is contained in:
Ghostkeeper 2021-10-21 18:37:02 +02:00
parent e3cd5606f0
commit 1ab677f5dd
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -67,18 +67,41 @@ ScrollView
UM.RecolorImage
{
id: loadMoreIcon
width: visible ? UM.Theme.getSize("small_button_icon").width : 0
height: UM.Theme.getSize("small_button_icon").height
anchors.verticalCenter: loadMoreLabel.verticalCenter
visible: pluginList.hasMore
source: UM.Theme.getIcon("ArrowDown")
visible: pluginList.hasMore || pluginList.isLoading
source: UM.Theme.getIcon(pluginList.isLoading ? "ArrowDoubleCircleRight" : "ArrowDown")
color: UM.Theme.getColor(loadMoreButton.enabled ? "secondary_button_text" : "action_button_disabled_text")
RotationAnimator
{
target: loadMoreIcon
from: 0
to: 360
duration: 1000
loops: Animation.Infinite
running: pluginList.isLoading
alwaysRunToEnd: true
}
}
Label
{
id: loadMoreLabel
text: pluginList.hasMore ? catalog.i18nc("@button", "Load More") : catalog.i18nc("@button", "No more results to load")
text:
{
if(pluginList.isLoading)
{
return catalog.i18nc("@button", "Loading");
}
if(pluginList.hasMore)
{
return catalog.i18nc("@button", "Load more");
}
return catalog.i18nc("@button", "No more results to load");
}
font: UM.Theme.getFont("medium_bold")
color: UM.Theme.getColor(loadMoreButton.enabled ? "secondary_button_text" : "action_button_disabled_text")
}