Mobile message input (#962)

* swap send and sticker icons based on text input

* collapse MessageInput options when window is narrow

* buttons disappear once you type/send partial text from input method
This commit is contained in:
Malte E 2022-03-05 23:10:08 +01:00 committed by GitHub
parent 12a6da012a
commit ab05e2d8dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -18,6 +18,8 @@ Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: row.implicitHeight Layout.preferredHeight: row.implicitHeight
Layout.minimumHeight: 40 Layout.minimumHeight: 40
property bool showAllButtons: width > 450 || (messageInput.length == 0 && !messageInput.inputMethodComposing)
Component { Component {
id: placeCallDialog id: placeCallDialog
@ -35,7 +37,7 @@ Rectangle {
spacing: 0 spacing: 0
ImageButton { ImageButton {
visible: CallManager.callsSupported visible: CallManager.callsSupported && showAllButtons
opacity: CallManager.haveCallInvite ? 0.3 : 1 opacity: CallManager.haveCallInvite ? 0.3 : 1
Layout.alignment: Qt.AlignBottom Layout.alignment: Qt.AlignBottom
hoverEnabled: true hoverEnabled: true
@ -61,6 +63,7 @@ Rectangle {
} }
ImageButton { ImageButton {
visible: showAllButtons
Layout.alignment: Qt.AlignBottom Layout.alignment: Qt.AlignBottom
hoverEnabled: true hoverEnabled: true
width: 22 width: 22
@ -134,6 +137,7 @@ Rectangle {
padding: 0 padding: 0
topPadding: 8 topPadding: 8
bottomPadding: 8 bottomPadding: 8
leftPadding: inputBar.showAllButtons? 0 : 8
focus: true focus: true
onTextChanged: { onTextChanged: {
if (room) if (room)
@ -387,6 +391,7 @@ Rectangle {
ImageButton { ImageButton {
id: stickerButton id: stickerButton
visible: showAllButtons
Layout.alignment: Qt.AlignRight | Qt.AlignBottom Layout.alignment: Qt.AlignRight | Qt.AlignBottom
Layout.margins: 8 Layout.margins: 8
@ -437,6 +442,7 @@ Rectangle {
ToolTip.visible: hovered ToolTip.visible: hovered
ToolTip.text: qsTr("Send") ToolTip.text: qsTr("Send")
onClicked: { onClicked: {
messageInput.append(messageInput.preeditText)
room.input.send(); room.input.send();
} }
} }