Rename SidePane components

This commit is contained in:
miruka 2019-08-30 11:05:11 -04:00
parent 244fc12465
commit 8276e800be
6 changed files with 28 additions and 28 deletions

View File

@ -43,32 +43,32 @@ HShortcutHandler {
HShortcut { HShortcut {
enabled: mainUI.accountsPresent enabled: mainUI.accountsPresent
sequences: settings.keys.clearRoomFilter sequences: settings.keys.clearRoomFilter
onPressed: mainUI.sidePane.paneToolBar.roomFilter = "" onPressed: mainUI.sidePane.toolBar.roomFilter = ""
} }
HShortcut { HShortcut {
enabled: mainUI.accountsPresent enabled: mainUI.accountsPresent
sequences: settings.keys.addNewAccount sequences: settings.keys.addNewAccount
onPressed: mainUI.sidePane.paneToolBar.addAccountButton.clicked() onPressed: mainUI.sidePane.toolBar.addAccountButton.clicked()
} }
HShortcut { HShortcut {
enabled: mainUI.accountsPresent enabled: mainUI.accountsPresent
sequences: settings.keys.goToPreviousRoom sequences: settings.keys.goToPreviousRoom
onPressed: mainUI.sidePane.accountRoomList.previous() onPressed: mainUI.sidePane.sidePaneList.previous()
onHeld: pressed(event) onHeld: pressed(event)
} }
HShortcut { HShortcut {
enabled: mainUI.accountsPresent enabled: mainUI.accountsPresent
sequences: settings.keys.goToNextRoom sequences: settings.keys.goToNextRoom
onPressed: mainUI.sidePane.accountRoomList.next() onPressed: mainUI.sidePane.sidePaneList.next()
onHeld: pressed(event) onHeld: pressed(event)
} }
HShortcut { HShortcut {
enabled: mainUI.accountsPresent enabled: mainUI.accountsPresent
sequences: settings.keys.toggleCollapseAccount sequences: settings.keys.toggleCollapseAccount
onPressed: mainUI.sidePane.accountRoomList.toggleCollapseAccount() onPressed: mainUI.sidePane.sidePaneList.toggleCollapseAccount()
} }
} }

View File

@ -16,18 +16,18 @@ HTileDelegate {
window.uiState.pageProperties.userId == model.data.user_id window.uiState.pageProperties.userId == model.data.user_id
setCurrentTimer.running: setCurrentTimer.running:
! accountRoomList.activateLimiter.running && ! sidePane.hasFocus ! sidePaneList.activateLimiter.running && ! sidePane.hasFocus
Behavior on opacity { HNumberAnimation {} } Behavior on opacity { HNumberAnimation {} }
property bool disconnecting: false property bool disconnecting: false
readonly property bool forceExpand: Boolean(accountRoomList.filter) readonly property bool forceExpand: Boolean(sidePaneList.filter)
// Hide harmless error when a filter matches nothing // Hide harmless error when a filter matches nothing
readonly property bool collapsed: try { readonly property bool collapsed: try {
return accountRoomList.collapseAccounts[model.data.user_id] || false return sidePaneList.collapseAccounts[model.data.user_id] || false
} catch (err) {} } catch (err) {}

View File

@ -15,7 +15,7 @@ HTileDelegate {
window.uiState.pageProperties.roomId == model.data.room_id window.uiState.pageProperties.roomId == model.data.room_id
setCurrentTimer.running: setCurrentTimer.running:
! accountRoomList.activateLimiter.running && ! sidePane.hasFocus ! sidePaneList.activateLimiter.running && ! sidePane.hasFocus
Behavior on opacity { HNumberAnimation {} } Behavior on opacity { HNumberAnimation {} }

View File

@ -11,9 +11,9 @@ Rectangle {
color: theme.sidePane.background color: theme.sidePane.background
property bool hasFocus: paneToolBar.filterField.activeFocus property bool hasFocus: toolbar.filterField.activeFocus
property alias accountRoomList: accountRoomList property alias sidePaneList: sidePaneList
property alias paneToolBar: paneToolBar property alias toolbar: toolbar
property real autoWidthRatio: theme.sidePane.autoWidthRatio property real autoWidthRatio: theme.sidePane.autoWidthRatio
property bool manuallyResizing: false property bool manuallyResizing: false
@ -28,7 +28,7 @@ Rectangle {
} }
} }
onFocusChanged: if (focus) paneToolBar.filterField.forceActiveFocus() onFocusChanged: if (focus) toolbar.filterField.forceActiveFocus()
onManualWidthChanged: { onManualWidthChanged: {
window.uiState.sidePaneManualWidth = manualWidth window.uiState.sidePaneManualWidth = manualWidth
@ -83,29 +83,29 @@ Rectangle {
Keys.enabled: sidePane.hasFocus Keys.enabled: sidePane.hasFocus
Keys.onUpPressed: accountRoomList.previous(false) // do not activate Keys.onUpPressed: sidePaneList.previous(false) // do not activate
Keys.onDownPressed: accountRoomList.next(false) Keys.onDownPressed: sidePaneList.next(false)
Keys.onEnterPressed: Keys.onReturnPressed(event) Keys.onEnterPressed: Keys.onReturnPressed(event)
Keys.onReturnPressed: if (event.modifiers & Qt.ShiftModifier) { Keys.onReturnPressed: if (event.modifiers & Qt.ShiftModifier) {
accountRoomList.toggleCollapseAccount() sidePaneList.toggleCollapseAccount()
} else { } else {
accountRoomList.activate() sidePaneList.activate()
} }
HColumnLayout { HColumnLayout {
anchors.fill: parent anchors.fill: parent
AccountRoomList { SidePaneList {
id: accountRoomList id: sidePaneList
clip: true clip: true
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
} }
PaneToolBar { SidePaneToolBar {
id: paneToolBar id: toolbar
} }
} }
} }

View File

@ -4,12 +4,12 @@ import "../Base"
import "../utils.js" as Utils import "../utils.js" as Utils
HListView { HListView {
id: accountRoomList id: sidePaneList
readonly property var originSource: window.sidePaneModelSource readonly property var originSource: window.sidePaneModelSource
readonly property var collapseAccounts: window.uiState.collapseAccounts readonly property var collapseAccounts: window.uiState.collapseAccounts
readonly property string filter: paneToolBar.roomFilter readonly property string filter: toolbar.roomFilter
readonly property alias activateLimiter: activateLimiter readonly property alias activateLimiter: activateLimiter
onOriginSourceChanged: filterLimiter.restart() onOriginSourceChanged: filterLimiter.restart()
@ -20,7 +20,7 @@ HListView {
function filterSource() { function filterSource() {
let show = [] let show = []
// Hide a harmless error when activating a DelegateRoom // Hide a harmless error when activating a RoomDelegate
try { window.sidePaneModelSource } catch (err) { return } try { window.sidePaneModelSource } catch (err) { return }
for (let i = 0; i < window.sidePaneModelSource.length; i++) { for (let i = 0; i < window.sidePaneModelSource.length; i++) {
@ -99,11 +99,11 @@ HListView {
} }
delegate: Loader { delegate: Loader {
width: accountRoomList.width width: sidePaneList.width
Component.onCompleted: setSource( Component.onCompleted: setSource(
model.type == "Account" ? model.type == "Account" ?
"DelegateAccount.qml" : "DelegateRoom.qml", "AccountDelegate.qml" : "RoomDelegate.qml",
{view: accountRoomList} {view: sidePaneList}
) )
} }

View File

@ -40,7 +40,7 @@ HRowLayout {
Connections { Connections {
target: window target: window
// Keep multiple instances of PaneToolBar in sync. // Keep multiple instances of SidePaneToolBar in sync.
// This also sets the text on startup. // This also sets the text on startup.
onUiStateChanged: filterField.text = uiState.sidePaneFilter onUiStateChanged: filterField.text = uiState.sidePaneFilter
} }