Add keyboard shortcuts to flick the events list
This commit is contained in:
parent
d033ea84e8
commit
41eea44fff
2
TODO.md
2
TODO.md
|
@ -12,12 +12,14 @@
|
||||||
- When qml syntax highlighting supports string interpolation, use them
|
- When qml syntax highlighting supports string interpolation, use them
|
||||||
|
|
||||||
- Fixes
|
- Fixes
|
||||||
|
- Don't strip user spacing in html
|
||||||
- Past events loading (limit 100) freezes the GUI - need to move upsert func
|
- Past events loading (limit 100) freezes the GUI - need to move upsert func
|
||||||
to a WorkerScript
|
to a WorkerScript
|
||||||
- `MessageDelegate.qml:63: TypeError: 'reloadPreviousItem' not a function`
|
- `MessageDelegate.qml:63: TypeError: 'reloadPreviousItem' not a function`
|
||||||
- Horrible performance for big rooms
|
- Horrible performance for big rooms
|
||||||
|
|
||||||
- UI
|
- UI
|
||||||
|
- Adapt shortcuts flicking speed to font size and DPI
|
||||||
- Show error box if uploading avatar fails
|
- Show error box if uploading avatar fails
|
||||||
- EditAccount page:
|
- EditAccount page:
|
||||||
- Device settings
|
- Device settings
|
||||||
|
|
|
@ -14,6 +14,7 @@ HRectangle {
|
||||||
HListView {
|
HListView {
|
||||||
id: eventList
|
id: eventList
|
||||||
clip: true
|
clip: true
|
||||||
|
Component.onCompleted: shortcuts.flickTarget = eventList
|
||||||
|
|
||||||
function canCombine(item, itemAfter) {
|
function canCombine(item, itemAfter) {
|
||||||
if (! item || ! itemAfter) { return false }
|
if (! item || ! itemAfter) { return false }
|
||||||
|
|
37
src/qml/Shortcuts.qml
Normal file
37
src/qml/Shortcuts.qml
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
// Copyright 2019 miruka
|
||||||
|
// This file is part of harmonyqml, licensed under LGPLv3.
|
||||||
|
|
||||||
|
import QtQuick 2.12
|
||||||
|
|
||||||
|
Item {
|
||||||
|
property Item flickTarget: Item {}
|
||||||
|
|
||||||
|
function smartVerticalFlick(baseVelocity, fastMultiply=3) {
|
||||||
|
let vel = flickTarget.verticalVelocity
|
||||||
|
|
||||||
|
if (flickTarget.verticalLayoutDirection == ListView.BottomToTop) {
|
||||||
|
baseVelocity = -baseVelocity
|
||||||
|
vel = -vel
|
||||||
|
}
|
||||||
|
|
||||||
|
let fast = (baseVelocity < 0 && vel < baseVelocity / 2) ||
|
||||||
|
(baseVelocity > 0 && vel > baseVelocity / 2)
|
||||||
|
|
||||||
|
flickTarget.flick(0, baseVelocity * (fast ? fastMultiply : 1))
|
||||||
|
}
|
||||||
|
|
||||||
|
Shortcut {
|
||||||
|
sequences: ["Alt+Up", "Alt+K"]
|
||||||
|
onActivated: smartVerticalFlick(-335)
|
||||||
|
}
|
||||||
|
|
||||||
|
Shortcut {
|
||||||
|
sequences: ["Alt+Down", "Alt+J"]
|
||||||
|
onActivated: smartVerticalFlick(335)
|
||||||
|
}
|
||||||
|
|
||||||
|
Shortcut {
|
||||||
|
sequence: "Alt+Shift+D"
|
||||||
|
onActivated: if (window.debug) { py.call("APP.pdb") }
|
||||||
|
}
|
||||||
|
}
|
|
@ -98,7 +98,5 @@ Item {
|
||||||
popExit: null
|
popExit: null
|
||||||
pushExit: null
|
pushExit: null
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onEscapePressed: if (window.debug) { py.call("APP.pdb") }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,9 @@ ApplicationWindow {
|
||||||
property var settings: ({})
|
property var settings: ({})
|
||||||
onSettingsChanged: py.saveSettings()
|
onSettingsChanged: py.saveSettings()
|
||||||
|
|
||||||
Theme { id: theme }
|
Theme { id: theme }
|
||||||
|
Shortcuts { id: shortcuts}
|
||||||
Python { id: py }
|
Python { id: py }
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
Accounts { id: accounts }
|
Accounts { id: accounts }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user