Bring back main pane bottom bar

This commit is contained in:
miruka 2020-05-13 08:03:50 -04:00
parent fe18b725a5
commit c1dd06559c
4 changed files with 94 additions and 64 deletions

View File

@ -0,0 +1,88 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
import QtQuick.Layouts 1.12
import "../Base"
Rectangle {
// Hide filter field overflowing for a sec on size changes
clip: true
implicitHeight: theme.baseElementsHeight
color: theme.mainPane.bottomBar.background
property RoomList roomList
readonly property alias addAccountButton: addAccountButton
readonly property alias filterField: filterField
function toggleFocus() {
if (filterField.activeFocus) {
pageLoader.takeFocus()
return
}
mainPane.open()
filterField.forceActiveFocus()
}
HRowLayout {
anchors.fill: parent
HButton {
id: addAccountButton
icon.name: "add-account"
toolTip.text: qsTr("Add another account")
backgroundColor: theme.mainPane.bottomBar.settingsButtonBackground
onClicked: pageLoader.showPage("AddAccount/AddAccount")
Layout.fillHeight: true
HShortcut {
sequences: window.settings.keys.addNewAccount
onActivated: addAccountButton.clicked()
}
}
HTextField {
id: filterField
saveName: "roomFilterField"
placeholderText: qsTr("Filter rooms")
backgroundColor: theme.accountView.bottomBar.filterFieldBackground
bordered: false
opacity: width >= 16 * theme.uiScale ? 1 : 0
Layout.fillWidth: true
Layout.fillHeight: true
Keys.onUpPressed: roomList.decrementCurrentIndex()
Keys.onDownPressed: roomList.incrementCurrentIndex()
Keys.onEnterPressed: Keys.onReturnPressed(event)
Keys.onReturnPressed: {
roomList.showItemAtIndex()
if (window.settings.clearRoomFilterOnEnter) text = ""
}
Keys.onEscapePressed: {
mainUI.pageLoader.forceActiveFocus()
if (window.settings.clearRoomFilterOnEscape) text = ""
}
Behavior on opacity { HNumberAnimation {} }
HShortcut {
sequences: window.settings.keys.clearRoomFilter
onActivated: filterField.text = ""
}
HShortcut {
sequences: window.settings.keys.toggleFocusMainPane
onActivated: toggleFocus()
}
}
}
}

View File

@ -1,58 +0,0 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
import QtQuick.Layouts 1.12
import ".."
import "../Base"
HTextField {
id: filterField
saveName: "roomFilterField"
implicitHeight: theme.baseElementsHeight
placeholderText: qsTr("Filter rooms")
backgroundColor: theme.accountView.bottomBar.filterFieldBackground
bordered: false
opacity: width >= 16 * theme.uiScale ? 1 : 0
Keys.onUpPressed: roomList.decrementCurrentIndex()
Keys.onDownPressed: roomList.incrementCurrentIndex()
Keys.onEnterPressed: Keys.onReturnPressed(event)
Keys.onReturnPressed: {
roomList.showItemAtIndex()
if (window.settings.clearRoomFilterOnEnter) text = ""
}
Keys.onEscapePressed: {
mainUI.pageLoader.forceActiveFocus()
if (window.settings.clearRoomFilterOnEscape) text = ""
}
property RoomList roomList
function toggleFocus() {
if (filterField.activeFocus) {
pageLoader.takeFocus()
return
}
mainPane.open()
filterField.forceActiveFocus()
}
Behavior on opacity { HNumberAnimation {} }
HShortcut {
sequences: window.settings.keys.clearRoomFilter
onActivated: filterField.text = ""
}
HShortcut {
sequences: window.settings.keys.toggleFocusMainPane
onActivated: toggleFocus()
}
}

View File

@ -7,12 +7,12 @@ import "../Base"
HDrawer { HDrawer {
id: mainPane id: mainPane
saveName: "mainPane" saveName: "mainPane"
background: null background: theme.mainPane.background
minimumSize: theme.controls.avatar.size + theme.spacing * 2 minimumSize: theme.controls.avatar.size + theme.spacing * 2
readonly property alias accountsBar: accountsBar readonly property alias accountsBar: accountsBar
readonly property alias roomList: roomList readonly property alias roomList: roomList
readonly property alias filterRoomsField: filterRoomsField readonly property alias bottomBar: bottomBar
Behavior on opacity { HNumberAnimation {} } Behavior on opacity { HNumberAnimation {} }
@ -27,7 +27,6 @@ HDrawer {
TopBar { TopBar {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: theme.baseElementsHeight
} }
AccountsBar { AccountsBar {
@ -41,14 +40,14 @@ HDrawer {
RoomList { RoomList {
id: roomList id: roomList
clip: true clip: true
filter: filterRoomsField.text filter: bottomBar.filterField.text
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
} }
FilterRoomsField { BottomBar {
id: filterRoomsField id: bottomBar
roomList: roomList roomList: roomList
Layout.fillWidth: true Layout.fillWidth: true

View File

@ -6,6 +6,7 @@ import "../Base"
Rectangle { Rectangle {
clip: true clip: true
implicitHeight: theme.baseElementsHeight
color: theme.mainPaneTopBar.background color: theme.mainPaneTopBar.background
HRowLayout { HRowLayout {