parent
841f1704b7
commit
5c034f545d
|
@ -11,20 +11,19 @@ import shared.popups 1.0
|
||||||
|
|
||||||
// TODO: replace with StatusModal
|
// TODO: replace with StatusModal
|
||||||
ModalPopup {
|
ModalPopup {
|
||||||
property string selectedImage // selectedImage is for us to be able to analyze it before setting it as current
|
|
||||||
property string uploadError
|
|
||||||
|
|
||||||
id: popup
|
id: popup
|
||||||
|
|
||||||
property url largeImage: ""
|
|
||||||
property bool hasIdentityImage: false
|
|
||||||
|
|
||||||
signal cropFinished(string selectedImage, var aX, var aY, var bX, var bY)
|
|
||||||
signal removeImageButtonClicked()
|
|
||||||
|
|
||||||
//% "Profile picture"
|
//% "Profile picture"
|
||||||
title: qsTrId("profile-picture")
|
title: qsTrId("profile-picture")
|
||||||
|
|
||||||
|
property var profileStore
|
||||||
|
|
||||||
|
property string selectedImage // selectedImage is for us to be able to analyze it before setting it as current
|
||||||
|
property string uploadError
|
||||||
|
property url largeImage: !popup.profileStore.isIdenticon?
|
||||||
|
popup.profileStore.profileLargeImage :
|
||||||
|
popup.profileStore.icon
|
||||||
|
property bool hasIdentityImage: !popup.profileStore.isIdenticon
|
||||||
|
|
||||||
onClosed: {
|
onClosed: {
|
||||||
destroy()
|
destroy()
|
||||||
}
|
}
|
||||||
|
@ -71,7 +70,9 @@ ModalPopup {
|
||||||
|
|
||||||
selectedImage: popup.selectedImage
|
selectedImage: popup.selectedImage
|
||||||
ratio: "1:1"
|
ratio: "1:1"
|
||||||
onCropFinished: popup.cropFinished(selectedImage, aX, aY, bX, bY)
|
onCropFinished: {
|
||||||
|
popup.uploadError = popup.profileStore.uploadImage(selectedImage, aX, aY, bX, bY)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +88,9 @@ ModalPopup {
|
||||||
anchors.right: uploadBtn.left
|
anchors.right: uploadBtn.left
|
||||||
anchors.rightMargin: Style.current.padding
|
anchors.rightMargin: Style.current.padding
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
onClicked: popup.removeImageButtonClicked()
|
onClicked: {
|
||||||
|
popup.uploadError = popup.profileStore.removeImage()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusButton {
|
StatusButton {
|
||||||
|
|
|
@ -26,20 +26,6 @@ Item {
|
||||||
height: parent.height
|
height: parent.height
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
Component {
|
|
||||||
id: changeProfileModalComponent
|
|
||||||
ChangeProfilePicModal {
|
|
||||||
largeImage: !root.profileStore.isIdenticon? root.profileStore.profileLargeImage : root.profileStore.icon
|
|
||||||
hasIdentityImage: !root.profileStore.isIdenticon
|
|
||||||
onCropFinished: {
|
|
||||||
uploadError = root.profileStore.uploadImage(selectedImage, aX, aY, bX, bY)
|
|
||||||
}
|
|
||||||
onRemoveImageButtonClicked: {
|
|
||||||
uploadError = root.profileStore.removeImage()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: profileImgNameContainer
|
id: profileImgNameContainer
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
@ -82,8 +68,7 @@ Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
const popup = changeProfileModalComponent.createObject(root);
|
Global.openChangeProfilePicPopup()
|
||||||
popup.open()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,10 @@ Item {
|
||||||
popup.openPopup(publicKey);
|
popup.openPopup(publicKey);
|
||||||
Global.profilePopupOpened = true;
|
Global.profilePopupOpened = true;
|
||||||
}
|
}
|
||||||
|
onOpenChangeProfilePicPopup: {
|
||||||
|
var popup = changeProfilePicComponent.createObject(appMain);
|
||||||
|
popup.open();
|
||||||
|
}
|
||||||
onOpenBackUpSeedPopup : {
|
onOpenBackUpSeedPopup : {
|
||||||
var popup = backupSeedModalComponent.createObject(appMain)
|
var popup = backupSeedModalComponent.createObject(appMain)
|
||||||
popup.open()
|
popup.open()
|
||||||
|
@ -170,6 +174,12 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property Component changeProfilePicComponent: Component {
|
||||||
|
ChangeProfilePicModal {
|
||||||
|
profileStore: appMain.rootStore.profileSectionStore.profileStore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Audio {
|
Audio {
|
||||||
id: sendMessageSound
|
id: sendMessageSound
|
||||||
store: rootStore
|
store: rootStore
|
||||||
|
|
|
@ -66,10 +66,17 @@ StatusModal {
|
||||||
popup.open()
|
popup.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onHeaderImageClicked: {
|
||||||
|
Global.openChangeProfilePicPopup()
|
||||||
|
}
|
||||||
|
|
||||||
header.title: userDisplayName
|
header.title: userDisplayName
|
||||||
header.subTitle: userIsEnsVerified ? userName : userPublicKey
|
header.subTitle: userIsEnsVerified ? userName : userPublicKey
|
||||||
header.subTitleElide: Text.ElideMiddle
|
header.subTitleElide: Text.ElideMiddle
|
||||||
header.image.source: userIcon
|
// In the following line we need to use `icon` property as that's the easiest way
|
||||||
|
// to update image on change (in case of logged in user)
|
||||||
|
header.image.source: isCurrentUser? popup.profileStore.icon : userIcon
|
||||||
|
header.headerImageEditable: isCurrentUser
|
||||||
|
|
||||||
headerActionButton: StatusFlatRoundButton {
|
headerActionButton: StatusFlatRoundButton {
|
||||||
type: StatusFlatRoundButton.Type.Secondary
|
type: StatusFlatRoundButton.Type.Secondary
|
||||||
|
|
|
@ -27,6 +27,7 @@ QtObject {
|
||||||
signal openBackUpSeedPopup()
|
signal openBackUpSeedPopup()
|
||||||
|
|
||||||
signal openProfilePopupRequested(string publicKey, var parentPopup)
|
signal openProfilePopupRequested(string publicKey, var parentPopup)
|
||||||
|
signal openChangeProfilePicPopup()
|
||||||
|
|
||||||
function openProfilePopup(publicKey, parentPopup){
|
function openProfilePopup(publicKey, parentPopup){
|
||||||
openProfilePopupRequested(publicKey, parentPopup);
|
openProfilePopupRequested(publicKey, parentPopup);
|
||||||
|
|
Loading…
Reference in New Issue