mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-07 22:13:58 -06:00
Show default avatar if user has no avatar picture set
CURA-5784
This commit is contained in:
parent
2bb7b352ef
commit
99bac25ab2
2 changed files with 26 additions and 2 deletions
|
@ -11,6 +11,7 @@ Column
|
|||
{
|
||||
property var profile: null
|
||||
property var loggedIn: false
|
||||
property var profileImage: ""
|
||||
|
||||
padding: 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
|
||||
height: UM.Theme.getSize("avatar_image").height
|
||||
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")
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,18 @@ Button
|
|||
anchors.verticalCenter: accountWidget.verticalCenter
|
||||
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")
|
||||
}
|
||||
|
||||
|
@ -45,6 +56,7 @@ Button
|
|||
id: panel
|
||||
profile: Cura.API.account.userProfile
|
||||
loggedIn: Cura.API.account.isLoggedIn
|
||||
profileImage: Cura.API.account.profileImageUrl
|
||||
}
|
||||
|
||||
background: UM.PointingRectangle
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue