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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ
This commit is contained in:
1 parent
0aee710c19
commit
d404cb06a7
9 files changed
+98
-19
No files matched your search
@@ -38,8 +38,9 @@
|
||||
//! default the sample's raid board), `link:<url>` (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:<home|servers|chat|activity|you>` (phone layout); `friends[:<uid>]`,
|
||||
//! `messages[:<uid>]` (a private chat), `inbox` (offline messages),
|
||||
//! `library`, `events`, `event-form`, `search[:<text>]`,
|
||||
@@ -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::<Bridge>().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()));
|
||||
|
||||
@@ -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 <bool> 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 <bool> chrome: !(Bridge.viewer-open && (Bridge.viewer-fullscreen || (Nav.theatre && !Nav.narrow)));
|
||||
// Theatre mode ends with the viewer.
|
||||
property <bool> 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 <bool> 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;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<!-- @license lucide-static v1.48.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-rectangle-horizontal"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<rect width="20" height="12" x="2" y="6" rx="2" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 352 B |
@@ -1018,8 +1018,6 @@ export global Bridge {
|
||||
in property <bool> viewer-ended;
|
||||
in-out property <float> viewer-volume: 100;
|
||||
in property <bool> viewer-fullscreen;
|
||||
// The viewer fills the window without the shell ("pop out").
|
||||
in-out property <bool> viewer-popped;
|
||||
// "12:34" since the stream was joined.
|
||||
in property <string> viewer-elapsed;
|
||||
in property <int> viewer-count;
|
||||
|
||||
@@ -92,6 +92,7 @@ export global Icons {
|
||||
out property <image> puzzle: @image-url("assets/icons/puzzle.svg");
|
||||
out property <image> quote: @image-url("assets/icons/quote.svg");
|
||||
out property <image> radio: @image-url("assets/icons/radio.svg");
|
||||
out property <image> rectangle-horizontal: @image-url("assets/icons/rectangle-horizontal.svg");
|
||||
out property <image> refresh-cw: @image-url("assets/icons/refresh-cw.svg");
|
||||
out property <image> screen-share: @image-url("assets/icons/screen-share.svg");
|
||||
out property <image> search: @image-url("assets/icons/search.svg");
|
||||
|
||||
@@ -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 <bool> 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 <bool> theatre: false;
|
||||
// Drawers in place of the members panel (gateway features).
|
||||
in-out property <bool> pins-open;
|
||||
in-out property <bool> topics-open;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user