Display group chat message types and react to chat updates

This commit is contained in:
Richard Ramos 2020-06-10 11:14:12 -04:00 committed by Iuri Matias
parent 286bb14fb2
commit 8cca18d7f9
3 changed files with 29 additions and 3 deletions

View File

@ -125,3 +125,6 @@ QtObject:
proc updateChat*(self: ChatsView, chat: Chat) =
self.chats.updateChat(chat)
if(self.activeChannel.id == chat.id):
self.activeChannel.setChatItem(chat)
self.activeChannelChanged()

View File

@ -20,6 +20,9 @@ Item {
property string authorCurrentMsg: "authorCurrentMsg"
property string authorPrevMsg: "authorPrevMsg"
property bool isMessage: contentType == Constants.messageType || contentType == Constants.stickerType || contentType == Constants.emojiType
property bool isStatusMessage: contentType == Constants.systemMessagePrivateGroupType
width: parent.width
height: {
switch(contentType){
@ -97,6 +100,21 @@ Item {
}
}
// Private group Messages
Text {
wrapMode: Text.Wrap
text: message
visible: isStatusMessage
font.pixelSize: 16
color: Theme.darkGrey
width: parent.width - 120
horizontalAlignment: Text.AlignHCenter
anchors.horizontalCenter: parent.horizontalCenter
}
// Messages
Image {
id: chatImage
width: 36
@ -107,7 +125,7 @@ Item {
anchors.top: parent.top
fillMode: Image.PreserveAspectFit
source: identicon
visible: contentType > -1 && authorCurrentMsg != authorPrevMsg && !isCurrentUser
visible: isMessage && authorCurrentMsg != authorPrevMsg && !isCurrentUser
MouseArea {
cursorShape: Qt.PointingHandCursor
@ -130,7 +148,7 @@ Item {
readOnly: true
wrapMode: Text.WordWrap
selectByMouse: true
visible: contentType > -1 && authorCurrentMsg != authorPrevMsg && !isCurrentUser
visible: isMessage && authorCurrentMsg != authorPrevMsg && !isCurrentUser
}
Rectangle {
@ -149,7 +167,7 @@ Item {
anchors.rightMargin: !isCurrentUser ? 0 : Theme.padding
anchors.top: authorCurrentMsg != authorPrevMsg && !isCurrentUser ? chatImage.top : parent.top
anchors.topMargin: 0
visible: contentType > -1
visible: isMessage
// Thi`s rectangle's only job is to mask the corner to make it less rounded... yep
Rectangle {

View File

@ -8,8 +8,13 @@ QtObject {
readonly property int chatTypePrivateGroupChat: 3
readonly property int chatIdentifier: -1
readonly property int unknownContentType: 0
readonly property int messageType: 1
readonly property int stickerType: 2
readonly property int statusType: 3
readonly property int emojiType: 4
readonly property int transactionType: 5
readonly property int systemMessagePrivateGroupType: 6
readonly property var accountColors: [
"#9B832F",