Set avatar button on proper position

This commit is contained in:
Angela Mazzurco 2017-07-18 18:16:51 +02:00
parent 875b625abb
commit 3fecbe02a3

View File

@ -31,8 +31,14 @@ Item
Button Button
{ {
text: "Open f d " id: avatarPicker
text: "Change your Avatar"
visible: isOwn visible: isOwn
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
onClicked: onClicked:
{ {
fileChooser.open() fileChooser.open()
@ -43,27 +49,17 @@ Item
onResultFileChanged: onResultFileChanged:
{ {
console.log("Result file changed! " , resultFile) console.log("Result file changed! " , resultFile)
newAvatar.source = resultFile
var base64Image = androidImagePicker.imageToBase64(resultFile) var base64Image = androidImagePicker.imageToBase64(resultFile)
rsApi.request("/identity/set_avatar", JSON.stringify({"gxs_id": cntDt.md.gxs_id, "avatar": base64Image }), rsApi.request("/identity/set_avatar", JSON.stringify({"gxs_id": cntDt.md.gxs_id, "avatar": base64Image }),
function (res){ function (res){
console.log("Avatar changed! " , JSON.stringify(res)) console.log("Avatar changed! " , JSON.stringify(res))
} })
)
} }
} }
} }
Image
{
id: newAvatar
height: topFace.height
width: topFace.height
fillMode: Image.PreserveAspectFit
}
AvatarOrColorHash AvatarOrColorHash
{ {
@ -71,7 +67,7 @@ Item
gxs_id: cntDt.md.gxs_id gxs_id: cntDt.md.gxs_id
anchors.top: parent.top anchors.top: (isOwn)? avatarPicker.bottom : parent.top
anchors.topMargin: 6 anchors.topMargin: 6
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }