2020-10-08 22:11:21 +03:00
|
|
|
import "./delegates"
|
|
|
|
import "./device-verification"
|
|
|
|
import "./emoji"
|
|
|
|
import QtGraphicalEffects 1.0
|
2019-12-08 02:54:28 +03:00
|
|
|
import QtQuick 2.9
|
2020-02-02 02:27:28 +03:00
|
|
|
import QtQuick.Controls 2.3
|
2020-10-27 20:14:06 +03:00
|
|
|
import QtQuick.Layouts 1.3
|
2019-09-18 21:34:30 +03:00
|
|
|
import QtQuick.Window 2.2
|
2019-11-30 03:43:39 +03:00
|
|
|
import im.nheko 1.0
|
2020-05-14 03:19:15 +03:00
|
|
|
import im.nheko.EmojiModel 1.0
|
2019-09-03 00:28:05 +03:00
|
|
|
|
2020-03-28 21:12:00 +03:00
|
|
|
Page {
|
2020-10-08 22:11:21 +03:00
|
|
|
id: timelineRoot
|
|
|
|
|
|
|
|
property var colors: currentActivePalette
|
|
|
|
property var systemInactive
|
|
|
|
property var inactiveColors: currentInactivePalette ? currentInactivePalette : systemInactive
|
|
|
|
property int avatarSize: 40
|
|
|
|
property real highlightHue: colors.highlight.hslHue
|
|
|
|
property real highlightSat: colors.highlight.hslSaturation
|
|
|
|
property real highlightLight: colors.highlight.hslLightness
|
|
|
|
|
|
|
|
palette: colors
|
|
|
|
|
|
|
|
FontMetrics {
|
|
|
|
id: fontMetrics
|
|
|
|
}
|
|
|
|
|
|
|
|
EmojiPicker {
|
|
|
|
id: emojiPopup
|
|
|
|
|
|
|
|
width: 7 * 52 + 20
|
|
|
|
height: 6 * 52
|
|
|
|
colors: palette
|
|
|
|
|
|
|
|
model: EmojiProxyModel {
|
|
|
|
category: EmojiCategory.People
|
|
|
|
|
|
|
|
sourceModel: EmojiModel {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-10-26 16:57:54 +03:00
|
|
|
Component {
|
|
|
|
id: userProfileComponent
|
|
|
|
|
|
|
|
UserProfile {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-10-08 22:11:21 +03:00
|
|
|
Menu {
|
|
|
|
id: messageContextMenu
|
|
|
|
|
|
|
|
property string eventId
|
|
|
|
property int eventType
|
|
|
|
property bool isEncrypted
|
|
|
|
|
|
|
|
function show(eventId_, eventType_, isEncrypted_, showAt_, position) {
|
|
|
|
eventId = eventId_;
|
|
|
|
eventType = eventType_;
|
|
|
|
isEncrypted = isEncrypted_;
|
|
|
|
if (position)
|
|
|
|
popup(position, showAt_);
|
|
|
|
else
|
|
|
|
popup(showAt_);
|
|
|
|
}
|
|
|
|
|
|
|
|
modal: true
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("React")
|
|
|
|
onClicked: emojiPopup.show(messageContextMenu.parent, messageContextMenu.eventId)
|
|
|
|
}
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Reply")
|
2020-10-26 23:44:31 +03:00
|
|
|
onClicked: TimelineManager.timeline.replyAction(messageContextMenu.eventId)
|
2020-10-08 22:11:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Read receipts")
|
2020-10-26 23:44:31 +03:00
|
|
|
onTriggered: TimelineManager.timeline.readReceiptsAction(messageContextMenu.eventId)
|
2020-10-08 22:11:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Mark as read")
|
|
|
|
}
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("View raw message")
|
2020-10-26 23:44:31 +03:00
|
|
|
onTriggered: TimelineManager.timeline.viewRawMessage(messageContextMenu.eventId)
|
2020-10-08 22:11:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
visible: messageContextMenu.isEncrypted
|
|
|
|
height: visible ? implicitHeight : 0
|
|
|
|
text: qsTr("View decrypted raw message")
|
2020-10-26 23:44:31 +03:00
|
|
|
onTriggered: TimelineManager.timeline.viewDecryptedRawMessage(messageContextMenu.eventId)
|
2020-10-08 22:11:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Redact message")
|
2020-10-26 23:44:31 +03:00
|
|
|
onTriggered: TimelineManager.timeline.redactEvent(messageContextMenu.eventId)
|
2020-10-08 22:11:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
visible: messageContextMenu.eventType == MtxEvent.ImageMessage || messageContextMenu.eventType == MtxEvent.VideoMessage || messageContextMenu.eventType == MtxEvent.AudioMessage || messageContextMenu.eventType == MtxEvent.FileMessage || messageContextMenu.eventType == MtxEvent.Sticker
|
|
|
|
height: visible ? implicitHeight : 0
|
|
|
|
text: qsTr("Save as")
|
|
|
|
onTriggered: TimelineManager.timeline.saveMedia(messageContextMenu.eventId)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
|
|
|
color: colors.window
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: deviceVerificationDialog
|
|
|
|
|
|
|
|
DeviceVerification {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
function onNewDeviceVerificationRequest(flow, transactionId, userId, deviceId, isRequest) {
|
|
|
|
var dialog = deviceVerificationDialog.createObject(timelineRoot, {
|
|
|
|
"flow": flow
|
|
|
|
});
|
|
|
|
dialog.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
target: TimelineManager
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
function onOpenProfile(profile) {
|
|
|
|
var userProfile = userProfileComponent.createObject(timelineRoot, {
|
|
|
|
"profile": profile
|
|
|
|
});
|
|
|
|
userProfile.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
target: TimelineManager.timeline
|
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
|
|
|
visible: !TimelineManager.timeline && !TimelineManager.isInitialSync
|
|
|
|
anchors.centerIn: parent
|
|
|
|
text: qsTr("No room open")
|
|
|
|
font.pointSize: 24
|
|
|
|
color: colors.text
|
|
|
|
}
|
|
|
|
|
|
|
|
BusyIndicator {
|
|
|
|
visible: running
|
|
|
|
anchors.centerIn: parent
|
|
|
|
running: TimelineManager.isInitialSync
|
|
|
|
height: 200
|
|
|
|
width: 200
|
|
|
|
z: 3
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
2020-10-18 23:30:42 +03:00
|
|
|
visible: TimelineManager.timeline != null
|
2020-10-08 22:11:21 +03:00
|
|
|
anchors.fill: parent
|
2020-10-26 15:50:44 +03:00
|
|
|
spacing: 0
|
2020-10-08 22:11:21 +03:00
|
|
|
|
2020-10-26 16:57:54 +03:00
|
|
|
TopBar {
|
2020-10-08 22:11:21 +03:00
|
|
|
}
|
|
|
|
|
2020-10-26 15:50:44 +03:00
|
|
|
Rectangle {
|
2020-10-08 22:11:21 +03:00
|
|
|
Layout.fillWidth: true
|
2020-10-26 15:50:44 +03:00
|
|
|
height: 1
|
2020-10-08 22:11:21 +03:00
|
|
|
z: 3
|
2020-10-26 15:50:44 +03:00
|
|
|
color: colors.mid
|
2020-10-08 22:11:21 +03:00
|
|
|
}
|
|
|
|
|
2020-10-26 15:50:44 +03:00
|
|
|
Rectangle {
|
2020-10-08 22:11:21 +03:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2020-10-26 15:50:44 +03:00
|
|
|
color: colors.base
|
2020-10-27 20:14:06 +03:00
|
|
|
|
2020-10-26 16:57:54 +03:00
|
|
|
ColumnLayout {
|
2020-10-26 15:50:44 +03:00
|
|
|
anchors.fill: parent
|
2020-10-26 16:57:54 +03:00
|
|
|
spacing: 0
|
2020-10-27 20:14:06 +03:00
|
|
|
|
2020-10-27 22:29:53 +03:00
|
|
|
StackLayout {
|
|
|
|
id: stackLayout
|
|
|
|
currentIndex: 0
|
2020-10-08 22:11:21 +03:00
|
|
|
|
2020-10-27 22:29:53 +03:00
|
|
|
Connections {
|
|
|
|
target: TimelineManager
|
|
|
|
function onActiveTimelineChanged() {
|
|
|
|
stackLayout.currentIndex = 0;
|
2020-10-08 22:11:21 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-27 22:29:53 +03:00
|
|
|
MessageView {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2020-10-08 22:11:21 +03:00
|
|
|
}
|
|
|
|
|
2020-10-27 22:29:53 +03:00
|
|
|
Loader {
|
|
|
|
source: TimelineManager.onVideoCall ? "VideoCall.qml" : ""
|
|
|
|
onLoaded: TimelineManager.setVideoCallItem()
|
2020-10-27 20:14:06 +03:00
|
|
|
}
|
2020-10-08 22:11:21 +03:00
|
|
|
}
|
|
|
|
|
2020-10-26 16:57:54 +03:00
|
|
|
TypingIndicator {
|
2020-10-27 20:14:06 +03:00
|
|
|
}
|
2020-10-08 22:11:21 +03:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ActiveCallBar {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
z: 3
|
|
|
|
}
|
|
|
|
|
2020-10-26 15:50:44 +03:00
|
|
|
Rectangle {
|
2020-10-08 22:11:21 +03:00
|
|
|
Layout.fillWidth: true
|
|
|
|
z: 3
|
2020-10-26 15:50:44 +03:00
|
|
|
height: 1
|
|
|
|
color: colors.mid
|
2020-10-08 22:11:21 +03:00
|
|
|
}
|
|
|
|
|
2020-10-26 16:57:54 +03:00
|
|
|
ReplyPopup {
|
|
|
|
}
|
2020-10-26 15:50:44 +03:00
|
|
|
|
2020-10-26 23:32:08 +03:00
|
|
|
//MessageInput {
|
|
|
|
//}
|
2020-10-26 15:50:44 +03:00
|
|
|
|
2020-10-08 22:11:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
systemInactive: SystemPalette {
|
|
|
|
colorGroup: SystemPalette.Disabled
|
|
|
|
}
|
|
|
|
|
2019-08-30 20:29:25 +03:00
|
|
|
}
|