Split pane components more
This commit is contained in:
parent
393a56a50a
commit
56c09e6b48
16
src/gui/MainPane/AccountSwipeView.qml
Normal file
16
src/gui/MainPane/AccountSwipeView.qml
Normal file
|
@ -0,0 +1,16 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import QtQuick 2.12
|
||||
import ".."
|
||||
import "../Base"
|
||||
|
||||
HSwipeView {
|
||||
id: swipeView
|
||||
orientation: Qt.Vertical
|
||||
|
||||
Repeater {
|
||||
model: ModelStore.get("accounts")
|
||||
|
||||
AccountView {}
|
||||
}
|
||||
}
|
|
@ -5,97 +5,42 @@ import QtQuick.Layouts 1.12
|
|||
import ".."
|
||||
import "../Base"
|
||||
|
||||
HSwipeView {
|
||||
id: swipeView
|
||||
orientation: Qt.Vertical
|
||||
HLoader {
|
||||
id: loader
|
||||
active:
|
||||
HSwipeView.isCurrentItem ||
|
||||
HSwipeView.isNextItem ||
|
||||
HSwipeView.isPreviousItem
|
||||
|
||||
readonly property bool isCurrent: HSwipeView.isCurrentItem
|
||||
|
||||
Repeater {
|
||||
model: ModelStore.get("accounts")
|
||||
sourceComponent: HColumnLayout {
|
||||
id: column
|
||||
|
||||
HLoader {
|
||||
id: loader
|
||||
active:
|
||||
HSwipeView.isCurrentItem ||
|
||||
HSwipeView.isNextItem ||
|
||||
HSwipeView.isPreviousItem
|
||||
readonly property QtObject accountModel: model
|
||||
readonly property alias roomList: roomList
|
||||
|
||||
readonly property bool isCurrent: HSwipeView.isCurrentItem
|
||||
Account {
|
||||
id: account
|
||||
isCurrent: loader.isCurrent
|
||||
|
||||
sourceComponent: HColumnLayout {
|
||||
id: column
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
readonly property QtObject accountModel: model
|
||||
readonly property alias roomList: roomList
|
||||
RoomList {
|
||||
id: roomList
|
||||
clip: true
|
||||
accountModel: column.accountModel
|
||||
roomPane: swipeView
|
||||
isCurrent: loader.isCurrent
|
||||
|
||||
Account {
|
||||
id: account
|
||||
isCurrent: loader.isCurrent
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
RoomList {
|
||||
id: roomList
|
||||
clip: true
|
||||
accountModel: column.accountModel
|
||||
roomPane: swipeView
|
||||
isCurrent: loader.isCurrent
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
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.preferredHeight: theme.baseElementsHeight
|
||||
|
||||
Keys.onUpPressed: roomList.decrementCurrentIndex()
|
||||
Keys.onDownPressed: roomList.incrementCurrentIndex()
|
||||
|
||||
Keys.onEnterPressed: Keys.onReturnPressed(event)
|
||||
Keys.onReturnPressed: {
|
||||
if (window.settings.clearRoomFilterOnEnter) text = ""
|
||||
roomList.showRoom()
|
||||
}
|
||||
|
||||
Keys.onEscapePressed: {
|
||||
if (window.settings.clearRoomFilterOnEscape) text = ""
|
||||
mainUI.pageLoader.forceActiveFocus()
|
||||
}
|
||||
|
||||
Behavior on opacity { HNumberAnimation {} }
|
||||
|
||||
HShortcut {
|
||||
enabled: loader.isCurrent
|
||||
sequences: window.settings.keys.clearRoomFilter
|
||||
onActivated: filterField.text = ""
|
||||
}
|
||||
|
||||
HShortcut {
|
||||
enabled: loader.isCurrent
|
||||
sequences: window.settings.keys.toggleFocusMainPane
|
||||
onActivated: {
|
||||
if (filterField.activeFocus) {
|
||||
pageLoader.takeFocus()
|
||||
return
|
||||
}
|
||||
|
||||
mainPane.open()
|
||||
filterField.forceActiveFocus()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
FilterRoomsField {
|
||||
roomList: roomList
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import "../Base"
|
|||
import "../Base/HTile"
|
||||
|
||||
HColumnLayout {
|
||||
property AccountView accountView
|
||||
property AccountSwipeView accountSwipeView
|
||||
|
||||
|
||||
HButton {
|
||||
|
@ -30,7 +30,7 @@ HColumnLayout {
|
|||
id: accountList
|
||||
clip: true
|
||||
model: ModelStore.get("accounts")
|
||||
currentIndex: accountView.currentIndex
|
||||
currentIndex: accountSwipeView.currentIndex
|
||||
|
||||
highlight: Item {
|
||||
|
||||
|
@ -74,7 +74,7 @@ HColumnLayout {
|
|||
}
|
||||
}
|
||||
|
||||
onLeftClicked: accountView.currentIndex = model.index
|
||||
onLeftClicked: accountSwipeView.currentIndex = model.index
|
||||
}
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
@ -82,12 +82,12 @@ HColumnLayout {
|
|||
|
||||
HShortcut {
|
||||
sequences: window.settings.keys.goToPreviousAccount
|
||||
onActivated: accountView.decrementWrapIndex()
|
||||
onActivated: accountSwipeView.decrementWrapIndex()
|
||||
}
|
||||
|
||||
HShortcut {
|
||||
sequences: window.settings.keys.goToNextAccount
|
||||
onActivated: accountView.incrementWrapIndex()
|
||||
onActivated: accountSwipeView.incrementWrapIndex()
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
|
57
src/gui/MainPane/FilterRoomsField.qml
Normal file
57
src/gui/MainPane/FilterRoomsField.qml
Normal file
|
@ -0,0 +1,57 @@
|
|||
// 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: {
|
||||
if (window.settings.clearRoomFilterOnEnter) text = ""
|
||||
roomList.showRoom()
|
||||
}
|
||||
|
||||
Keys.onEscapePressed: {
|
||||
if (window.settings.clearRoomFilterOnEscape) text = ""
|
||||
mainUI.pageLoader.forceActiveFocus()
|
||||
}
|
||||
|
||||
|
||||
property RoomList roomList
|
||||
|
||||
|
||||
Behavior on opacity { HNumberAnimation {} }
|
||||
|
||||
HShortcut {
|
||||
enabled: loader.isCurrent
|
||||
sequences: window.settings.keys.clearRoomFilter
|
||||
onActivated: filterField.text = ""
|
||||
}
|
||||
|
||||
HShortcut {
|
||||
enabled: loader.isCurrent
|
||||
sequences: window.settings.keys.toggleFocusMainPane
|
||||
onActivated: {
|
||||
if (filterField.activeFocus) {
|
||||
pageLoader.takeFocus()
|
||||
return
|
||||
}
|
||||
|
||||
mainPane.open()
|
||||
filterField.forceActiveFocus()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,13 +28,13 @@ HDrawer {
|
|||
|
||||
AccountsBar {
|
||||
id: accountBar
|
||||
accountView: accView
|
||||
accountSwipeView: accountSwipeView
|
||||
|
||||
Layout.fillWidth: false
|
||||
}
|
||||
|
||||
AccountView {
|
||||
id: accView
|
||||
AccountSwipeView {
|
||||
id: accountSwipeView
|
||||
currentIndex: 0
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
|
Loading…
Reference in New Issue
Block a user