Adapt auto-repeat shortcuts to new system
This commit is contained in:
parent
8de26c11a1
commit
a47351a5ad
|
@ -5,6 +5,7 @@ QtObject {
|
|||
signal held(var event)
|
||||
signal released(var event)
|
||||
|
||||
|
||||
property bool enabled: true
|
||||
property var sequences: "" // string or array of strings
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ HButton {
|
|||
Timer {
|
||||
interval: 100
|
||||
repeat: true
|
||||
running: true
|
||||
// running: true
|
||||
// Component.onCompleted won't work for this
|
||||
onTriggered: if (shouldBeCurrent) view.currentIndex = model.index
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import "utils.js" as Utils
|
|||
HShortcutHandler {
|
||||
property Item flickTarget: Item {}
|
||||
|
||||
// App
|
||||
|
||||
HShortcut {
|
||||
enabled: debugMode
|
||||
|
@ -17,16 +18,22 @@ HShortcutHandler {
|
|||
onPressed: py.loadSettings(() => { mainUI.pressAnimation.start() })
|
||||
}
|
||||
|
||||
// Page scrolling
|
||||
|
||||
HShortcut {
|
||||
sequences: settings.keys.scrollUp
|
||||
onPressed: Utils.smartVerticalFlick(flickTarget, -335)
|
||||
onHeld: pressed(event)
|
||||
}
|
||||
|
||||
HShortcut {
|
||||
sequences: settings.keys.scrollDown
|
||||
onPressed: Utils.smartVerticalFlick(flickTarget, 335)
|
||||
onHeld: pressed(event)
|
||||
}
|
||||
|
||||
// SidePane
|
||||
|
||||
HShortcut {
|
||||
sequences: settings.keys.focusSidePane
|
||||
onPressed: mainUI.sidePane.setFocus()
|
||||
|
@ -40,11 +47,13 @@ HShortcutHandler {
|
|||
HShortcut {
|
||||
sequences: settings.keys.goToPreviousRoom
|
||||
onPressed: mainUI.sidePane.accountRoomList.previous()
|
||||
onHeld: pressed(event)
|
||||
}
|
||||
|
||||
HShortcut {
|
||||
sequences: settings.keys.goToNextRoom
|
||||
onPressed: mainUI.sidePane.accountRoomList.next()
|
||||
onHeld: pressed(event)
|
||||
}
|
||||
|
||||
HShortcut {
|
||||
|
|
|
@ -11,9 +11,9 @@ HListView {
|
|||
readonly property var collapseAccounts: window.uiState.collapseAccounts
|
||||
readonly property string filter: paneToolBar.roomFilter
|
||||
|
||||
onOriginSourceChanged: filterLimiter.requestFire()
|
||||
onFilterChanged: filterLimiter.requestFire()
|
||||
onCollapseAccountsChanged: filterLimiter.requestFire()
|
||||
onOriginSourceChanged: filterLimiter.restart()
|
||||
onFilterChanged: filterLimiter.restart()
|
||||
onCollapseAccountsChanged: filterLimiter.restart()
|
||||
|
||||
|
||||
function filterSource() {
|
||||
|
@ -59,13 +59,12 @@ HListView {
|
|||
|
||||
function previous(activate=true) {
|
||||
decrementCurrentIndex()
|
||||
if (activate) activateLimiter.requestFire()
|
||||
|
||||
if (activate) activateLimiter.restart()
|
||||
}
|
||||
|
||||
function next(activate=true) {
|
||||
incrementCurrentIndex()
|
||||
if (activate) activateLimiter.requestFire()
|
||||
if (activate) activateLimiter.restart()
|
||||
}
|
||||
|
||||
function activate() {
|
||||
|
@ -108,15 +107,15 @@ HListView {
|
|||
}
|
||||
|
||||
|
||||
HRateLimiter {
|
||||
Timer {
|
||||
id: filterLimiter
|
||||
cooldown: 16
|
||||
onFired: filterSource()
|
||||
interval: 16
|
||||
onTriggered: filterSource()
|
||||
}
|
||||
|
||||
HRateLimiter {
|
||||
Timer {
|
||||
id: activateLimiter
|
||||
onFired: activate()
|
||||
extendOnRequestWhileCooldownActive: true
|
||||
interval: 300
|
||||
onTriggered: activate()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user