2019-10-20 13:39:47 +03:00
|
|
|
import QtQuick 2.6
|
2019-11-30 03:43:39 +03:00
|
|
|
import im.nheko 1.0
|
2019-10-20 13:39:47 +03:00
|
|
|
|
2020-01-11 16:07:51 +03:00
|
|
|
Item {
|
|
|
|
// Workaround to have an assignable global property
|
|
|
|
Item {
|
|
|
|
id: model
|
|
|
|
property var data;
|
2020-05-13 02:09:40 +03:00
|
|
|
property bool isReply: false
|
2019-10-20 13:39:47 +03:00
|
|
|
}
|
2020-01-11 16:07:51 +03:00
|
|
|
|
|
|
|
property alias modelData: model.data
|
2020-05-13 02:09:40 +03:00
|
|
|
property alias isReply: model.isReply
|
2020-01-11 16:07:51 +03:00
|
|
|
|
|
|
|
height: chooser.childrenRect.height
|
2020-04-09 01:07:04 +03:00
|
|
|
property real implicitWidth: (chooser.child && chooser.child.implicitWidth) ? chooser.child.implicitWidth : width
|
2020-01-11 16:07:51 +03:00
|
|
|
|
|
|
|
DelegateChooser {
|
|
|
|
id: chooser
|
|
|
|
//role: "type" //< not supported in our custom implementation, have to use roleValue
|
|
|
|
roleValue: model.data.type
|
|
|
|
anchors.fill: parent
|
|
|
|
|
2020-01-11 20:53:32 +03:00
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.UnknownMessage
|
|
|
|
Placeholder { text: "Unretrieved event" }
|
|
|
|
}
|
2020-01-11 16:07:51 +03:00
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.TextMessage
|
|
|
|
TextMessage {}
|
2019-11-22 19:08:32 +03:00
|
|
|
}
|
2020-01-11 16:07:51 +03:00
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.NoticeMessage
|
|
|
|
NoticeMessage {}
|
2019-11-22 19:08:32 +03:00
|
|
|
}
|
2020-01-11 16:07:51 +03:00
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.EmoteMessage
|
2020-02-09 03:24:24 +03:00
|
|
|
NoticeMessage {
|
2020-09-24 22:36:43 +03:00
|
|
|
formatted: TimelineManager.escapeEmoji(modelData.userName) + " " + model.data.formattedBody
|
2020-06-24 17:24:22 +03:00
|
|
|
color: TimelineManager.userColor(modelData.userId, colors.window)
|
2020-02-09 03:24:24 +03:00
|
|
|
}
|
2019-12-10 16:46:52 +03:00
|
|
|
}
|
2020-01-11 16:07:51 +03:00
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.ImageMessage
|
|
|
|
ImageMessage {}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.Sticker
|
|
|
|
ImageMessage {}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.FileMessage
|
|
|
|
FileMessage {}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.VideoMessage
|
|
|
|
PlayableMediaMessage {}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.AudioMessage
|
|
|
|
PlayableMediaMessage {}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.Redacted
|
|
|
|
Pill {
|
|
|
|
text: qsTr("redacted")
|
|
|
|
}
|
|
|
|
}
|
2020-07-13 01:08:58 +03:00
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.Redaction
|
|
|
|
Pill {
|
|
|
|
text: qsTr("redacted")
|
|
|
|
}
|
|
|
|
}
|
2020-01-11 16:07:51 +03:00
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.Encryption
|
|
|
|
Pill {
|
|
|
|
text: qsTr("Encryption enabled")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.Name
|
|
|
|
NoticeMessage {
|
2020-02-09 03:24:24 +03:00
|
|
|
text: model.data.roomName ? qsTr("room name changed to: %1").arg(model.data.roomName) : qsTr("removed room name")
|
2020-01-11 16:07:51 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.Topic
|
|
|
|
NoticeMessage {
|
2020-02-09 03:24:24 +03:00
|
|
|
text: model.data.roomTopic ? qsTr("topic changed to: %1").arg(model.data.roomTopic) : qsTr("removed topic")
|
2020-01-11 16:07:51 +03:00
|
|
|
}
|
|
|
|
}
|
2020-02-29 03:27:51 +03:00
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.RoomCreate
|
|
|
|
NoticeMessage {
|
|
|
|
text: qsTr("%1 created and configured room: %2").arg(model.data.userName).arg(model.data.roomId)
|
|
|
|
}
|
|
|
|
}
|
2020-07-11 02:19:48 +03:00
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.CallInvite
|
|
|
|
NoticeMessage {
|
2020-09-19 16:32:33 +03:00
|
|
|
text: switch(model.data.callType) {
|
|
|
|
case "voice": return qsTr("%1 placed a voice call.").arg(model.data.userName)
|
|
|
|
case "video": return qsTr("%1 placed a video call.").arg(model.data.userName)
|
|
|
|
default: return qsTr("%1 placed a call.").arg(model.data.userName)
|
|
|
|
}
|
2020-07-11 02:19:48 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.CallAnswer
|
|
|
|
NoticeMessage {
|
|
|
|
text: qsTr("%1 answered the call.").arg(model.data.userName)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.CallHangUp
|
|
|
|
NoticeMessage {
|
|
|
|
text: qsTr("%1 ended the call.").arg(model.data.userName)
|
|
|
|
}
|
|
|
|
}
|
2020-08-18 00:30:36 +03:00
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.CallCandidates
|
|
|
|
NoticeMessage {
|
|
|
|
text: qsTr("Negotiating call...")
|
|
|
|
}
|
|
|
|
}
|
2020-02-29 03:27:51 +03:00
|
|
|
DelegateChoice {
|
|
|
|
// TODO: make a more complex formatter for the power levels.
|
|
|
|
roleValue: MtxEvent.PowerLevels
|
|
|
|
NoticeMessage {
|
2020-06-24 17:24:22 +03:00
|
|
|
text: TimelineManager.timeline.formatPowerLevelEvent(model.data.id)
|
2020-02-29 03:27:51 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.RoomJoinRules
|
|
|
|
NoticeMessage {
|
2020-06-24 17:24:22 +03:00
|
|
|
text: TimelineManager.timeline.formatJoinRuleEvent(model.data.id)
|
2020-02-29 03:27:51 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.RoomHistoryVisibility
|
|
|
|
NoticeMessage {
|
2020-06-24 17:24:22 +03:00
|
|
|
text: TimelineManager.timeline.formatHistoryVisibilityEvent(model.data.id)
|
2020-02-29 03:27:51 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.RoomGuestAccess
|
|
|
|
NoticeMessage {
|
2020-06-24 17:24:22 +03:00
|
|
|
text: TimelineManager.timeline.formatGuestAccessEvent(model.data.id)
|
2020-02-29 03:27:51 +03:00
|
|
|
}
|
|
|
|
}
|
2020-01-23 22:34:04 +03:00
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.Member
|
|
|
|
NoticeMessage {
|
2020-06-24 17:24:22 +03:00
|
|
|
text: TimelineManager.timeline.formatMemberEvent(model.data.id);
|
2020-01-23 22:34:04 +03:00
|
|
|
}
|
|
|
|
}
|
2020-07-17 23:16:30 +03:00
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.KeyVerificationRequest
|
|
|
|
NoticeMessage {
|
|
|
|
text: "KeyVerificationRequest";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.KeyVerificationStart
|
|
|
|
NoticeMessage {
|
|
|
|
text: "KeyVerificationStart";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.KeyVerificationReady
|
|
|
|
NoticeMessage {
|
|
|
|
text: "KeyVerificationReady";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.KeyVerificationCancel
|
|
|
|
NoticeMessage {
|
|
|
|
text: "KeyVerificationCancel";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.KeyVerificationKey
|
|
|
|
NoticeMessage {
|
|
|
|
text: "KeyVerificationKey";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.KeyVerificationMac
|
|
|
|
NoticeMessage {
|
|
|
|
text: "KeyVerificationMac";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.KeyVerificationDone
|
|
|
|
NoticeMessage {
|
|
|
|
text: "KeyVerificationDone";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.KeyVerificationDone
|
|
|
|
NoticeMessage {
|
|
|
|
text: "KeyVerificationDone";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: MtxEvent.KeyVerificationAccept
|
|
|
|
NoticeMessage {
|
|
|
|
text: "KeyVerificationAccept";
|
|
|
|
}
|
|
|
|
}
|
2020-01-11 16:07:51 +03:00
|
|
|
DelegateChoice {
|
|
|
|
Placeholder {}
|
2019-12-10 16:46:52 +03:00
|
|
|
}
|
2019-10-20 13:39:47 +03:00
|
|
|
}
|
|
|
|
}
|