moment/src/gui/MainPane/MainPane.qml

85 lines
1.9 KiB
QML
Raw Normal View History

2019-12-19 22:46:16 +11:00
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
import QtQuick.Layouts 1.12
import "../Base"
HDrawer {
2019-12-11 06:17:41 +11:00
id: mainPane
saveName: "mainPane"
2019-12-11 06:17:41 +11:00
color: theme.mainPane.background
minimumSize: bottomBar.addAccountButton.width
onHasFocusChanged:
if (! hasFocus) mainPaneList.detachedCurrentIndex = false
2019-07-16 22:36:11 +10:00
property alias filter: bottomBar.roomFilter
readonly property bool small:
width < theme.controls.avatar.size + theme.spacing * 2
2020-03-13 08:15:36 +11:00
readonly property bool hasFocus: bottomBar.filterField.activeFocus
readonly property alias mainPaneList: mainPaneList
readonly property alias topBar: topBar
2020-03-13 08:15:36 +11:00
readonly property alias bottomBar: bottomBar
function toggleFocus() {
if (mainPane.activeFocus) {
pageLoader.takeFocus()
return
}
2019-12-11 06:17:41 +11:00
mainPane.open()
2020-03-13 08:15:36 +11:00
bottomBar.filterField.forceActiveFocus()
}
function addccount() {
2020-03-13 08:15:36 +11:00
bottomBar.addAccountButton.clicked()
}
2019-12-16 19:42:41 +11:00
Behavior on opacity { HNumberAnimation {} }
Binding on visible {
value: false
when: ! mainUI.accountsPresent
}
HShortcut {
enabled: mainUI.accountsPresent
sequences: window.settings.keys.toggleFocusMainPane
onActivated: toggleFocus()
}
HColumnLayout {
anchors.fill: parent
TopBar {
id: topBar
Layout.fillWidth: true
Layout.fillHeight: false
Layout.preferredHeight: theme.baseElementsHeight
}
AccountRoomsList {
2019-12-11 06:17:41 +11:00
id: mainPaneList
clip: true
Layout.fillWidth: true
Layout.fillHeight: true
}
2020-03-13 08:15:36 +11:00
BottomBar {
id: bottomBar
2019-12-11 06:17:41 +11:00
mainPaneList: mainPaneList
2019-12-09 20:25:31 +11:00
Layout.fillWidth: true
Layout.fillHeight: false
Layout.preferredHeight: theme.baseElementsHeight
}
}
}