mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 02:19:04 +08:00
Show default avatar if user has no avatar picture set
CURA-5784
This commit is contained in:
parent
2bb7b352ef
commit
99bac25ab2
@ -11,6 +11,7 @@ Column
|
|||||||
{
|
{
|
||||||
property var profile: null
|
property var profile: null
|
||||||
property var loggedIn: false
|
property var loggedIn: false
|
||||||
|
property var profileImage: ""
|
||||||
|
|
||||||
padding: 2 * UM.Theme.getSize("default_margin").height
|
padding: 2 * UM.Theme.getSize("default_margin").height
|
||||||
spacing: 2 * UM.Theme.getSize("default_margin").height
|
spacing: 2 * UM.Theme.getSize("default_margin").height
|
||||||
@ -21,7 +22,18 @@ Column
|
|||||||
width: UM.Theme.getSize("avatar_image").width
|
width: UM.Theme.getSize("avatar_image").width
|
||||||
height: UM.Theme.getSize("avatar_image").height
|
height: UM.Theme.getSize("avatar_image").height
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_no_user")
|
source:
|
||||||
|
{
|
||||||
|
if(loggedIn)
|
||||||
|
{
|
||||||
|
if(profileImage)
|
||||||
|
{
|
||||||
|
return profileImage
|
||||||
|
}
|
||||||
|
return UM.Theme.getImage("avatar_no_user")
|
||||||
|
}
|
||||||
|
return UM.Theme.getImage("avatar_no_user")
|
||||||
|
}
|
||||||
outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("lining")
|
outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("lining")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,18 @@ Button
|
|||||||
anchors.verticalCenter: accountWidget.verticalCenter
|
anchors.verticalCenter: accountWidget.verticalCenter
|
||||||
anchors.horizontalCenter: accountWidget.horizontalCenter
|
anchors.horizontalCenter: accountWidget.horizontalCenter
|
||||||
|
|
||||||
source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_no_user")
|
source:
|
||||||
|
{
|
||||||
|
if(loggedIn)
|
||||||
|
{
|
||||||
|
if(profile["profile_image_url"])
|
||||||
|
{
|
||||||
|
return profile["profile_image_url"]
|
||||||
|
}
|
||||||
|
return UM.Theme.getImage("avatar_no_user")
|
||||||
|
}
|
||||||
|
return UM.Theme.getImage("avatar_no_user")
|
||||||
|
}
|
||||||
outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("lining")
|
outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("lining")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,6 +56,7 @@ Button
|
|||||||
id: panel
|
id: panel
|
||||||
profile: Cura.API.account.userProfile
|
profile: Cura.API.account.userProfile
|
||||||
loggedIn: Cura.API.account.isLoggedIn
|
loggedIn: Cura.API.account.isLoggedIn
|
||||||
|
profileImage: Cura.API.account.profileImageUrl
|
||||||
}
|
}
|
||||||
|
|
||||||
background: UM.PointingRectangle
|
background: UM.PointingRectangle
|
||||||
|
Loading…
x
Reference in New Issue
Block a user