2019-12-19 22:46:16 +11:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-12-09 20:25:31 +11:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
2019-12-18 19:53:08 +11:00
|
|
|
import "../../Base"
|
2020-08-21 19:39:46 +10:00
|
|
|
import "AutoCompletion"
|
2019-12-09 20:25:31 +11:00
|
|
|
import "Banners"
|
2020-05-30 06:22:53 +10:00
|
|
|
import "Composer"
|
2019-12-09 20:25:31 +11:00
|
|
|
import "FileTransfer"
|
2020-05-30 06:22:53 +10:00
|
|
|
import "Timeline"
|
2019-12-09 20:25:31 +11:00
|
|
|
|
2020-03-12 01:45:47 +11:00
|
|
|
HColumnPage {
|
2019-12-09 20:25:31 +11:00
|
|
|
id: chatPage
|
2020-03-18 05:48:03 +11:00
|
|
|
|
|
|
|
property bool loadedOnce: false
|
2020-04-17 06:08:35 +10:00
|
|
|
property var loadMembersFuture: null
|
2019-12-10 05:13:38 +11:00
|
|
|
|
|
|
|
readonly property alias composer: composer
|
2020-03-18 05:48:03 +11:00
|
|
|
readonly property bool loadEventList:
|
|
|
|
mainUI.mainPane.collapse ?
|
|
|
|
! mainUI.mainPane.visible : ! pageLoader.appearAnimation.running
|
2019-12-10 05:13:38 +11:00
|
|
|
|
2019-12-09 20:25:31 +11:00
|
|
|
|
2020-07-12 14:25:57 +10:00
|
|
|
padding: 0
|
|
|
|
column.spacing: 0
|
|
|
|
|
|
|
|
onLoadEventListChanged: if (loadEventList) loadedOnce = true
|
|
|
|
Component.onDestruction: if (loadMembersFuture) loadMembersFuture.cancel()
|
|
|
|
|
2020-04-17 06:08:35 +10:00
|
|
|
Timer {
|
|
|
|
interval: 200
|
|
|
|
running: true
|
|
|
|
onTriggered: loadMembersFuture = py.callClientCoro(
|
|
|
|
chat.userId,
|
|
|
|
"load_all_room_members",
|
|
|
|
[chat.roomId],
|
|
|
|
() => { loadMembersFuture = null },
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2019-12-09 20:25:31 +11:00
|
|
|
RoomHeader {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
2020-03-12 03:53:55 +11:00
|
|
|
HLoader {
|
|
|
|
id: eventListLoader
|
|
|
|
opacity: loadEventList ? 1 : 0
|
2020-03-18 05:48:03 +11:00
|
|
|
sourceComponent:
|
|
|
|
loadedOnce || loadEventList ? evListComponent : placeholder
|
2019-12-09 20:25:31 +11:00
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2020-03-12 03:53:55 +11:00
|
|
|
|
|
|
|
Behavior on opacity { HNumberAnimation {} }
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: placeholder
|
|
|
|
Item {}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: evListComponent
|
|
|
|
EventList {}
|
|
|
|
}
|
2019-12-09 20:25:31 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
TypingMembersBar {
|
2020-05-20 18:45:30 +10:00
|
|
|
typingMembers: JSON.parse(chat.roomInfo.typing_members)
|
2020-05-20 19:19:06 +10:00
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
|
|
|
ReplyBar {
|
2020-05-20 20:17:14 +10:00
|
|
|
replyToEventId: chat.replyToEventId
|
2020-05-20 19:19:06 +10:00
|
|
|
replyToUserId: chat.replyToUserId
|
|
|
|
replyToDisplayName: chat.replyToDisplayName
|
|
|
|
onCancel: {
|
2020-05-20 20:17:14 +10:00
|
|
|
chat.replyToEventId = ""
|
2020-05-20 19:19:06 +10:00
|
|
|
chat.replyToUserId = ""
|
|
|
|
chat.replyToDisplayName = ""
|
|
|
|
}
|
|
|
|
|
2019-12-09 20:25:31 +11:00
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
|
|
|
TransferList {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.minimumHeight: implicitHeight
|
|
|
|
Layout.preferredHeight: implicitHeight * transferCount
|
|
|
|
Layout.maximumHeight: chatPage.height / 6
|
|
|
|
|
|
|
|
Behavior on Layout.preferredHeight { HNumberAnimation {} }
|
|
|
|
}
|
|
|
|
|
2020-08-21 19:39:46 +10:00
|
|
|
UserAutoCompletion {
|
|
|
|
id: userCompletion
|
|
|
|
textArea: composer.messageArea
|
2020-08-22 00:19:29 +10:00
|
|
|
clip: true
|
2020-08-21 19:39:46 +10:00
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.maximumHeight: chatPage.height / 4
|
|
|
|
}
|
|
|
|
|
2019-12-09 20:25:31 +11:00
|
|
|
InviteBanner {
|
|
|
|
id: inviteBanner
|
|
|
|
visible: ! chat.roomInfo.left && inviterId
|
|
|
|
inviterId: chat.roomInfo.inviter_id
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
2019-12-13 01:33:52 +11:00
|
|
|
LeftBanner {
|
|
|
|
id: leftBanner
|
|
|
|
visible: chat.roomInfo.left
|
2020-05-30 06:22:53 +10:00
|
|
|
|
2019-12-13 01:33:52 +11:00
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
2019-12-09 20:25:31 +11:00
|
|
|
Composer {
|
|
|
|
id: composer
|
2020-08-21 19:39:46 +10:00
|
|
|
userCompletion: userCompletion
|
2020-03-27 12:23:43 +11:00
|
|
|
eventList: loadEventList ? eventListLoader.item.eventList : null
|
2020-08-21 19:39:46 +10:00
|
|
|
visible: ! chat.roomInfo.left && ! chat.roomInfo.inviter_id
|
2019-12-09 20:25:31 +11:00
|
|
|
|
2020-05-30 06:22:53 +10:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.maximumHeight: parent.height / 2
|
|
|
|
}
|
2019-12-09 20:25:31 +11:00
|
|
|
}
|