feat(profile): Place user image/identicon onto the QR code
- fix the QR code to generate a URL with the link to the profile instead of just the user key - reuse the `UserImage` component and place it on top of the existing QR code - put a white rectangle behind the QR code image and white ring around the user image Fixes #13482
This commit is contained in:
parent
98f9edb545
commit
46e256673c
|
@ -29,7 +29,7 @@ SplitView {
|
||||||
|
|
||||||
function getCompressedPk(publicKey) { return "zx3sh" + publicKey }
|
function getCompressedPk(publicKey) { return "zx3sh" + publicKey }
|
||||||
|
|
||||||
function getColorHashAsJson(publicKey) {
|
function getColorHashAsJson(publicKey, skipEnsVerification=false) {
|
||||||
return JSON.stringify([{colorId: 0, segmentLength: 1},
|
return JSON.stringify([{colorId: 0, segmentLength: 1},
|
||||||
{colorId: 19, segmentLength: 2}])
|
{colorId: 19, segmentLength: 2}])
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,10 @@ SplitView {
|
||||||
|
|
||||||
// mainModuleInst mock
|
// mainModuleInst mock
|
||||||
QtObject {
|
QtObject {
|
||||||
|
function isEnsVerified(publicKey) {
|
||||||
|
return ensVerified.checked
|
||||||
|
}
|
||||||
|
|
||||||
function getContactDetailsAsJson(publicKey, getVerificationRequest=true, getOnlineStatus=false, includeDetails=false) {
|
function getContactDetailsAsJson(publicKey, getVerificationRequest=true, getOnlineStatus=false, includeDetails=false) {
|
||||||
return JSON.stringify({ displayName: displayName.text,
|
return JSON.stringify({ displayName: displayName.text,
|
||||||
optionalName: "",
|
optionalName: "",
|
||||||
|
|
|
@ -52,8 +52,8 @@ QtObject {
|
||||||
return root.profileModule.remove()
|
return root.profileModule.remove()
|
||||||
}
|
}
|
||||||
|
|
||||||
function getQrCodeSource(publicKey) {
|
function getQrCodeSource(text) {
|
||||||
return globalUtils.qrCode(publicKey)
|
return globalUtils.qrCode(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyToClipboard(value) {
|
function copyToClipboard(value) {
|
||||||
|
|
|
@ -269,8 +269,10 @@ Pane {
|
||||||
destroyOnClose: true
|
destroyOnClose: true
|
||||||
title: d.isCurrentUser ? qsTr("Share your profile") : qsTr("%1's profile").arg(d.mainDisplayName)
|
title: d.isCurrentUser ? qsTr("Share your profile") : qsTr("%1's profile").arg(d.mainDisplayName)
|
||||||
publicKey: root.publicKey
|
publicKey: root.publicKey
|
||||||
qrCode: root.profileStore.getQrCodeSource(Utils.getCompressedPk(root.publicKey))
|
|
||||||
linkToProfile: d.linkToProfile
|
linkToProfile: d.linkToProfile
|
||||||
|
qrCode: root.profileStore.getQrCodeSource(linkToProfile)
|
||||||
|
displayName: userImage.name
|
||||||
|
largeImage: userImage.image
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,6 +290,7 @@ Pane {
|
||||||
spacing: Style.current.halfPadding
|
spacing: Style.current.halfPadding
|
||||||
|
|
||||||
UserImage {
|
UserImage {
|
||||||
|
id: userImage
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
objectName: "ProfileDialog_userImage"
|
objectName: "ProfileDialog_userImage"
|
||||||
name: root.dirty ? root.dirtyValues.displayName
|
name: root.dirty ? root.dirtyValues.displayName
|
||||||
|
|
|
@ -10,6 +10,7 @@ import StatusQ.Popups.Dialog 0.1
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
import shared.controls 1.0
|
import shared.controls 1.0
|
||||||
import shared.views.chat 1.0
|
import shared.views.chat 1.0
|
||||||
|
import shared.controls.chat 1.0
|
||||||
|
|
||||||
StatusDialog {
|
StatusDialog {
|
||||||
id: root
|
id: root
|
||||||
|
@ -18,6 +19,9 @@ StatusDialog {
|
||||||
required property string qrCode
|
required property string qrCode
|
||||||
required property string linkToProfile
|
required property string linkToProfile
|
||||||
|
|
||||||
|
required property string displayName
|
||||||
|
required property string largeImage
|
||||||
|
|
||||||
footer: null
|
footer: null
|
||||||
|
|
||||||
width: 500
|
width: 500
|
||||||
|
@ -29,16 +33,33 @@ StatusDialog {
|
||||||
contentItem: ColumnLayout {
|
contentItem: ColumnLayout {
|
||||||
spacing: Style.current.halfPadding
|
spacing: Style.current.halfPadding
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: width
|
||||||
|
color: Theme.palette.white
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
Layout.preferredWidth: 290
|
anchors.fill: parent
|
||||||
Layout.preferredHeight: 290
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
mipmap: true
|
mipmap: true
|
||||||
smooth: false
|
smooth: false
|
||||||
source: root.qrCode
|
source: root.qrCode
|
||||||
|
|
||||||
|
UserImage {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
name: root.displayName
|
||||||
|
pubkey: root.publicKey
|
||||||
|
image: root.largeImage
|
||||||
|
interactive: false
|
||||||
|
imageWidth: 78
|
||||||
|
imageHeight: 78
|
||||||
|
|
||||||
|
// show a hardcoded white ring
|
||||||
|
showRing: true
|
||||||
|
colorHash: JSON.stringify([{colorId: 4, segmentLength: 32}])
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.RightButton
|
acceptedButtons: Qt.RightButton
|
||||||
|
@ -51,6 +72,7 @@ StatusDialog {
|
||||||
imageSource: root.qrCode
|
imageSource: root.qrCode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
Layout.topMargin: Style.current.smallPadding
|
Layout.topMargin: Style.current.smallPadding
|
||||||
|
|
Loading…
Reference in New Issue