Use enum instead of strings for message type
This commit is contained in:
committed by
Carl Schwan
parent
bba947e508
commit
92ec441594
@@ -14,64 +14,64 @@ DelegateChooser {
|
||||
role: "eventType"
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "state"
|
||||
roleValue: MessageEventModel.State
|
||||
delegate: StateDelegate {}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "emote"
|
||||
roleValue: MessageEventModel.Emote
|
||||
delegate: MessageDelegate {
|
||||
isEmote: true
|
||||
}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "message"
|
||||
roleValue: MessageEventModel.Message
|
||||
delegate: MessageDelegate {}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "notice"
|
||||
roleValue: MessageEventModel.Notice
|
||||
delegate: MessageDelegate {}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "image"
|
||||
roleValue: MessageEventModel.Image
|
||||
delegate: ImageDelegate {}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "sticker"
|
||||
roleValue: MessageEventModel.Sticker
|
||||
delegate: ImageDelegate {}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "audio"
|
||||
roleValue: MessageEventModel.Audio
|
||||
delegate: AudioDelegate {}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "video"
|
||||
roleValue: MessageEventModel.Video
|
||||
delegate: VideoDelegate {}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "file"
|
||||
roleValue: MessageEventModel.File
|
||||
delegate: FileDelegate {}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "encrypted"
|
||||
roleValue: MessageEventModel.Encrypted
|
||||
delegate: EncryptedDelegate {}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "readMarker"
|
||||
roleValue: MessageEventModel.ReadMarker
|
||||
delegate: ReadMarkerDelegate {}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "other"
|
||||
roleValue: MessageEventModel.Other
|
||||
delegate: Item {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,17 +65,17 @@ Item {
|
||||
|
||||
sourceComponent: {
|
||||
switch (reply.type) {
|
||||
case "image":
|
||||
case "sticker":
|
||||
case MessageEventModel.Image:
|
||||
case MessageEventModel.Sticker:
|
||||
return imageComponent;
|
||||
case "message":
|
||||
case "notice":
|
||||
case MessageEventModel.Message:
|
||||
case MessageEventModel.Notice:
|
||||
return textComponent;
|
||||
case "file":
|
||||
case "video":
|
||||
case "audio":
|
||||
case MessageEventModel.File:
|
||||
case MessageEventModel.Video:
|
||||
case MessageEventModel.Audio:
|
||||
return mimeComponent;
|
||||
case "encrypted":
|
||||
case MessageEventModel.Encrypted:
|
||||
return encryptedComponent;
|
||||
default:
|
||||
return textComponent;
|
||||
@@ -114,7 +114,7 @@ Item {
|
||||
MimeComponent {
|
||||
mimeIconSource: reply.content.info.mimetype.replace("/", "-")
|
||||
label: reply.display
|
||||
subLabel: reply.type === "file" ? Controller.formatByteSize(reply.content.info ? reply.content.info.size : 0) : Controller.formatDuration(reply.content.info.duration)
|
||||
subLabel: reply.type === MessageEventModel.File ? Controller.formatByteSize(reply.content.info ? reply.content.info.size : 0) : Controller.formatDuration(reply.content.info.duration)
|
||||
}
|
||||
}
|
||||
Component {
|
||||
|
||||
@@ -308,7 +308,7 @@ QQC2.ItemDelegate {
|
||||
}
|
||||
height: active ? item.implicitHeight : 0
|
||||
//Layout.bottomMargin: readMarker ? Kirigami.Units.smallSpacing : 0
|
||||
active: eventType !== "state" && eventType !== "notice" && reaction != undefined && reaction.length > 0
|
||||
active: eventType !== MessageEventModel.State && eventType !== MessageEventModel.Notice && reaction != undefined && reaction.length > 0
|
||||
visible: active
|
||||
sourceComponent: ReactionDelegate { }
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ Loader {
|
||||
currentRoom.chatBoxEditId = eventId;
|
||||
currentRoom.chatBoxReplyId = "";
|
||||
}
|
||||
visible: eventType.length > 0 && author.id === Controller.activeConnection.localUserId && (eventType === "emote" || eventType === "message")
|
||||
visible: eventType.length > 0 && author.id === Controller.activeConnection.localUserId && (eventType === MessageEventModel.Emote || eventType === MessageEventModel.Message)
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Reply")
|
||||
|
||||
@@ -420,7 +420,7 @@ Kirigami.ScrollablePage {
|
||||
id: hoverActions
|
||||
property var event: null
|
||||
property bool userMsg: event && event.author.id === Controller.activeConnection.localUserId
|
||||
property bool showEdit: event && (userMsg && (event.eventType === "emote" || event.eventType === "message"))
|
||||
property bool showEdit: event && (userMsg && (event.eventType === MessageEventType.Emote || event.eventType === MessageEventModel.Message))
|
||||
property var delegate: null
|
||||
property var bubble: null
|
||||
property var hovered: bubble && bubble.hovered
|
||||
|
||||
Reference in New Issue
Block a user