2020-07-21 21:03:22 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import QtGraphicalEffects 1.13
|
|
|
|
import "../../../../imports"
|
|
|
|
import "../../../../shared"
|
2020-12-04 18:45:30 +00:00
|
|
|
import "../../../../shared/status"
|
2020-07-21 21:03:22 +00:00
|
|
|
|
|
|
|
Item {
|
2020-11-30 17:03:52 +00:00
|
|
|
property string ensName: profileModel.profile.preferredUsername || ""
|
|
|
|
property string username: profileModel.profile.username
|
|
|
|
property string pubkey: profileModel.profile.pubKey
|
2020-07-21 21:03:22 +00:00
|
|
|
|
|
|
|
id: profileHeaderContent
|
2021-03-18 09:33:39 +00:00
|
|
|
anchors.fill: parent
|
2020-07-21 21:03:22 +00:00
|
|
|
|
2020-11-30 17:03:52 +00:00
|
|
|
Component {
|
|
|
|
id: changeProfileModalComponent
|
|
|
|
ChangeProfilePicModal {}
|
|
|
|
}
|
|
|
|
|
2020-07-21 21:03:22 +00:00
|
|
|
Item {
|
|
|
|
id: profileImgNameContainer
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 64
|
2021-03-18 09:33:39 +00:00
|
|
|
width: contentMaxWidth
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2020-07-21 21:03:22 +00:00
|
|
|
|
|
|
|
height: this.childrenRect.height
|
|
|
|
|
2020-11-30 17:03:52 +00:00
|
|
|
Item {
|
|
|
|
id: profileImgContainer
|
|
|
|
width: profileImg.width
|
|
|
|
height: profileImg.height
|
2020-07-21 21:03:22 +00:00
|
|
|
|
2020-11-30 17:03:52 +00:00
|
|
|
RoundedImage {
|
|
|
|
id: profileImg
|
|
|
|
width: 64
|
|
|
|
height: 64
|
|
|
|
border.width: 1
|
|
|
|
border.color: Style.current.border
|
|
|
|
source: profileModel.profile.thumbnailImage || ""
|
2020-07-21 21:03:22 +00:00
|
|
|
smooth: false
|
|
|
|
antialiasing: true
|
|
|
|
}
|
2020-11-30 17:03:52 +00:00
|
|
|
|
|
|
|
RoundedIcon {
|
|
|
|
source: "../../../img/pencil.svg"
|
|
|
|
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: {
|
|
|
|
const popup = changeProfileModalComponent.createObject(profileHeaderContent);
|
|
|
|
popup.open()
|
|
|
|
}
|
|
|
|
}
|
2020-07-21 21:03:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: profileName
|
2020-08-06 18:19:26 +00:00
|
|
|
text: ensName !== "" ? ensName : username
|
2020-11-30 17:03:52 +00:00
|
|
|
anchors.left: profileImgContainer.right
|
2020-12-29 18:18:50 +00:00
|
|
|
anchors.leftMargin: Style.current.halfPadding
|
2020-11-30 17:03:52 +00:00
|
|
|
anchors.top: profileImgContainer.top
|
2020-12-29 18:18:50 +00:00
|
|
|
anchors.topMargin: 4
|
|
|
|
font.weight: Font.Bold
|
|
|
|
font.pixelSize: 20
|
2020-07-21 21:03:22 +00:00
|
|
|
}
|
|
|
|
|
2020-08-27 18:02:28 +00:00
|
|
|
Address {
|
2020-07-21 21:03:22 +00:00
|
|
|
id: pubkeyText
|
2020-08-06 18:19:26 +00:00
|
|
|
text: ensName !== "" ? username : pubkey
|
2020-11-30 17:03:52 +00:00
|
|
|
anchors.bottom: profileImgContainer.bottom
|
2020-07-21 21:03:22 +00:00
|
|
|
anchors.left: profileName.left
|
2020-12-04 18:19:52 +00:00
|
|
|
anchors.bottomMargin: 4
|
2020-08-06 18:19:26 +00:00
|
|
|
width: 200
|
2020-07-21 21:03:22 +00:00
|
|
|
font.pixelSize: 15
|
|
|
|
}
|
|
|
|
|
2020-12-04 18:45:30 +00:00
|
|
|
StatusIconButton {
|
2020-12-04 18:19:52 +00:00
|
|
|
id: qrCodeButton
|
|
|
|
anchors.right: parent.right
|
|
|
|
height: 32
|
|
|
|
width: 32
|
|
|
|
radius: 8
|
2020-12-29 18:18:50 +00:00
|
|
|
anchors.verticalCenter: profileImgContainer.verticalCenter
|
2020-12-04 18:45:30 +00:00
|
|
|
icon.name: "qr-code-icon"
|
|
|
|
iconColor: Style.current.textColor
|
|
|
|
onClicked: {
|
|
|
|
qrCodePopup.open()
|
2020-12-04 18:19:52 +00:00
|
|
|
}
|
2020-07-22 20:16:06 +00:00
|
|
|
}
|
2020-07-21 21:03:22 +00:00
|
|
|
|
|
|
|
Separator {
|
|
|
|
id: lineSeparator
|
2020-11-30 17:03:52 +00:00
|
|
|
anchors.top: profileImgContainer.bottom
|
|
|
|
anchors.topMargin: 36
|
|
|
|
|
2020-07-21 21:03:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-04 18:19:52 +00:00
|
|
|
ModalPopup {
|
|
|
|
id: qrCodePopup
|
|
|
|
width: 420
|
|
|
|
height: 420
|
2020-08-19 21:01:22 +00:00
|
|
|
Image {
|
|
|
|
asynchronous: true
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
source: profileModel.qrCode(pubkey)
|
2020-12-29 18:18:50 +00:00
|
|
|
anchors.verticalCenterOffset: 20
|
2020-08-19 21:01:22 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2020-12-29 18:18:50 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2020-12-04 18:19:52 +00:00
|
|
|
height: 312
|
|
|
|
width: 312
|
2020-08-19 21:01:22 +00:00
|
|
|
mipmap: true
|
|
|
|
smooth: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-21 21:03:22 +00:00
|
|
|
Column {
|
|
|
|
anchors.right: profileImgNameContainer.right
|
|
|
|
anchors.left: profileImgNameContainer.left
|
|
|
|
spacing: Style.current.bigPadding
|
|
|
|
anchors.top: profileImgNameContainer.bottom
|
|
|
|
anchors.topMargin: Style.current.smallPadding
|
|
|
|
|
|
|
|
TextWithLabel {
|
2020-08-26 15:52:26 +00:00
|
|
|
//% "Chat key"
|
|
|
|
label: qsTrId("chat-key")
|
2020-07-21 21:03:22 +00:00
|
|
|
text: pubkey.substring(0, 13) + "..." + pubkey.substring(pubkey.length - 13)
|
|
|
|
textToCopy: pubkey
|
|
|
|
}
|
|
|
|
|
|
|
|
TextWithLabel {
|
2020-08-26 15:52:26 +00:00
|
|
|
//% "Share Profile URL"
|
|
|
|
label: qsTrId("share-profile-url")
|
2021-03-09 17:59:41 +00:00
|
|
|
text: `${Constants.userLinkPrefix}${pubkey.substring(0, 5)}...${pubkey.substring(pubkey.length - 5)}`
|
|
|
|
textToCopy: Constants.userLinkPrefix + pubkey
|
2020-07-21 21:03:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;formeditorColor:"#ffffff"}
|
|
|
|
}
|
|
|
|
##^##*/
|