mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Set avatar button on proper position
This commit is contained in:
parent
875b625abb
commit
3fecbe02a3
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user