Display profile pictures and names in groups
This commit is contained in:
parent
63966f052a
commit
1b18a78efc
4 changed files with 105 additions and 49 deletions
|
@ -182,7 +182,7 @@ Page {
|
|||
Row {
|
||||
id: headerRow
|
||||
width: parent.width - (3 * Theme.horizontalPageMargin)
|
||||
height: chatOverviewColumn.height + ( 2 * Theme.horizontalPageMargin )
|
||||
height: chatOverviewColumn.height + ( 2 * Theme.paddingLarge )
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
spacing: Theme.paddingMedium
|
||||
|
||||
|
@ -260,32 +260,81 @@ Page {
|
|||
delegate: ListItem {
|
||||
|
||||
id: messageListItem
|
||||
contentHeight: messageTextItem.height + Theme.paddingMedium
|
||||
contentHeight: messageBackground.height + Theme.paddingMedium
|
||||
contentWidth: parent.width
|
||||
|
||||
property variant myMessage: display
|
||||
property variant userInformation: tdLibWrapper.getUserInformation(display.sender_user_id)
|
||||
|
||||
Row {
|
||||
id: messageTextRow
|
||||
spacing: Theme.paddingSmall
|
||||
width: parent.width - ( 2 * Theme.horizontalPageMargin )
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
ProfileThumbnail {
|
||||
id: messagePictureThumbnail
|
||||
photoData: (typeof messageListItem.userInformation.profile_photo !== "undefined") ? messageListItem.userInformation.profile_photo.small : ""
|
||||
replacementStringHint: userText.text
|
||||
width: visible ? Theme.itemSizeSmall : 0
|
||||
height: visible ? Theme.itemSizeSmall : 0
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: Theme.paddingSmall
|
||||
visible: ( chatPage.isBasicGroup || chatPage.isSuperGroup ) && !chatPage.isChannel
|
||||
}
|
||||
|
||||
Item {
|
||||
id: messageTextItem
|
||||
|
||||
width: parent.width - messagePictureThumbnail.width - Theme.paddingSmall
|
||||
height: messageBackground.height
|
||||
|
||||
Rectangle {
|
||||
id: messageBackground
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: (chatPage.myUserId === display.sender_user_id) ? 2 * Theme.horizontalPageMargin : 0
|
||||
right: parent.right
|
||||
rightMargin: (chatPage.myUserId === display.sender_user_id) ? 0 : 2 * Theme.horizontalPageMargin
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
height: messageTextColumn.height + ( 2 * Theme.paddingMedium )
|
||||
|
||||
color: Theme.secondaryColor
|
||||
radius: parent.width / 50
|
||||
opacity: 0.2
|
||||
}
|
||||
|
||||
Column {
|
||||
id: messageTextItem
|
||||
id: messageTextColumn
|
||||
|
||||
spacing: Theme.paddingSmall
|
||||
|
||||
width: parent.width
|
||||
height: messageText.height + messageDateText.height + Theme.paddingMedium
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: messageBackground.width - Theme.horizontalPageMargin
|
||||
anchors.centerIn: messageBackground
|
||||
|
||||
Text {
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: (chatPage.myUserId === display.sender_user_id) ? 4 * Theme.horizontalPageMargin : Theme.horizontalPageMargin
|
||||
right: parent.right
|
||||
rightMargin: (chatPage.myUserId === display.sender_user_id) ? Theme.horizontalPageMargin : 4 * Theme.horizontalPageMargin
|
||||
id: userText
|
||||
|
||||
width: parent.width
|
||||
text: display.sender_user_id !== chatPage.myUserId ? Emoji.emojify(Functions.getUserName(messageListItem.userInformation), font.pixelSize) : qsTr("You")
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
font.weight: Font.ExtraBold
|
||||
color: (chatPage.myUserId === display.sender_user_id) ? Theme.highlightColor : Theme.primaryColor
|
||||
maximumLineCount: 1
|
||||
elide: Text.ElideRight
|
||||
textFormat: Text.StyledText
|
||||
horizontalAlignment: (chatPage.myUserId === display.sender_user_id) ? Text.AlignRight : Text.AlignLeft
|
||||
visible: ( chatPage.isBasicGroup || chatPage.isSuperGroup ) && !chatPage.isChannel
|
||||
}
|
||||
|
||||
Text {
|
||||
id: messageText
|
||||
|
||||
width: parent.width
|
||||
text: Emoji.emojify(Functions.getSimpleMessageText(display), font.pixelSize)
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: chatPage.myUserId === display.sender_user_id ? Theme.highlightColor : Theme.primaryColor
|
||||
color: (chatPage.myUserId === display.sender_user_id) ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.Wrap
|
||||
textFormat: Text.StyledText
|
||||
onLinkActivated: {
|
||||
|
@ -306,17 +355,12 @@ Page {
|
|||
}
|
||||
|
||||
Text {
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: (chatPage.myUserId === display.sender_user_id) ? 4 * Theme.horizontalPageMargin : Theme.horizontalPageMargin
|
||||
right: parent.right
|
||||
rightMargin: (chatPage.myUserId === display.sender_user_id) ? Theme.horizontalPageMargin : 4 * Theme.horizontalPageMargin
|
||||
}
|
||||
width: parent.width
|
||||
|
||||
id: messageDateText
|
||||
text: Functions.getDateTimeElapsed(display.date)
|
||||
font.pixelSize: Theme.fontSizeTiny
|
||||
color: chatPage.myUserId === display.sender_user_id ? Theme.secondaryHighlightColor : Theme.secondaryColor
|
||||
color: (chatPage.myUserId === display.sender_user_id) ? Theme.secondaryHighlightColor : Theme.secondaryColor
|
||||
horizontalAlignment: (chatPage.myUserId === display.sender_user_id) ? Text.AlignRight : Text.AlignLeft
|
||||
}
|
||||
|
||||
|
@ -324,6 +368,10 @@ Page {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
VerticalScrollDecorator {}
|
||||
}
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ QVariantMap TDLibWrapper::getUserInformation()
|
|||
|
||||
QVariantMap TDLibWrapper::getUserInformation(const QString &userId)
|
||||
{
|
||||
qDebug() << "[TDLibWrapper] Returning user information for ID " << userId;
|
||||
// qDebug() << "[TDLibWrapper] Returning user information for ID " << userId;
|
||||
return this->allUsers.value(userId).toMap();
|
||||
}
|
||||
|
||||
|
|
|
@ -130,6 +130,10 @@
|
|||
<source>%1 subscribers</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>You</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
|
|
|
@ -130,6 +130,10 @@
|
|||
<source>%1 subscribers</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>You</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
|
|
Loading…
Reference in a new issue