feat(Chat): introduce Profile Popup

This is a simple profile popup that will get more functionality in future commits.

Closes #126
This commit is contained in:
Pascal Precht 2020-06-04 12:30:49 +02:00 committed by Iuri Matias
parent 48f64eeb91
commit ffd356d182
3 changed files with 76 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import QtQuick.Layouts 1.3
import Qt.labs.platform 1.1
import "../../../../shared"
import "../../../../imports"
import "../components"
Item {
property string userName: "Jotaro Kujo"
@ -19,6 +20,10 @@ Item {
width: parent.width
height: contentType == Constants.stickerType ? stickerId.height : (isCurrentUser || (!isCurrentUser && !repeatMessageInfo) ? chatBox.height : 24 + chatBox.height)
ProfilePopup {
id: profilePopup
}
Image {
id: chatImage
width: 36
@ -30,6 +35,14 @@ Item {
fillMode: Image.PreserveAspectFit
source: identicon
visible: repeatMessageInfo && !isCurrentUser
MouseArea {
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onClicked: {
profilePopup.open()
}
}
}
TextEdit {

View File

@ -0,0 +1,62 @@
import QtQuick 2.12
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import "../../../../imports"
import "../../../../shared"
import "./"
ModalPopup {
id: popup
title: qsTr("User profile")
Rectangle {
id: profilePic
width: 120
height: 120
radius: 100
border.color: "#10000000"
border.width: 1
color: Theme.transparent
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 16
Image {
width: 120
height: 120
fillMode: Image.PreserveAspectFit
source: identicon
}
}
Text {
id: userNameText
text: userName
anchors.top: profilePic.bottom
anchors.topMargin: 16
anchors.horizontalCenter: parent.horizontalCenter
font.bold: true
font.pixelSize: 16
}
TextEdit {
text: fromAuthor.substr(0, 6) + "..." + fromAuthor.substr(fromAuthor.length - 4)
anchors.top: userNameText.bottom
anchors.topMargin: 12
anchors.horizontalCenter: parent.horizontalCenter
wrapMode: Text.Wrap
readOnly: true
selectByMouse: true
color: Theme.darkGrey
font.pixelSize: 15
}
footer: StyledButton {
anchors.right: parent.right
anchors.rightMargin: Theme.smallPadding
label: "Close"
anchors.bottom: parent.bottom
onClicked: {
profilePopup.close()
}
}
}

View File

@ -1,4 +1,5 @@
SuggestedChannel 1.0 SuggestedChannel.qml
PublicChatPopup 1.0 PublicChatPopup.qml
PrivateChatPopup 1.0 PrivateChatPopup.qml
ProfilePropup 1.0 ProfilePopup.qml
ChannelIcon 1.0 ChannelIcon.qml