From bad7890c830abbc5959619d6e9991662f0b48db4 Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Thu, 17 May 2018 03:19:11 +0300 Subject: [PATCH] extract avatar name from url if empty --- interface/resources/qml/hifi/AvatarApp.qml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/AvatarApp.qml b/interface/resources/qml/hifi/AvatarApp.qml index d0869b5337..968d858a9b 100644 --- a/interface/resources/qml/hifi/AvatarApp.qml +++ b/interface/resources/qml/hifi/AvatarApp.qml @@ -32,6 +32,21 @@ Rectangle { property var jointNames; property var currentAvatarSettings; + function getAvatarName() { + if(avatarName !== '') { + return avatarName; + } + + if(currentAvatar === null) { + return ''; + } + + var avatarUrl = currentAvatar.entry.avatarUrl; + var splitted = avatarUrl.split('/'); + + return splitted[splitted.length - 1]; + } + property string avatarName: currentAvatar ? currentAvatar.name : '' property string avatarUrl: currentAvatar ? currentAvatar.thumbnailUrl : null property bool isAvatarInFavorites: currentAvatar ? allAvatars.findAvatar(currentAvatar.name) !== undefined : false @@ -353,7 +368,7 @@ Rectangle { TextStyle3 { id: avatarNameLabel - text: avatarName + text: getAvatarName() anchors.left: avatarImage.right anchors.leftMargin: 30 anchors.top: star.bottom