Display group chat message types and react to chat updates
This commit is contained in:
parent
286bb14fb2
commit
8cca18d7f9
|
@ -125,3 +125,6 @@ QtObject:
|
||||||
|
|
||||||
proc updateChat*(self: ChatsView, chat: Chat) =
|
proc updateChat*(self: ChatsView, chat: Chat) =
|
||||||
self.chats.updateChat(chat)
|
self.chats.updateChat(chat)
|
||||||
|
if(self.activeChannel.id == chat.id):
|
||||||
|
self.activeChannel.setChatItem(chat)
|
||||||
|
self.activeChannelChanged()
|
||||||
|
|
|
@ -20,6 +20,9 @@ Item {
|
||||||
property string authorCurrentMsg: "authorCurrentMsg"
|
property string authorCurrentMsg: "authorCurrentMsg"
|
||||||
property string authorPrevMsg: "authorPrevMsg"
|
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
|
width: parent.width
|
||||||
height: {
|
height: {
|
||||||
switch(contentType){
|
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 {
|
Image {
|
||||||
id: chatImage
|
id: chatImage
|
||||||
width: 36
|
width: 36
|
||||||
|
@ -107,7 +125,7 @@ Item {
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
source: identicon
|
source: identicon
|
||||||
visible: contentType > -1 && authorCurrentMsg != authorPrevMsg && !isCurrentUser
|
visible: isMessage && authorCurrentMsg != authorPrevMsg && !isCurrentUser
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
@ -130,7 +148,7 @@ Item {
|
||||||
readOnly: true
|
readOnly: true
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
visible: contentType > -1 && authorCurrentMsg != authorPrevMsg && !isCurrentUser
|
visible: isMessage && authorCurrentMsg != authorPrevMsg && !isCurrentUser
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -149,7 +167,7 @@ Item {
|
||||||
anchors.rightMargin: !isCurrentUser ? 0 : Theme.padding
|
anchors.rightMargin: !isCurrentUser ? 0 : Theme.padding
|
||||||
anchors.top: authorCurrentMsg != authorPrevMsg && !isCurrentUser ? chatImage.top : parent.top
|
anchors.top: authorCurrentMsg != authorPrevMsg && !isCurrentUser ? chatImage.top : parent.top
|
||||||
anchors.topMargin: 0
|
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
|
// Thi`s rectangle's only job is to mask the corner to make it less rounded... yep
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
@ -8,8 +8,13 @@ QtObject {
|
||||||
readonly property int chatTypePrivateGroupChat: 3
|
readonly property int chatTypePrivateGroupChat: 3
|
||||||
|
|
||||||
readonly property int chatIdentifier: -1
|
readonly property int chatIdentifier: -1
|
||||||
|
readonly property int unknownContentType: 0
|
||||||
readonly property int messageType: 1
|
readonly property int messageType: 1
|
||||||
readonly property int stickerType: 2
|
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: [
|
readonly property var accountColors: [
|
||||||
"#9B832F",
|
"#9B832F",
|
||||||
|
|
Loading…
Reference in New Issue