Add keybinds to switch accounts
This commit is contained in:
parent
72c96b3ba5
commit
65103eaaba
1
TODO.md
1
TODO.md
|
@ -1,5 +1,6 @@
|
|||
# TODO
|
||||
|
||||
- lag when switching accounts
|
||||
- message delegate too tall
|
||||
|
||||
- fix escape keybinds (filter rooms, message selection)
|
||||
|
|
|
@ -267,6 +267,8 @@ class UISettings(JSONDataFile):
|
|||
"addNewChat": ["Alt+C"],
|
||||
|
||||
"goToLastPage": ["Ctrl+Tab"],
|
||||
"goToPreviousAccount": ["Alt+Shift+N"],
|
||||
"goToNextAccount": ["Alt+N"],
|
||||
"goToPreviousRoom": ["Alt+Shift+Up", "Alt+Shift+K"],
|
||||
"goToNextRoom": ["Alt+Shift+Down", "Alt+Shift+J"],
|
||||
"toggleCollapseAccount": [ "Alt+O"],
|
||||
|
|
|
@ -39,6 +39,18 @@ SwipeView {
|
|||
|
||||
function reset() { setCurrentIndex(defaultIndex) }
|
||||
|
||||
function incrementWrapIndex() {
|
||||
currentIndex === count - 1 ?
|
||||
setCurrentIndex(0) :
|
||||
incrementCurrentIndex()
|
||||
}
|
||||
|
||||
function decrementWrapIndex() {
|
||||
currentIndex === 0 ?
|
||||
setCurrentIndex(count - 1) :
|
||||
decrementCurrentIndex()
|
||||
}
|
||||
|
||||
|
||||
TabShortcuts {
|
||||
container: swipeView
|
||||
|
|
|
@ -54,6 +54,16 @@ HColumnLayout {
|
|||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
HShortcut {
|
||||
sequences: window.settings.keys.goToPreviousAccount
|
||||
onActivated: roomContainer.decrementWrapIndex()
|
||||
}
|
||||
|
||||
HShortcut {
|
||||
sequences: window.settings.keys.goToNextAccount
|
||||
onActivated: roomContainer.incrementWrapIndex()
|
||||
}
|
||||
}
|
||||
|
||||
HButton {
|
||||
|
|
|
@ -15,6 +15,8 @@ HListView {
|
|||
onActivated: showRoom(model.index)
|
||||
}
|
||||
|
||||
onIsCurrentChanged: if (isCurrent) showRoom()
|
||||
|
||||
|
||||
property var accountModel
|
||||
property var roomPane
|
||||
|
@ -22,6 +24,8 @@ HListView {
|
|||
|
||||
|
||||
function showRoom(index=currentIndex) {
|
||||
if (index === -1) index = 0
|
||||
if (index >= model.count) return
|
||||
pageLoader.showRoom(accountModel.id, model.get(index).id)
|
||||
currentIndex = index
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ HSwipeView {
|
|||
id: swipeView
|
||||
orientation: Qt.Vertical
|
||||
|
||||
|
||||
Repeater {
|
||||
model: ModelStore.get("accounts")
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user