From 2f4665682729b4ca2d8de3aa096319c7c41d1c4c Mon Sep 17 00:00:00 2001 From: miruka Date: Tue, 17 Mar 2020 18:48:26 -0400 Subject: [PATCH] Add button in reduced room pane to go back to chat --- src/gui/Pages/Chat/RoomPane/RoomPane.qml | 33 ++++++++++++++----- .../thin/go-back-to-chat-from-main-pane.svg | 3 ++ .../thin/go-back-to-chat-from-room-pane.svg | 3 ++ 3 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 src/icons/thin/go-back-to-chat-from-main-pane.svg create mode 100644 src/icons/thin/go-back-to-chat-from-room-pane.svg diff --git a/src/gui/Pages/Chat/RoomPane/RoomPane.qml b/src/gui/Pages/Chat/RoomPane/RoomPane.qml index bf618118..7a7a9c14 100644 --- a/src/gui/Pages/Chat/RoomPane/RoomPane.qml +++ b/src/gui/Pages/Chat/RoomPane/RoomPane.qml @@ -14,24 +14,39 @@ MultiviewPane { buttonRepeater.model: [ - "members", "files", "notifications", "history", "settings" + "back", "members", "files", "notifications", "history", "settings" ] buttonRepeater.delegate: HButton { + visible: width > 0 + width: modelData === "back" && ! roomPane.collapse ? 0 : implicitWidth height: theme.baseElementsHeight + backgroundColor: "transparent" - icon.name: "room-view-" + modelData - toolTip.text: qsTr( - modelData.charAt(0).toUpperCase() + modelData.slice(1) - ) + icon.name: + modelData === "back" ? + "go-back-to-chat-from-room-pane" : "room-view-" + modelData + + toolTip.text: + modelData === "back" ? + qsTr("Go back to chat") : + qsTr(modelData.charAt(0).toUpperCase() + modelData.slice(1)) autoExclusive: true - checked: swipeView.currentIndex === 0 && index === 0 || - swipeView.currentIndex === 1 && index === 4 + checked: swipeView.currentIndex === 0 && index === 1 || + swipeView.currentIndex === 1 && index === 5 - enabled: ["members", "settings"].includes(modelData) + enabled: ["back", "members", "settings"].includes(modelData) - onClicked: swipeView.currentIndex = Math.min(index, 1) + onClicked: + modelData === "back" ? + roomPane.toggleFocus() : + swipeView.currentIndex = Math.min(index, 1) + + Behavior on width { + enabled: modelData === "back" + HNumberAnimation {} + } } diff --git a/src/icons/thin/go-back-to-chat-from-main-pane.svg b/src/icons/thin/go-back-to-chat-from-main-pane.svg new file mode 100644 index 00000000..a1663147 --- /dev/null +++ b/src/icons/thin/go-back-to-chat-from-main-pane.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/thin/go-back-to-chat-from-room-pane.svg b/src/icons/thin/go-back-to-chat-from-room-pane.svg new file mode 100644 index 00000000..ea3e93e9 --- /dev/null +++ b/src/icons/thin/go-back-to-chat-from-room-pane.svg @@ -0,0 +1,3 @@ + + +