moment/src/gui/Pages/Chat/Composer/Composer.qml

72 lines
2.0 KiB
QML
Raw Normal View History

// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
import QtQuick.Layouts 1.12
import "../../../Base"
Rectangle {
property alias eventList: messageArea.eventList
readonly property bool hasFocus: messageArea.activeFocus
function takeFocus() { messageArea.forceActiveFocus() }
2020-08-20 12:21:47 -04:00
implicitHeight: Math.max(theme.baseElementsHeight, column.implicitHeight)
color: theme.chat.composer.background
2020-08-20 12:21:47 -04:00
HColumnLayout {
id: column
anchors.fill: parent
2020-08-20 12:21:47 -04:00
UserAutoCompletion {
id: userCompletion
textArea: messageArea
2020-08-20 12:21:47 -04:00
Layout.fillWidth: true
Layout.maximumHeight: chat.height / 3
}
2020-08-20 12:21:47 -04:00
HRowLayout {
HUserAvatar {
id: avatar
radius: 0
userId: messageArea.writingUserId
2020-08-20 12:21:47 -04:00
mxc:
messageArea.writingUserInfo ?
messageArea.writingUserInfo.avatar_url :
""
displayName:
messageArea.writingUserInfo ?
messageArea.writingUserInfo.display_name :
""
}
HScrollView {
Layout.fillHeight: true
Layout.fillWidth: true
MessageArea {
id: messageArea
autoCompletionOpen: userCompletion.open
2020-08-21 01:17:29 -04:00
usersCompleted: userCompletion.usersCompleted
2020-08-20 12:21:47 -04:00
onAutoCompletePrevious: userCompletion.previous()
onAutoCompleteNext: userCompletion.next()
onCancelAutoCompletion: userCompletion.cancel()
onAcceptAutoCompletion:
2020-08-20 12:21:47 -04:00
! userCompletion.autoOpen ||
userCompletion.autoOpenCompleted ?
2020-08-21 01:17:29 -04:00
userCompletion.accept() :
2020-08-20 12:21:47 -04:00
null
}
}
2020-08-20 12:21:47 -04:00
UploadButton {
Layout.fillHeight: true
}
}
}
}