mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 12:47:49 -06:00
Use states rather than individually switching properties
This is necessary because we'll add a fourth state here: An error state. This would get quite complex otherwise. Contributes to issue CURA-8556.
This commit is contained in:
parent
aed52cea74
commit
bca2f36186
1 changed files with 41 additions and 16 deletions
|
@ -65,6 +65,43 @@ ScrollView
|
||||||
|
|
||||||
spacing: UM.Theme.getSize("thin_margin").width
|
spacing: UM.Theme.getSize("thin_margin").width
|
||||||
|
|
||||||
|
states:
|
||||||
|
[
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "Loading"
|
||||||
|
when: pluginList.isLoading
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: loadMoreIcon
|
||||||
|
source: UM.Theme.getIcon("ArrowDoubleCircleRight")
|
||||||
|
color: UM.Theme.getColor("action_button_disabled_text")
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: loadMoreLabel
|
||||||
|
text: catalog.i18nc("@button", "Loading")
|
||||||
|
color: UM.Theme.getColor("action_button_disabled_text")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "LastPage"
|
||||||
|
when: !pluginList.hasMore
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: loadMoreIcon
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: loadMoreLabel
|
||||||
|
text: catalog.i18nc("@button", "No more results to load")
|
||||||
|
color: UM.Theme.getColor("action_button_disabled_text")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
UM.RecolorImage
|
UM.RecolorImage
|
||||||
{
|
{
|
||||||
id: loadMoreIcon
|
id: loadMoreIcon
|
||||||
|
@ -72,9 +109,8 @@ ScrollView
|
||||||
height: UM.Theme.getSize("small_button_icon").height
|
height: UM.Theme.getSize("small_button_icon").height
|
||||||
anchors.verticalCenter: loadMoreLabel.verticalCenter
|
anchors.verticalCenter: loadMoreLabel.verticalCenter
|
||||||
|
|
||||||
visible: pluginList.hasMore || pluginList.isLoading
|
source: UM.Theme.getIcon("ArrowDown")
|
||||||
source: UM.Theme.getIcon(pluginList.isLoading ? "ArrowDoubleCircleRight" : "ArrowDown")
|
color: UM.Theme.getColor("secondary_button_text")
|
||||||
color: UM.Theme.getColor(loadMoreButton.enabled ? "secondary_button_text" : "action_button_disabled_text")
|
|
||||||
|
|
||||||
RotationAnimator
|
RotationAnimator
|
||||||
{
|
{
|
||||||
|
@ -90,20 +126,9 @@ ScrollView
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
id: loadMoreLabel
|
id: loadMoreLabel
|
||||||
text:
|
text: catalog.i18nc("@button", "Load more")
|
||||||
{
|
|
||||||
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")
|
font: UM.Theme.getFont("medium_bold")
|
||||||
color: UM.Theme.getColor(loadMoreButton.enabled ? "secondary_button_text" : "action_button_disabled_text")
|
color: UM.Theme.getColor("secondary_button_text")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue