moment/src/gui/MainPane/MainPane.qml

85 lines
1.9 KiB
QML
Raw Normal View History

2019-12-19 07:46:16 -04:00
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
import QtQuick.Layouts 1.12
import "../Base"
HDrawer {
2019-12-10 15:17:41 -04:00
id: mainPane
saveName: "mainPane"
2019-12-10 15:17:41 -04:00
color: theme.mainPane.background
minimumSize: bottomBar.addAccountButton.width
onHasFocusChanged:
if (! hasFocus) mainPaneList.detachedCurrentIndex = false
2019-07-16 08:36:11 -04:00
property alias filter: bottomBar.roomFilter
readonly property bool small:
width < theme.controls.avatar.size + theme.spacing * 2
2020-03-12 17:15:36 -04:00
readonly property bool hasFocus: bottomBar.filterField.activeFocus
readonly property alias mainPaneList: mainPaneList
readonly property alias topBar: topBar
2020-03-12 17:15:36 -04:00
readonly property alias bottomBar: bottomBar
function toggleFocus() {
if (mainPane.activeFocus) {
pageLoader.takeFocus()
return
}
2019-12-10 15:17:41 -04:00
mainPane.open()
2020-03-12 17:15:36 -04:00
bottomBar.filterField.forceActiveFocus()
}
function addccount() {
2020-03-12 17:15:36 -04:00
bottomBar.addAccountButton.clicked()
}
2019-12-16 04:42:41 -04: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-10 15:17:41 -04:00
id: mainPaneList
clip: true
Layout.fillWidth: true
Layout.fillHeight: true
}
2020-03-12 17:15:36 -04:00
BottomBar {
id: bottomBar
2019-12-10 15:17:41 -04:00
mainPaneList: mainPaneList
2019-12-09 05:25:31 -04:00
Layout.fillWidth: true
Layout.fillHeight: false
Layout.preferredHeight: theme.baseElementsHeight
}
}
}