2020-07-21 17:03:22 -04:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import QtGraphicalEffects 1.13
|
2021-09-28 18:04:06 +03:00
|
|
|
|
|
|
|
import utils 1.0
|
2020-07-21 17:03:22 -04:00
|
|
|
import "../../../../shared"
|
2021-10-14 11:24:34 +02:00
|
|
|
import "../../../../shared/panels"
|
2021-10-14 13:33:34 +02:00
|
|
|
import "../../../../shared/popups"
|
2020-12-04 20:45:30 +02:00
|
|
|
import "../../../../shared/status"
|
2020-07-21 17:03:22 -04:00
|
|
|
|
2021-10-06 11:16:39 +02:00
|
|
|
import "../popups"
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
2021-09-09 16:03:17 +02:00
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
2020-07-21 17:03:22 -04:00
|
|
|
Item {
|
2021-10-06 11:16:39 +02:00
|
|
|
id: root
|
|
|
|
|
|
|
|
property var store
|
|
|
|
|
|
|
|
property string ensName: store.preferredUsername || store.firstEnsUsername || ""
|
|
|
|
property string username: store.username
|
|
|
|
property string pubkey: store.pubKey
|
2020-07-21 17:03:22 -04:00
|
|
|
|
2021-04-08 11:44:58 -04:00
|
|
|
clip: true
|
2021-04-07 12:28:49 -04:00
|
|
|
height: parent.height
|
|
|
|
Layout.fillWidth: true
|
2020-07-21 17:03:22 -04:00
|
|
|
|
2020-11-30 12:03:52 -05:00
|
|
|
Component {
|
|
|
|
id: changeProfileModalComponent
|
2021-10-06 11:16:39 +02:00
|
|
|
ChangeProfilePicModal {
|
|
|
|
largeImage: store.profileLargeImage
|
|
|
|
hasIdentityImage: store.hasIdentityImage
|
|
|
|
onCropFinished: {
|
|
|
|
uploadError = store.uploadImage(selectedImage, aX, aY, bX, bY)
|
|
|
|
}
|
|
|
|
onRemoveImageButtonClicked: {
|
|
|
|
uploadError = store.removeImage()
|
|
|
|
}
|
|
|
|
}
|
2020-11-30 12:03:52 -05:00
|
|
|
}
|
|
|
|
|
2020-07-21 17:03:22 -04:00
|
|
|
Item {
|
|
|
|
id: profileImgNameContainer
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 64
|
2021-04-08 11:44:58 -04:00
|
|
|
width: profileContainer.profileContentWidth
|
|
|
|
|
2021-03-18 10:33:39 +01:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2020-07-21 17:03:22 -04:00
|
|
|
|
|
|
|
height: this.childrenRect.height
|
|
|
|
|
2020-11-30 12:03:52 -05:00
|
|
|
Item {
|
|
|
|
id: profileImgContainer
|
|
|
|
width: profileImg.width
|
|
|
|
height: profileImg.height
|
2020-07-21 17:03:22 -04:00
|
|
|
|
2020-11-30 12:03:52 -05:00
|
|
|
RoundedImage {
|
|
|
|
id: profileImg
|
|
|
|
width: 64
|
|
|
|
height: 64
|
|
|
|
border.width: 1
|
|
|
|
border.color: Style.current.border
|
2021-10-06 11:16:39 +02:00
|
|
|
source: root.store.profileThumbnailImage
|
2020-07-21 17:03:22 -04:00
|
|
|
smooth: false
|
|
|
|
antialiasing: true
|
|
|
|
}
|
2020-11-30 12:03:52 -05:00
|
|
|
|
|
|
|
RoundedIcon {
|
2021-09-28 18:04:06 +03:00
|
|
|
source: Style.svg("pencil")
|
2020-11-30 12:03:52 -05:00
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.bottomMargin: -3
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: -3
|
|
|
|
width: 24
|
|
|
|
height: 24
|
|
|
|
border.width: 1
|
|
|
|
border.color: Style.current.background
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
onClicked: {
|
2021-10-06 11:16:39 +02:00
|
|
|
const popup = changeProfileModalComponent.createObject(root);
|
2020-11-30 12:03:52 -05:00
|
|
|
popup.open()
|
|
|
|
}
|
|
|
|
}
|
2020-07-21 17:03:22 -04:00
|
|
|
}
|
|
|
|
|
2021-10-06 11:16:39 +02:00
|
|
|
StatusBaseText {
|
2020-07-21 17:03:22 -04:00
|
|
|
id: profileName
|
2021-10-06 11:16:39 +02:00
|
|
|
text: root.ensName !== "" ? root.ensName : root.username
|
2020-11-30 12:03:52 -05:00
|
|
|
anchors.left: profileImgContainer.right
|
2020-12-29 13:18:50 -05:00
|
|
|
anchors.leftMargin: Style.current.halfPadding
|
2020-11-30 12:03:52 -05:00
|
|
|
anchors.top: profileImgContainer.top
|
2020-12-29 13:18:50 -05:00
|
|
|
anchors.topMargin: 4
|
|
|
|
font.weight: Font.Bold
|
|
|
|
font.pixelSize: 20
|
2021-10-06 11:16:39 +02:00
|
|
|
color: Theme.palette.directColor1
|
2020-07-21 17:03:22 -04:00
|
|
|
}
|
|
|
|
|
2020-08-27 14:02:28 -04:00
|
|
|
Address {
|
2020-07-21 17:03:22 -04:00
|
|
|
id: pubkeyText
|
2021-10-06 11:16:39 +02:00
|
|
|
text: root.ensName !== "" ? root.username : root.pubkey
|
2020-11-30 12:03:52 -05:00
|
|
|
anchors.bottom: profileImgContainer.bottom
|
2020-07-21 17:03:22 -04:00
|
|
|
anchors.left: profileName.left
|
2020-12-04 20:19:52 +02:00
|
|
|
anchors.bottomMargin: 4
|
2020-08-06 14:19:26 -04:00
|
|
|
width: 200
|
2020-07-21 17:03:22 -04:00
|
|
|
font.pixelSize: 15
|
|
|
|
}
|
|
|
|
|
2020-12-04 20:45:30 +02:00
|
|
|
StatusIconButton {
|
2020-12-04 20:19:52 +02:00
|
|
|
id: qrCodeButton
|
|
|
|
anchors.right: parent.right
|
|
|
|
height: 32
|
|
|
|
width: 32
|
|
|
|
radius: 8
|
2020-12-29 13:18:50 -05:00
|
|
|
anchors.verticalCenter: profileImgContainer.verticalCenter
|
2020-12-04 20:45:30 +02:00
|
|
|
icon.name: "qr-code-icon"
|
|
|
|
iconColor: Style.current.textColor
|
|
|
|
onClicked: {
|
|
|
|
qrCodePopup.open()
|
2020-12-04 20:19:52 +02:00
|
|
|
}
|
2020-07-22 16:16:06 -04:00
|
|
|
}
|
2020-07-21 17:03:22 -04:00
|
|
|
|
|
|
|
Separator {
|
|
|
|
id: lineSeparator
|
2020-11-30 12:03:52 -05:00
|
|
|
anchors.top: profileImgContainer.bottom
|
|
|
|
anchors.topMargin: 36
|
2020-07-21 17:03:22 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-04 20:19:52 +02:00
|
|
|
ModalPopup {
|
|
|
|
id: qrCodePopup
|
|
|
|
width: 420
|
|
|
|
height: 420
|
2020-08-19 17:01:22 -04:00
|
|
|
Image {
|
|
|
|
asynchronous: true
|
|
|
|
fillMode: Image.PreserveAspectFit
|
2021-10-06 11:16:39 +02:00
|
|
|
source: root.store.getQrCodeSource(pubkey)
|
2020-12-29 13:18:50 -05:00
|
|
|
anchors.verticalCenterOffset: 20
|
2020-08-19 17:01:22 -04:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2020-12-29 13:18:50 -05:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2020-12-04 20:19:52 +02:00
|
|
|
height: 312
|
|
|
|
width: 312
|
2020-08-19 17:01:22 -04:00
|
|
|
mipmap: true
|
|
|
|
smooth: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-21 17:03:22 -04:00
|
|
|
Column {
|
|
|
|
anchors.right: profileImgNameContainer.right
|
|
|
|
anchors.left: profileImgNameContainer.left
|
|
|
|
anchors.top: profileImgNameContainer.bottom
|
2021-09-09 16:03:17 +02:00
|
|
|
anchors.topMargin: 16
|
|
|
|
|
|
|
|
StatusDescriptionListItem {
|
|
|
|
title: qsTr("ENS username")
|
2021-10-06 11:16:39 +02:00
|
|
|
subTitle: root.ensName
|
2021-09-09 16:03:17 +02:00
|
|
|
tooltip.text: qsTr("Copy to clipboard")
|
|
|
|
icon.name: "copy"
|
2021-10-06 11:16:39 +02:00
|
|
|
visible: !!root.ensName
|
2021-09-09 16:03:17 +02:00
|
|
|
iconButton.onClicked: {
|
2021-10-06 11:16:39 +02:00
|
|
|
root.store.copyToClipboard(root.ensName)
|
2021-09-09 16:03:17 +02:00
|
|
|
tooltip.visible = !tooltip.visible
|
|
|
|
}
|
|
|
|
width: parent.width
|
|
|
|
}
|
2020-07-21 17:03:22 -04:00
|
|
|
|
2021-09-09 16:03:17 +02:00
|
|
|
StatusDescriptionListItem {
|
|
|
|
title: qsTr("Chat key")
|
2021-10-06 11:16:39 +02:00
|
|
|
subTitle: root.pubkey
|
2021-09-09 16:03:17 +02:00
|
|
|
subTitleComponent.elide: Text.ElideMiddle
|
|
|
|
subTitleComponent.width: 320
|
|
|
|
subTitleComponent.font.family: Theme.palette.monoFont.name
|
|
|
|
tooltip.text: qsTr("Copy to clipboard")
|
|
|
|
icon.name: "copy"
|
|
|
|
iconButton.onClicked: {
|
2021-10-06 11:16:39 +02:00
|
|
|
root.store.copyToClipboard(root.pubkey)
|
2021-09-09 16:03:17 +02:00
|
|
|
tooltip.visible = !tooltip.visible
|
|
|
|
}
|
|
|
|
width: parent.width
|
2020-07-21 17:03:22 -04:00
|
|
|
}
|
|
|
|
|
2021-09-09 16:03:17 +02:00
|
|
|
StatusDescriptionListItem {
|
|
|
|
title: qsTr("Share Profile URL")
|
2021-10-06 11:16:39 +02:00
|
|
|
subTitle: `${Constants.userLinkPrefix}${root.ensName !== "" ? root.ensName : (root.pubkey.substring(0, 5) + "..." + root.pubkey.substring(root.pubkey.length - 5))}`
|
2021-09-09 16:03:17 +02:00
|
|
|
tooltip.text: qsTr("Copy to clipboard")
|
|
|
|
icon.name: "copy"
|
|
|
|
iconButton.onClicked: {
|
2021-10-06 11:16:39 +02:00
|
|
|
root.store.copyToClipboard(Constants.userLinkPrefix + (root.ensName !== "" ? root.ensName : root.pubkey))
|
2021-09-09 16:03:17 +02:00
|
|
|
tooltip.visible = !tooltip.visible
|
|
|
|
}
|
|
|
|
width: parent.width
|
2020-07-21 17:03:22 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|