Refactor key binding panel for easier usage #25104
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are 2 issues I want to tackle with this pull:
RealmKeyBinding.Action
is an integer, always. This makes it very difficult to use it in UI, since for UI display, you'd want to be callingGetLocalisableDescription()
on a strongly-typed enum instance rather than an integer; calling it on an integer doesn't return the binding name, it just returns the number.2a0e4c3 is intended for this. It adds a helper method to always unconditionally unmap
Action
to a strongly-typed object.GlobalAction
has no notion of sections. I want to disallow reusing one key across multiple bindings in a section. This makes retrieval of the set of key bindings to check for conflicts tricky. Previous code would kind of bodge it using the default key bindings, but all the pieces are right there and making this API just a bit nicer is not much work. So I did that in 1c784c9 -GlobalActionCategory
corresponds 1:1 to the key binding setting sections.This in turn enables c2e92cb, which while tangential to my future plans, feels pretty nice and gets rid of a bunch of boilerplate.