diff --git a/src/qml/Base/HShortcut.qml b/src/qml/Base/HShortcut.qml index f65705d2..475a50d2 100644 --- a/src/qml/Base/HShortcut.qml +++ b/src/qml/Base/HShortcut.qml @@ -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 } diff --git a/src/qml/Base/HTileDelegate.qml b/src/qml/Base/HTileDelegate.qml index 16c5ee57..b7642069 100644 --- a/src/qml/Base/HTileDelegate.qml +++ b/src/qml/Base/HTileDelegate.qml @@ -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 } diff --git a/src/qml/Shortcuts.qml b/src/qml/Shortcuts.qml index 5908f266..32a3a48d 100644 --- a/src/qml/Shortcuts.qml +++ b/src/qml/Shortcuts.qml @@ -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 { diff --git a/src/qml/SidePane/AccountRoomList.qml b/src/qml/SidePane/AccountRoomList.qml index 5aa1cff1..4f4d9457 100644 --- a/src/qml/SidePane/AccountRoomList.qml +++ b/src/qml/SidePane/AccountRoomList.qml @@ -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() } }