Split pane components more

This commit is contained in:
miruka 2020-04-28 16:40:33 -04:00
parent 393a56a50a
commit 56c09e6b48
5 changed files with 109 additions and 91 deletions

View 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 {}
}
}

View File

@ -5,15 +5,7 @@ import QtQuick.Layouts 1.12
import ".."
import "../Base"
HSwipeView {
id: swipeView
orientation: Qt.Vertical
Repeater {
model: ModelStore.get("accounts")
HLoader {
HLoader {
id: loader
active:
HSwipeView.isCurrentItem ||
@ -46,56 +38,9 @@ HSwipeView {
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
FilterRoomsField {
roomList: roomList
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()
}
}
}
}
}
}
}

View File

@ -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 {

View 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()
}
}
}

View File

@ -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