2020-10-08 22:11:21 +03:00
|
|
|
import "./delegates"
|
|
|
|
import "./device-verification"
|
|
|
|
import "./emoji"
|
2020-12-17 19:25:32 +03:00
|
|
|
import "./voip"
|
2020-10-08 22:11:21 +03:00
|
|
|
import QtGraphicalEffects 1.0
|
2021-01-12 17:03:39 +03:00
|
|
|
import QtQuick 2.9
|
2020-02-02 02:27:28 +03:00
|
|
|
import QtQuick.Controls 2.3
|
2021-01-12 17:03:39 +03:00
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
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 {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-01-12 22:22:52 +03:00
|
|
|
Component {
|
|
|
|
id: mobileCallInviteDialog
|
|
|
|
|
|
|
|
CallInvite {
|
|
|
|
}
|
2021-01-17 06:05:02 +03:00
|
|
|
|
2021-01-12 22:22:52 +03:00
|
|
|
}
|
|
|
|
|
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")
|
2020-11-16 20:41:29 +03:00
|
|
|
onClicked: emojiPopup.show(messageContextMenu.parent, function(emoji) {
|
|
|
|
TimelineManager.queueReactionMessage(messageContextMenu.eventId, emoji);
|
|
|
|
})
|
2020-10-08 22:11:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
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 {
|
2020-11-25 19:38:06 +03:00
|
|
|
// TODO(Nico): Fix this still being iterated over, when using keyboard to select options
|
2020-10-08 22:11:21 +03:00
|
|
|
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 {
|
2020-11-26 11:50:37 +03:00
|
|
|
text: qsTr("Remove 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)
|
|
|
|
}
|
2021-01-24 03:29:30 +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("Open in external program")
|
|
|
|
onTriggered: TimelineManager.timeline.openMedia(messageContextMenu.eventId)
|
|
|
|
}
|
2020-10-08 22:11:21 +03:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
|
|
|
color: colors.window
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: deviceVerificationDialog
|
|
|
|
|
|
|
|
DeviceVerification {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
2020-11-15 00:38:17 +03:00
|
|
|
target: TimelineManager
|
|
|
|
onNewDeviceVerificationRequest: {
|
2020-10-08 22:11:21 +03:00
|
|
|
var dialog = deviceVerificationDialog.createObject(timelineRoot, {
|
|
|
|
"flow": flow
|
|
|
|
});
|
|
|
|
dialog.show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
2020-11-15 00:38:17 +03:00
|
|
|
target: TimelineManager.timeline
|
|
|
|
onOpenProfile: {
|
2020-10-08 22:11:21 +03:00
|
|
|
var userProfile = userProfileComponent.createObject(timelineRoot, {
|
|
|
|
"profile": profile
|
|
|
|
});
|
|
|
|
userProfile.show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-12 22:22:52 +03:00
|
|
|
Connections {
|
|
|
|
target: CallManager
|
|
|
|
onNewInviteState: {
|
|
|
|
if (CallManager.haveCallInvite && Settings.mobileMode) {
|
|
|
|
var dialog = mobileCallInviteDialog.createObject(msgView);
|
|
|
|
dialog.open();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-08 22:11:21 +03:00
|
|
|
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 {
|
2021-01-12 22:22:52 +03:00
|
|
|
id: msgView
|
2021-01-17 06:05:02 +03:00
|
|
|
|
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
|
2020-11-15 06:52:49 +03:00
|
|
|
|
2020-10-27 22:29:53 +03:00
|
|
|
currentIndex: 0
|
2020-10-08 22:11:21 +03:00
|
|
|
|
2020-10-27 22:29:53 +03:00
|
|
|
Connections {
|
|
|
|
function onActiveTimelineChanged() {
|
|
|
|
stackLayout.currentIndex = 0;
|
2020-10-08 22:11:21 +03:00
|
|
|
}
|
2020-11-15 06:52:49 +03:00
|
|
|
|
|
|
|
target: TimelineManager
|
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 {
|
2020-12-17 19:25:32 +03:00
|
|
|
source: CallManager.isOnCall && CallManager.isVideo ? "voip/VideoCall.qml" : ""
|
2020-10-27 22:29:53 +03:00
|
|
|
onLoaded: TimelineManager.setVideoCallItem()
|
2020-10-27 20:14:06 +03:00
|
|
|
}
|
2020-11-15 06:52:49 +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
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-12-17 19:25:32 +03:00
|
|
|
CallInviteBar {
|
|
|
|
id: callInviteBar
|
2021-01-12 01:51:39 +03:00
|
|
|
|
2020-12-17 19:25:32 +03:00
|
|
|
Layout.fillWidth: true
|
|
|
|
z: 3
|
|
|
|
}
|
|
|
|
|
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-11-01 01:24:07 +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
|
|
|
}
|