Add keybinds to switch accounts

This commit is contained in:
miruka 2020-04-27 22:10:10 -04:00
parent 72c96b3ba5
commit 65103eaaba
6 changed files with 30 additions and 0 deletions

View File

@ -1,5 +1,6 @@
# TODO
- lag when switching accounts
- message delegate too tall
- fix escape keybinds (filter rooms, message selection)

View File

@ -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"],

View File

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

View File

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

View File

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

View File

@ -9,6 +9,7 @@ HSwipeView {
id: swipeView
orientation: Qt.Vertical
Repeater {
model: ModelStore.get("accounts")