From 1ab677f5dd8abfd66519798c23b9ad3f79cff113 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 21 Oct 2021 18:37:02 +0200 Subject: [PATCH] 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. --- plugins/Marketplace/resources/qml/Plugins.qml | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/plugins/Marketplace/resources/qml/Plugins.qml b/plugins/Marketplace/resources/qml/Plugins.qml index 9cfcdac697..5f9c92c837 100644 --- a/plugins/Marketplace/resources/qml/Plugins.qml +++ b/plugins/Marketplace/resources/qml/Plugins.qml @@ -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") }