Make the player answer the keyboard and the mouse
PlayerPanel.keyPressEvent handled Space, F and Escape and was dead code: nothing in the player called setFocusPolicy, so focus went to whichever child button, slider or combo box was first in the tab order, and that child ate the keys. Fixing focus alone would not have been enough -- clicking play parks focus on the play button, which then swallows Space -- so the control bar is explicitly NoFocus and the bindings are QShortcuts with WidgetWithChildrenShortcut context on the panel. That fires whichever descendant holds focus, and does not reach the Search box or the URL field on other tabs the way an application shortcut would. mpv's own input stays disabled. With vo=libmpv there is no mpv-owned window, so its input layer receives nothing; enabling default bindings would mean hand-forwarding events through a Qt-to-mpv key-name table, handing mpv the OSD and OSC that are switched off here, and letting `q` quit the core out from under the Qt UI. One declarative action table now drives the shortcuts, the context menu and the buttons. There was no mouse handling at all. Click pauses, double-click goes fullscreen -- via a doubleClickInterval timer, so a double-click does not also pause on the way -- the wheel changes volume and Ctrl+wheel seeks, with sub-notch deltas accumulated so a trackpad is not inert. The control bar gained previous, next and mute. Mute and volume are driven by observed mpv properties rather than assumed, so the icon follows a change made by key, menu or mpv itself. Buffering was completely invisible: a stalled stream showed a frozen frame for 25 seconds before the retry with nothing on screen, so paused-for-cache now surfaces a label over the video. WatchPage owns next/previous because it owns the queue; the panel only asks. Previous restarts the current item when it is more than five seconds in, as every other player does, and pushes the interrupted item back onto the head of the queue rather than dropping it. Verified: all 38 bindings install, every action is a no-op rather than an exception with nothing loaded, focus policies are as intended, and a fullscreen round trip drives the player state correctly. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,23 @@ records.
|
||||
|
||||
### Added
|
||||
|
||||
- **The player responds to the keyboard and the mouse.** It had a key handler
|
||||
for Space, F and Escape that could never fire — nothing in the player set a
|
||||
focus policy, so focus always landed on a child button or slider, which
|
||||
swallowed the keys. Now: Space/K play-pause, ←/→ ∓5s, J/L ∓10s, Shift+←/→
|
||||
∓1s, `,`/`.` frame step, ↑/↓ volume, M mute, `[`/`]` speed with Backspace to
|
||||
reset, C subtitles, F fullscreen, Escape to leave, 0–9 to jump by tenths,
|
||||
Home/End, N/P for next and previous. Click pauses, double-click goes
|
||||
fullscreen, the wheel changes volume and Ctrl+wheel seeks, and right-click
|
||||
opens a menu built from the same table as the shortcuts. The bindings are
|
||||
scoped to the player, so typing in the Search box or the URL field is
|
||||
unaffected.
|
||||
- **Previous, next and mute buttons**, and a buffering indicator — a stalled
|
||||
stream previously showed a frozen frame for 25 seconds with nothing on
|
||||
screen before the automatic retry.
|
||||
- In fullscreen the controls and pointer fade out after a few idle seconds and
|
||||
return on any movement. In a window they never hide, so the layout does not
|
||||
jump.
|
||||
- **Real icons.** The app had no icon system: transport buttons used the
|
||||
platform style's dark monochrome glyphs painted on saturated red, and
|
||||
everything else called an icon was an emoji baked into the English strings.
|
||||
|
||||
Reference in New Issue
Block a user