From d404cb06a7e2d87e75c9d5ac710ab019a8be46be Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 8 Oct 2026 10:46:12 +0000 Subject: [PATCH] ui: a theatre mode for the stream viewer What "pop out" did, filling the window without the shell, is now theatre mode (Nav.theatre) with a button of its own in the player. The chat stays under the picture, the members button goes, and it ends with the viewer; a narrow window keeps the phone layout. Escape leaves full screen, then theatre mode: the window's keys take the focus when the viewer moves to the whole window, into full screen or from it back to theatre mode, since what had it is gone. Until the viewer gets a window of its own, Pop out toggles theatre mode too, and VOELIN_OPEN=popout is watch,theatre. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ --- CHANGELOG.md | 3 ++ crates/voelin-ui/src/dev.rs | 12 ++++-- crates/voelin-ui/ui/app.slint | 41 ++++++++++++++++++- .../ui/assets/icons/rectangle-horizontal.svg | 15 +++++++ crates/voelin-ui/ui/bridge.slint | 2 - crates/voelin-ui/ui/icons.slint | 1 + crates/voelin-ui/ui/nav.slint | 3 ++ crates/voelin-ui/ui/screens/streams.slint | 35 +++++++++++----- docs/ui.md | 5 ++- 9 files changed, 98 insertions(+), 19 deletions(-) create mode 100644 crates/voelin-ui/ui/assets/icons/rectangle-horizontal.svg diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e3f011..30dac05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,6 +75,9 @@ User-visible changes of the apps and the `tsgw` gateway. The format follows and Leave left the header). A smaller stage, one row of people and the streams as rows, leaves about 200 px more for the chat; it is remembered, and windows under 800 px tall always have it. +- A theatre mode for streams: the stream viewer's new button fills the + window with the stream and its chat, without the servers, the channels + and the members. Escape leaves it, and full screen too. ### Changed diff --git a/crates/voelin-ui/src/dev.rs b/crates/voelin-ui/src/dev.rs index a7ea489..f4b0e86 100644 --- a/crates/voelin-ui/src/dev.rs +++ b/crates/voelin-ui/src/dev.rs @@ -38,8 +38,9 @@ //! default the sample's raid board), `link:` (a TeamSpeak link //! opened: the server dialog filled in from it, or in voice on its //! server a move into its channel), `watch` (the first stream; with -//! sample data the local test pattern in its place), `popout` (the same, -//! popped out), +//! sample data the local test pattern in its place), `theatre` (after +//! `watch`: in theatre mode), `popout` (`watch` popped out; for now the +//! same as `watch,theatre`), //! `tab:` (phone layout); `friends[:]`, //! `messages[:]` (a private chat), `inbox` (offline messages), //! `library`, `events`, `event-form`, `search[:]`, @@ -332,12 +333,17 @@ pub(crate) fn start(ui: &MainWindow, switches: &Switches) -> Running { } // As a link from the platform comes. "link" => crate::inbox::request(crate::inbox::Request::OpenLink(arg.to_owned())), + // Until the viewer has a window of its own, `popout` is theatre + // mode too. "watch" | "popout" => { with_app(|app| { if switches.demo_ui { app.demo_watch() } else { app.watch_first_stream() } }); - ui.global::().set_viewer_popped(what == "popout"); + if what == "popout" { + nav.set_theatre(true); + } } + "theatre" => nav.set_theatre(true), // Home, friends, messages, events, the bell, the search. "friends" => { with_app(|app| app.select_contact(arg.to_owned())); diff --git a/crates/voelin-ui/ui/app.slint b/crates/voelin-ui/ui/app.slint index 5d12527..ec927ae 100644 --- a/crates/voelin-ui/ui/app.slint +++ b/crates/voelin-ui/ui/app.slint @@ -76,8 +76,32 @@ export component MainWindow inherits Window { keyboard-inset = self.virtual-keyboard-size.height > 0 ? self.height - self.virtual-keyboard-position.y : 0; } - // The viewer takes the whole window in full screen and when popped out. - property chrome: !(Bridge.viewer-open && (Bridge.viewer-fullscreen || Bridge.viewer-popped)); + // The viewer takes the whole window in full screen and in theatre mode + // (a narrow window keeps the phone layout). + property chrome: !(Bridge.viewer-open && (Bridge.viewer-fullscreen || (Nav.theatre && !Nav.narrow))); + // Theatre mode ends with the viewer. + property viewer-open: Bridge.viewer-open; + changed viewer-open => { + if !viewer-open { + Nav.theatre = false; + } + } + // The viewer moves to the whole window, or loses its chat for full + // screen, and what had the focus goes with it: the keys take it, so + // Escape works. + changed chrome => { + if !chrome { + keys.focus(); + } + } + // Back from full screen to theatre mode, the player's button that was + // clicked goes as well. + property fullscreen: Bridge.viewer-fullscreen; + changed fullscreen => { + if fullscreen || !chrome { + keys.focus(); + } + } // The standard widgets follow the theme. In "system" mode the palette // is left alone (it tracks the system) unless an explicit mode was @@ -125,6 +149,19 @@ export component MainWindow inherits Window { } reject } + // Escape leaves full screen, then theatre mode (after the focused + // field had its turn). + key-pressed(event) => { + if event.text == Key.Escape && Bridge.viewer-fullscreen { + Bridge.toggle-fullscreen(); + return accept; + } + if event.text == Key.Escape && Nav.theatre && Bridge.viewer-open { + Nav.theatre = false; + return accept; + } + reject + } VerticalLayout { // Android draws the window under the status and navigation bars. padding-top: root.safe-area-insets.top; diff --git a/crates/voelin-ui/ui/assets/icons/rectangle-horizontal.svg b/crates/voelin-ui/ui/assets/icons/rectangle-horizontal.svg new file mode 100644 index 0000000..93a9a8e --- /dev/null +++ b/crates/voelin-ui/ui/assets/icons/rectangle-horizontal.svg @@ -0,0 +1,15 @@ + + + + diff --git a/crates/voelin-ui/ui/bridge.slint b/crates/voelin-ui/ui/bridge.slint index 8ece5fe..4afa308 100644 --- a/crates/voelin-ui/ui/bridge.slint +++ b/crates/voelin-ui/ui/bridge.slint @@ -1018,8 +1018,6 @@ export global Bridge { in property viewer-ended; in-out property viewer-volume: 100; in property viewer-fullscreen; - // The viewer fills the window without the shell ("pop out"). - in-out property viewer-popped; // "12:34" since the stream was joined. in property viewer-elapsed; in property viewer-count; diff --git a/crates/voelin-ui/ui/icons.slint b/crates/voelin-ui/ui/icons.slint index 8a14529..a260121 100644 --- a/crates/voelin-ui/ui/icons.slint +++ b/crates/voelin-ui/ui/icons.slint @@ -92,6 +92,7 @@ export global Icons { out property puzzle: @image-url("assets/icons/puzzle.svg"); out property quote: @image-url("assets/icons/quote.svg"); out property radio: @image-url("assets/icons/radio.svg"); + out property rectangle-horizontal: @image-url("assets/icons/rectangle-horizontal.svg"); out property refresh-cw: @image-url("assets/icons/refresh-cw.svg"); out property screen-share: @image-url("assets/icons/screen-share.svg"); out property search: @image-url("assets/icons/search.svg"); diff --git a/crates/voelin-ui/ui/nav.slint b/crates/voelin-ui/ui/nav.slint index 832b53e..49175da 100644 --- a/crates/voelin-ui/ui/nav.slint +++ b/crates/voelin-ui/ui/nav.slint @@ -68,6 +68,9 @@ export global Nav { // Its stage as a strip of people and stream rows, for a taller chat // (the setting `ui.voice_compact`; short windows show it anyway). in-out property voice-compact: false; + // Theatre mode: the stream viewer fills the window without the shell, + // its chat still under the picture. It ends with the viewer. + in-out property theatre: false; // Drawers in place of the members panel (gateway features). in-out property pins-open; in-out property topics-open; diff --git a/crates/voelin-ui/ui/screens/streams.slint b/crates/voelin-ui/ui/screens/streams.slint index 31880b8..0059a23 100644 --- a/crates/voelin-ui/ui/screens/streams.slint +++ b/crates/voelin-ui/ui/screens/streams.slint @@ -454,14 +454,28 @@ component StreamPlayer inherits Rectangle { y: (parent.height - self.height) / 2; clicked => { Bridge.hide-viewer(); } } + // Theatre mode: the window without the shell. Checked, it has + // the accent's colours, as elsewhere (white would not show on + // the light theme's). + if !Bridge.viewer-fullscreen && !Nav.narrow: IconButton { + icon: Icons.rectangle-horizontal; + label: Nav.theatre ? @tr("Exit theatre mode") : @tr("Theatre mode"); + tooltip: root.up ? self.label : ""; + checked: Nav.theatre; + tint: Nav.theatre ? Theme.accent-text : #ffffff; + y: (parent.height - self.height) / 2; + clicked => { Nav.theatre = !Nav.theatre; } + } + // Until the viewer has a window of its own, popping out is + // theatre mode. if !Nav.narrow: IconButton { icon: Icons.external-link; - label: Bridge.viewer-popped ? @tr("Back to the window") : @tr("Pop out"); + label: Nav.theatre ? @tr("Back to the window") : @tr("Pop out"); tooltip: root.up ? self.label : ""; - checked: Bridge.viewer-popped; - tint: #ffffff; + checked: Nav.theatre; + tint: Nav.theatre ? Theme.accent-text : #ffffff; y: (parent.height - self.height) / 2; - clicked => { Bridge.viewer-popped = !Bridge.viewer-popped; } + clicked => { Nav.theatre = !Nav.theatre; } } IconButton { icon: Bridge.viewer-fullscreen ? Icons.minimize-2 : Icons.maximize; @@ -519,10 +533,11 @@ component StreamInfo inherits VerticalLayout { } } -// The stream we watch. With the shell: a header with the streamer, the -// title and LIVE over our channel's background, the player, a note on the -// channel the stream belongs to, and our channel's chat below. In full -// screen and on a phone: the player alone. +// The stream we watch. With the shell, and in theatre mode without it: a +// header with the streamer, the title and LIVE over our channel's +// background, the player, a note on the channel the stream belongs to, +// and our channel's chat below. In full screen and on a phone: the player +// alone. export component StreamViewer inherits Rectangle { // Reading our own width here would loop through the layout, so the // phone breakpoint (a setting) decides. @@ -552,8 +567,8 @@ export component StreamViewer inherits Rectangle { if Bridge.viewer-qualities.length > 1 || Bridge.viewer-has-frame: StreamQuality { y: (parent.height - self.height) / 2; } - // Popped out, the window has no members panel to open. - if Bridge.members.length > 0 && !Bridge.viewer-popped: IconButton { + // In theatre mode the window has no members panel to open. + if Bridge.members.length > 0 && !Nav.theatre: IconButton { icon: Icons.users; label: @tr("Members"); checked: Nav.right-panel-open && !Nav.pins-open && !Nav.topics-open; diff --git a/docs/ui.md b/docs/ui.md index aa13f23..479aa29 100644 --- a/docs/ui.md +++ b/docs/ui.md @@ -174,7 +174,7 @@ comes from the engine's events; what a gateway adds is hidden without it. | Pinned messages | `pins` | In the members panel's place: cards with author, time, text, files and reactions; the pin unpins, a click jumps to the message | `Gateway` `Pins`, `Pinned`, `Unpinned`; `GatewayRequest::Pins`, `Unpin` | | Topics | `topics`, `topic:` | In the members panel's place: search, cards with the message count, creator and last activity, Create Topic; an open topic replaces the chat's messages and takes replies | `Gateway` `Topics`, `Topic`, `TopicHistory`; `GatewayRequest::Topics`, `TopicHistory`, `CreateTopic`, `Post` | | Voice channel | `voice`, `voice:compact` | Title, topic, "5 in voice / 50 total", Copy invite link (a `ts3server://` link to the channel; the phone's Invite button does the same), the members button, Smaller stage / Larger stage, Chat only; the people as large avatars (talking ring and bars, muted, crown, streaming); the streams as cards (the streamer's avatar on a painted scene in their colour, or the picture while watched, and our own from the Stream Studio its preview: `studio:live,server,voice`; LIVE, viewers, kind, bitrate, sound, Watch Stream); the call bar: mute and deafen (red while on), share (its menu opens above it), the voice settings and Leave; the channel's chat. The smaller stage (`ui.voice_compact`, and always in windows under 800 px tall, where its button is disabled) is one row of small avatars, scrolling sideways, and the streams as rows (Watch, Show), so the chat gets about 200 to 240 px more | `Presence`, `Talking`, `StreamsChanged`, viewer counts from `StreamsChanged`, else the `Gateway` stream directory | -| Watching a stream | `watch`, `popout` | A header (on our channel's background) with the streamer's avatar, the title, the streamer and viewers, LIVE, the picture's height (the simulcast picker when a Voelin streamer offers layers), the members button and Leave; the player, with nothing over the picture but its controls: volume, elapsed time, what arrives (codec, size, frame rate, bitrate), back to the chat, pop out, full screen. The controls hide 2.5 s after the pointer last moved over the picture and come back when it moves (in full screen the cursor hides with them; on a touch screen a tap on the picture shows or hides them); while waiting for the picture and after the stream ended they stay, and so do they before the pointer was ever over the picture, as in screenshots. Then a note that the stream belongs to the channel; the channel's chat and a Stream Info tab. Popped out it fills the window, without the members button. In full screen (and on the phone outside the voice screen) the player is alone, with the streamer, title, viewers, LIVE and the quality over the picture's top, hiding with the controls | `WatchState`, `WatchLayers`, decoded frames and their stats (`src/video.rs`), `StreamsChanged` (viewer counts; the `Gateway` stream directory where the server gives none) | +| Watching a stream | `watch`, `watch,theatre`, `popout` | A header (on our channel's background) with the streamer's avatar, the title, the streamer and viewers, LIVE, the picture's height (the simulcast picker when a Voelin streamer offers layers), the members button and Leave; the player, with nothing over the picture but its controls: volume, elapsed time, what arrives (codec, size, frame rate, bitrate), back to the chat, theatre mode, pop out (for now theatre mode too), full screen. The controls hide 2.5 s after the pointer last moved over the picture and come back when it moves (in full screen the cursor hides with them; on a touch screen a tap on the picture shows or hides them); while waiting for the picture and after the stream ended they stay, and so do they before the pointer was ever over the picture, as in screenshots. Then a note that the stream belongs to the channel; the channel's chat and a Stream Info tab. In theatre mode (`Nav.theatre`) it fills the window without the shell or the members button, the chat still under the picture; it ends with the viewer, and a narrow window keeps the phone layout. Escape leaves full screen, then theatre mode. In full screen (and on the phone outside the voice screen) the player is alone, with the streamer, title, viewers, LIVE and the quality over the picture's top, hiding with the controls | `WatchState`, `WatchLayers`, decoded frames and their stats (`src/video.rs`), `StreamsChanged` (viewer counts; the `Gateway` stream directory where the server gives none) | The pins and topics share the place of the members panel: opening one closes the other, and the members button brings the panel back. On the @@ -508,7 +508,8 @@ Environment variables (see `src/dev.rs`): it, or in voice on its server a move; Adding a server: Links), `unread` (the current chat read up to five messages before its end: the New line, scrolled up to; `unread:end` ten messages before, at the end of the list, - under the bar that counts them), `watch`, `popout` + under the bar that counts them), `watch`, `theatre` (after `watch`: + theatre mode), `popout` (for now the same as `watch,theatre`) (the server page, above), `tab:` (phone layout); `friends[:]`, `messages[:]`, `inbox`, `offline`, `library`, `events`, `event-form`, `search[:]`, `notifications`,