moment/src/qml/Chat/Chat.qml

150 lines
4.3 KiB
QML
Raw Normal View History

2019-03-22 14:28:14 +11:00
import QtQuick 2.7
import QtQuick.Layouts 1.3
import "../Base"
import "Banners"
2019-07-03 12:29:09 +10:00
import "Timeline"
2019-05-13 03:17:42 +10:00
import "RoomSidePane"
2019-03-22 14:28:14 +11:00
2019-05-13 03:17:42 +10:00
HColumnLayout {
2019-04-22 00:44:04 +10:00
property string userId: ""
property string category: ""
2019-04-22 00:44:04 +10:00
property string roomId: ""
2019-03-22 14:28:14 +11:00
readonly property var roomInfo: models.rooms.getWhere(
{"userId": userId, "roomId": roomId, "category": category}, 1
)[0]
2019-04-15 06:12:07 +10:00
readonly property var sender:
models.users.getWhere({"userId": userId}, 1)[0]
readonly property bool hasUnknownDevices: false
//category == "Rooms" ?
//Backend.clients.get(userId).roomHasUnknownDevices(roomId) : false
id: chatPage
2019-03-22 14:28:14 +11:00
onFocusChanged: sendBox.setFocus()
//Component.onCompleted: Backend.signals.roomCategoryChanged.connect(
//function(forUserId, forRoomId, previous, now) {
//if (chatPage && forUserId == userId && forRoomId == roomId) {
//chatPage.category = now
//}
//}
//)
2019-05-13 03:17:42 +10:00
RoomHeader {
id: roomHeader
displayName: roomInfo.displayName
topic: roomInfo.topic || ""
Layout.fillWidth: true
Layout.preferredHeight: HStyle.avatar.size
2019-05-13 03:17:42 +10:00
}
2019-04-22 00:44:04 +10:00
2019-05-13 03:17:42 +10:00
HSplitView {
id: chatSplitView
2019-05-13 03:17:42 +10:00
Layout.fillWidth: true
Layout.fillHeight: true
HColumnLayout {
Layout.fillWidth: true
2019-04-22 00:44:04 +10:00
2019-07-03 12:29:09 +10:00
EventList {
2019-05-13 03:17:42 +10:00
Layout.fillWidth: true
Layout.fillHeight: true
}
//TypingMembersBar {}
// InviteBanner {
//visible: category === "Invites"
//inviter: roomInfo.inviter
//}
//UnknownDevicesBanner {
//visible: category == "Rooms" && hasUnknownDevices
//}
2019-05-13 03:17:42 +10:00
SendBox {
id: sendBox
visible: category == "Rooms" && ! hasUnknownDevices
}
//LeftBanner {
//visible: category === "Left"
//leftEvent: roomInfo.leftEvent
//}
//}
// RoomSidePane {
//id: roomSidePane
//activeView: roomHeader.activeButton
//property int oldWidth: width
//onActiveViewChanged:
//activeView ? restoreAnimation.start() : hideAnimation.start()
//NumberAnimation {
//id: hideAnimation
//target: roomSidePane
//properties: "width"
//duration: HStyle.animationDuration
//from: target.width
//to: 0
//onStarted: {
//target.oldWidth = target.width
//target.Layout.minimumWidth = 0
//}
//}
//NumberAnimation {
//id: restoreAnimation
//target: roomSidePane
//properties: "width"
//duration: HStyle.animationDuration
//from: 0
//to: target.oldWidth
//onStopped: target.Layout.minimumWidth = Qt.binding(
//function() { return HStyle.avatar.size }
//)
//}
//collapsed: width < HStyle.avatar.size + 8
//property bool wasSnapped: false
//property int referenceWidth: roomHeader.buttonsWidth
//onReferenceWidthChanged: {
//if (chatSplitView.canAutoSize || wasSnapped) {
//if (wasSnapped) { chatSplitView.canAutoSize = true }
//width = referenceWidth
//}
//}
//property int currentWidth: width
//onCurrentWidthChanged: {
//if (referenceWidth != width &&
//referenceWidth - 15 < width &&
//width < referenceWidth + 15)
//{
//currentWidth = referenceWidth
//width = referenceWidth
//wasSnapped = true
//currentWidth = Qt.binding(
//function() { return roomSidePane.width }
//)
//} else {
//wasSnapped = false
//}
//}
//width: referenceWidth // Initial width
//Layout.minimumWidth: HStyle.avatar.size
//Layout.maximumWidth: parent.width
//}
}
2019-04-22 00:44:04 +10:00
}
2019-03-22 14:28:14 +11:00
}