From d6df8f541245418cafb4ca88896407e8e3e616a9 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 8 Oct 2026 04:57:53 +0000 Subject: [PATCH] ui: a call bar on the voice page, and a smaller stage for the chat The desktop voice view gets mute, deafen, share, the voice settings and Leave under the people and streams (VoiceButtons gains round and filled); Voice Settings and Leave leave the header, which gets a Smaller stage / Larger stage button. The smaller stage, one row of compact people and the streams as rows, gives the chat about 200 px back and is stored as ui.voice_compact. Windows under 800 px tall always use it: the larger stage and the bar left no room for the chat or the composer there. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ --- CHANGELOG.md | 5 ++ crates/voelin-ui/src/appearance.rs | 20 +++++- crates/voelin-ui/src/bind/settings.rs | 3 + crates/voelin-ui/src/dev.rs | 11 +++- crates/voelin-ui/src/settings.rs | 32 ++++++++- crates/voelin-ui/ui/app.slint | 2 + crates/voelin-ui/ui/bridge.slint | 2 + crates/voelin-ui/ui/nav.slint | 12 ++++ crates/voelin-ui/ui/screens/voice.slint | 86 +++++++++++++++++++------ crates/voelin-ui/ui/shells/common.slint | 15 ++++- docs/ui.md | 12 ++-- 11 files changed, 165 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de82d06..e9f7dc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,11 @@ User-visible changes of the apps and the `tsgw` gateway. The format follows - Every gateway a server publishes is tried in turn (TLS first, 20 seconds each) before waiting to try again, so a TLS proxy that fails falls back to the plain gateway published next to it. +- A call bar on the desktop's voice channel page: mute, deafen, share, the + voice settings and Leave, under the people and streams (Voice Settings + 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. ### Changed diff --git a/crates/voelin-ui/src/appearance.rs b/crates/voelin-ui/src/appearance.rs index 93d329b..a24486b 100644 --- a/crates/voelin-ui/src/appearance.rs +++ b/crates/voelin-ui/src/appearance.rs @@ -1,6 +1,7 @@ //! Appearance settings (`ui.theme`, `ui.font_scale`, `ui.narrow_breakpoint`, -//! `ui.image_cache_mb`): applied to the Theme and Nav globals and the image -//! cache whenever they change, from the settings page or elsewhere. +//! `ui.image_cache_mb`, `ui.members_width`, `ui.voice_compact`): applied to +//! the Theme and Nav globals and the image cache whenever they change, from +//! the settings page or elsewhere. use slint::ComponentHandle; use tracing::warn; @@ -8,7 +9,8 @@ use tracing::warn; use crate::app::{App, AppearanceForm, Bridge, Nav, Theme}; use crate::images; use crate::settings::{ - ThemeChoice, UI_FONT_SCALE, UI_IMAGE_CACHE_MB, UI_MEMBERS_WIDTH, UI_NARROW_BREAKPOINT, UI_THEME, + ThemeChoice, UI_FONT_SCALE, UI_IMAGE_CACHE_MB, UI_MEMBERS_WIDTH, UI_NARROW_BREAKPOINT, + UI_THEME, UI_VOICE_COMPACT, }; impl App { @@ -29,6 +31,7 @@ impl App { if nav.get_right_panel_width() != width { nav.set_right_panel_width(width); } + nav.set_voice_compact(self.prefs.get(&UI_VOICE_COMPACT)); let bridge = ui.global::(); bridge.set_appearance(AppearanceForm { theme: theme.as_str().into(), @@ -71,4 +74,15 @@ impl App { warn!(%e, "could not store the panel width"); } } + + /// The voice channel view's stage was made smaller or larger: store it + /// (`ui.voice_compact`), so it comes back the same. + pub(crate) fn voice_compact_changed(&mut self, compact: bool) { + if self.prefs.get(&UI_VOICE_COMPACT) == compact { + return; + } + if let Err(e) = self.prefs.set(&UI_VOICE_COMPACT, compact) { + warn!(%e, "could not store the stage size"); + } + } } diff --git a/crates/voelin-ui/src/bind/settings.rs b/crates/voelin-ui/src/bind/settings.rs index 2805a1e..10c52b9 100644 --- a/crates/voelin-ui/src/bind/settings.rs +++ b/crates/voelin-ui/src/bind/settings.rs @@ -53,6 +53,9 @@ pub(super) fn wire(ui: &MainWindow) { bridge.on_panel_resized(|width| { with_app(|app| app.panel_resized(width)); }); + bridge.on_voice_compact_changed(|compact| { + with_app(|app| app.voice_compact_changed(compact)); + }); bridge.on_appearance_changed(|form| { with_app(|app| app.appearance_changed(&form)); }); diff --git a/crates/voelin-ui/src/dev.rs b/crates/voelin-ui/src/dev.rs index 94f1ef4..d55ed10 100644 --- a/crates/voelin-ui/src/dev.rs +++ b/crates/voelin-ui/src/dev.rs @@ -18,7 +18,8 @@ //! `bookmark:edit` the current one, Advanced open), //! `emoji` (the picker), `client` (the volume dialog of the first other //! client once connected), `panel` / `no-panel` (the members panel), -//! `voice` (the voice channel view; on the phone its own screen), +//! `voice` (the voice channel view; on the phone its own screen; +//! `voice:compact` with the smaller stage, not stored), //! `members` (the phone's members page), `notification` (a tapped voice //! notification), `shared:` (text shared to the app on Android), //! `pins`, `topics` (the drawers), @@ -268,7 +269,13 @@ pub(crate) fn start(ui: &MainWindow, switches: &Switches) -> Running { "panel" => nav.set_right_panel_open(true), "no-panel" => nav.set_right_panel_open(false), "tab" => nav.set_mobile_tab(mobile_tab(arg)), - "voice" => nav.invoke_show_voice(true), + "voice" => { + nav.invoke_show_voice(true); + // The smaller stage, for this run only. + if arg == "compact" { + nav.set_voice_compact(true); + } + } "pins" => nav.invoke_show_pins(true), // The phone's members page. "members" => nav.set_members_open(true), diff --git a/crates/voelin-ui/src/settings.rs b/crates/voelin-ui/src/settings.rs index 2d10f98..97fd5f9 100644 --- a/crates/voelin-ui/src/settings.rs +++ b/crates/voelin-ui/src/settings.rs @@ -100,9 +100,25 @@ pub static UI_MEMBERS_WIDTH: Key = Key::new( || 280, ); +/// `ui.voice_compact`: the voice channel view's smaller stage (a strip of +/// people and stream rows, more room for the chat). Its toggle stores it. +pub static UI_VOICE_COMPACT: Key = Key::new( + "ui.voice_compact", + Kind::Bool, + "The voice channel view's smaller stage, leaving more room for the chat.", + || false, +); + /// The UI's keys besides [`UI`] and [`CLIENT_PLAYBACK`], for registering. -pub fn appearance_keys() -> [&'static dyn voelin_core::settings::Setting; 5] { - [&UI_THEME, &UI_FONT_SCALE, &UI_NARROW_BREAKPOINT, &UI_IMAGE_CACHE_MB, &UI_MEMBERS_WIDTH] +pub fn appearance_keys() -> [&'static dyn voelin_core::settings::Setting; 6] { + [ + &UI_THEME, + &UI_FONT_SCALE, + &UI_NARROW_BREAKPOINT, + &UI_IMAGE_CACHE_MB, + &UI_MEMBERS_WIDTH, + &UI_VOICE_COMPACT, + ] } /// What a kind of notification does: nothing, the bell, or the bell and a @@ -533,6 +549,18 @@ mod tests { assert_eq!(NotifyLevel::from_index(7), NotifyLevel::Desktop); } + #[test] + fn voice_compact_key() { + let settings = voelin_core::settings::Settings::in_memory(); + for key in appearance_keys() { + settings.register(key); + } + assert_eq!(settings.get_json("ui.voice_compact"), Some(false.into()), "the full stage"); + assert!(settings.apply_overrides(["ui.voice_compact=true"]).is_empty()); + assert!(settings.get(&UI_VOICE_COMPACT)); + assert!(settings.set_json("ui.voice_compact", "small".into()).is_err()); + } + #[test] fn ui_settings_defaults() { let parsed: UiSettings = serde_json::from_str(r#"{"openh264":true}"#).unwrap(); diff --git a/crates/voelin-ui/ui/app.slint b/crates/voelin-ui/ui/app.slint index 0c3971b..5d12527 100644 --- a/crates/voelin-ui/ui/app.slint +++ b/crates/voelin-ui/ui/app.slint @@ -62,9 +62,11 @@ export component MainWindow inherits Window { Nav.wide = self.width > 1180px; } changed breakpoint => { Nav.narrow = self.width < Nav.narrow-breakpoint; } + changed height => { Nav.short = self.height < 800px; } init => { Nav.narrow = self.width < Nav.narrow-breakpoint; Nav.wide = self.width > 1180px; + Nav.short = self.height < 800px; Theme.system-dark = Palette.color-scheme != ColorScheme.light; } // Android: the space under the on-screen keyboard (the window is not diff --git a/crates/voelin-ui/ui/bridge.slint b/crates/voelin-ui/ui/bridge.slint index cb35b3d..9353f97 100644 --- a/crates/voelin-ui/ui/bridge.slint +++ b/crates/voelin-ui/ui/bridge.slint @@ -1141,6 +1141,8 @@ export global Bridge { callback appearance-changed(AppearanceForm); // The members panel was dragged to another width (pixels). callback panel-resized(float); + // The voice channel view's stage was made smaller (true) or larger. + callback voice-compact-changed(bool); // The voice channel view was opened or closed. callback show-voice-view(bool); // The members panel's search field. diff --git a/crates/voelin-ui/ui/nav.slint b/crates/voelin-ui/ui/nav.slint index 0e14651..832b53e 100644 --- a/crates/voelin-ui/ui/nav.slint +++ b/crates/voelin-ui/ui/nav.slint @@ -57,11 +57,17 @@ export global Nav { in-out property narrow-breakpoint: 800px; // Wide enough for a third column (home, direct messages). in-out property wide: true; + // Too short for the voice channel view's larger stage (under 800 px): + // it shows the smaller one. + in-out property short: false; in-out property right-panel-open: true; in-out property right-panel-width: 280px; // The voice channel we are in (people, streams, its chat) instead of // the plain chat. in-out property voice-view: false; + // 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; // Drawers in place of the members panel (gateway features). in-out property pins-open; in-out property topics-open; @@ -325,6 +331,12 @@ export global Nav { Bridge.show-voice-view(on); } + // The voice channel view's smaller or larger stage, stored. + public function toggle-voice-compact() { + voice-compact = !voice-compact; + Bridge.voice-compact-changed(voice-compact); + } + public function start-topic(key: int) { topic-form-key = key; topic-form-title = ""; diff --git a/crates/voelin-ui/ui/screens/voice.slint b/crates/voelin-ui/ui/screens/voice.slint index 2bddb99..aaa1649 100644 --- a/crates/voelin-ui/ui/screens/voice.slint +++ b/crates/voelin-ui/ui/screens/voice.slint @@ -1,16 +1,49 @@ // The voice channel we are in: who is there (and who talks), the streams -// in it, and the channel's chat below. +// in it, the call's controls, and the channel's chat below. import { Theme } from "../theme.slint"; import { Icons } from "../icons.slint"; import { Bridge } from "../bridge.slint"; -import { Nav, SettingsSection } from "../nav.slint"; -import { Icon, IconButton, Button, ButtonKind, BannerPicture } from "../components/index.slint"; +import { Nav } from "../nav.slint"; +import { Icon, IconButton, Button, ButtonKind, BannerPicture, ScrollView } from "../components/index.slint"; +import { VoiceButtons } from "../shells/common.slint"; import { MessageList, Composer } from "chat.slint"; import { Participant, StreamCard } from "voice-parts.slint"; -// The voice channel view (desktop): header, people, streams, chat. +// Under the stage: mute, deafen, share, the voice settings and Leave. +component CallBar inherits HorizontalLayout { + alignment: center; + padding-left: Theme.space-6; + padding-right: Theme.space-6; + padding-bottom: Theme.space-3; + spacing: Theme.space-3; + accessible-role: AccessibleRole.groupbox; + accessible-label: @tr("Call"); + VoiceButtons { + size: 44px; + round: true; + filled: true; + gear: true; + spacing: Theme.space-3; + } + Button { + kind: ButtonKind.danger; + icon: Icons.phone-off; + text: @tr("Leave"); + y: (parent.height - self.height) / 2; + clicked => { + Nav.show-voice(false); + Bridge.disconnect-voice(); + } + } +} + +// The voice channel view (desktop): header, people, streams, the call bar, +// chat. The smaller stage (`Nav.voice-compact`, and in short windows) is a +// strip of people and stream rows. export component VoiceView inherits VerticalLayout { + // The smaller stage: chosen, or the window too short for the larger. + property compact: Nav.voice-compact || Nav.short; // Banner shares the header; it does not push people and streams down. Rectangle { clip: true; @@ -56,28 +89,20 @@ export component VoiceView inherits VerticalLayout { y: (parent.height - self.height) / 2; clicked => { Nav.toggle-members(); } } + IconButton { + icon: root.compact ? Icons.chevron-down : Icons.chevron-up; + label: root.compact ? @tr("Larger stage") : @tr("Smaller stage"); + tooltip: Nav.short ? @tr("The window is too short for the larger stage") : self.label; + enabled: !Nav.short; + y: (parent.height - self.height) / 2; + clicked => { Nav.toggle-voice-compact(); } + } IconButton { icon: Icons.message-square; label: @tr("Chat only"); y: (parent.height - self.height) / 2; clicked => { Nav.show-voice(false); } } - Button { - icon: Icons.settings; - text: @tr("Voice Settings"); - y: (parent.height - self.height) / 2; - clicked => { Nav.open-settings(SettingsSection.voice); } - } - Button { - kind: ButtonKind.danger; - icon: Icons.phone-off; - text: @tr("Leave"); - y: (parent.height - self.height) / 2; - clicked => { - Nav.show-voice(false); - Bridge.disconnect-voice(); - } - } } if Bridge.own-channel-topic != "": Text { text: Bridge.own-channel-topic; @@ -106,7 +131,7 @@ export component VoiceView inherits VerticalLayout { } } // The people, centred, wrapping into more rows when there are many. - FlexboxLayout { + if !root.compact: FlexboxLayout { padding-left: Theme.space-6; padding-right: Theme.space-6; padding-top: Theme.space-3; @@ -120,6 +145,23 @@ export component VoiceView inherits VerticalLayout { member: member; } } + // Smaller: one row of people, scrolling sideways when there are many. + if root.compact: ScrollView { + height: 112px; + HorizontalLayout { + padding-left: Theme.space-6; + padding-right: Theme.space-6; + padding-top: Theme.space-2; + spacing: Theme.space-3; + alignment: center; + accessible-role: AccessibleRole.list; + accessible-label: @tr("In voice"); + for member in Bridge.members: Participant { + member: member; + compact: true; + } + } + } if Bridge.streams.length > 0: HorizontalLayout { padding-left: Theme.space-6; padding-right: Theme.space-6; @@ -128,8 +170,10 @@ export component VoiceView inherits VerticalLayout { for stream in Bridge.streams: StreamCard { horizontal-stretch: 1; stream: stream; + compact: root.compact; } } + CallBar { } MessageList { vertical-stretch: 1; model: Bridge.messages; diff --git a/crates/voelin-ui/ui/shells/common.slint b/crates/voelin-ui/ui/shells/common.slint index 07e7548..7964f02 100644 --- a/crates/voelin-ui/ui/shells/common.slint +++ b/crates/voelin-ui/ui/shells/common.slint @@ -123,11 +123,14 @@ export component VoiceCard inherits Rectangle { } } -// Mute, deafen, share, and with `gear` the voice settings. +// Mute, deafen, share, and with `gear` the voice settings. `round` and +// `filled` are the voice view's call bar. export component VoiceButtons inherits HorizontalLayout { in property size: 34px; // The rail has the settings; the user card leaves them out. in property gear: false; + in property round; + in property filled; spacing: Theme.space-1; IconButton { icon: Bridge.input-muted ? Icons.mic-off : Icons.mic; @@ -135,6 +138,8 @@ export component VoiceButtons inherits HorizontalLayout { checked: Bridge.input-muted; danger: true; size: root.size; + round: root.round; + filled: root.filled; enabled: Bridge.voice-connected; clicked => { Bridge.set-input-muted(!Bridge.input-muted); } } @@ -144,6 +149,8 @@ export component VoiceButtons inherits HorizontalLayout { checked: Bridge.output-muted; danger: true; size: root.size; + round: root.round; + filled: root.filled; enabled: Bridge.voice-connected; clicked => { Bridge.set-output-muted(!Bridge.output-muted); } } @@ -154,14 +161,18 @@ export component VoiceButtons inherits HorizontalLayout { label: Bridge.share-state == "live" ? @tr("Sharing") : StudioBridge.status.live ? @tr("Live in the Stream Studio") : @tr("Share or go live"); checked: Bridge.share-state == "live" || StudioBridge.status.live; size: root.size; + round: root.round; + filled: root.filled; clicked => { share-menu.open(0, - root.size - share-menu.menu-height - 4px); } } share-menu := ShareMenu { } } if root.gear: IconButton { icon: Icons.settings; - label: @tr("Settings"); + label: @tr("Voice Settings"); size: root.size; + round: root.round; + filled: root.filled; clicked => { Nav.open-settings(SettingsSection.voice); } } } diff --git a/docs/ui.md b/docs/ui.md index cdfc840..acb5f9e 100644 --- a/docs/ui.md +++ b/docs/ui.md @@ -143,9 +143,10 @@ there are at most ten, kept when a server is added), `TopBar` (the search, starting over the main panel, opens the search like Ctrl+K; the bell at the right), `MobileShell` (top bar, page, bottom navigation), `VoiceCard`, `VoiceButtons` (mute, deafen, share; `gear` adds -the voice settings), `UserCard` (its avatar and name open Settings → My -Account), `HoldToTalk`. Pages bring their own title; About is in the -settings (and on the phone's You page). +the voice settings; `round` and `filled` for the voice view's call bar), +`UserCard` (its avatar and name open Settings → My Account), `HoldToTalk`. +Pages bring their own title; About is in the settings (and on the phone's +You page). Voice parts (ui/screens/voice-parts.slint), for the desktop's voice view and the phone's voice screen: `Participant` (`member`, `size`: the avatar's) and @@ -167,7 +168,7 @@ comes from the engine's events; what a gateway adds is hidden without it. | Channel password | `channel-password`, `channel-password:wrong` | Joining a channel (a double-click in the tree, joining a friend) moves there with voice, or connects into it (by its id) without; when the server puts us elsewhere on connecting, as it does for a wrong password, it is joined again, which says why. A locked channel first asks for its password in `ChannelPasswordDialog`, unless one was given since voice connected; a refused one asks again under "Wrong password". A full channel or another refusal is a toast | `Presence` (`has_password`), `JoinFailed`; `Command::MoveToChannel`, `ConnectVoice` (`channel_password`) | | 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` | 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, Chat only, Voice Settings, Leave; the people as large avatars (talking ring and bars, muted, crown, streaming); the streams as cards (LIVE, viewers, kind, bitrate, sound, Watch Stream); the channel's chat | `Presence`, `Talking`, `StreamsChanged`, viewer counts from `StreamsChanged`, else the `Gateway` stream directory | +| 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 (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` | The channel's header with "5 in voice" and Leave; the player with the streamer, title, viewers, LIVE, the picture's height (the simulcast picker when a Voelin streamer offers layers), volume, elapsed time, what arrives (codec, size, frame rate, bitrate), back to the chat, pop out, full screen; a note that the stream belongs to the channel; the channel's chat and a Stream Info tab. Popped out (and in full screen) it fills the window | `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 @@ -415,6 +416,7 @@ live when they change (settings page, `--set`, another window): | `ui.narrow_breakpoint` | pixels | 800 | below this width the phone layout | | `ui.image_cache_mb` | megabytes | 256 | decoded images kept in memory (0: none) | | `ui.members_width` | pixels | 280 | width of the members panel (dragging its edge sets it) | +| `ui.voice_compact` | bool | false | the voice channel view's smaller stage (its Smaller stage / Larger stage button sets it; windows under 800 px tall always have it) | | `ui.image_preview_kb` | kilobytes | 8192 | pictures linked in chat (files and `[img]`) up to this size show as pictures (0: never) | | `notify.mentions`, `notify.private_messages`, `notify.pokes`, `notify.event_reminders`, `notify.friends_online` | off / app / desktop | desktop (friends: app) | what the bell and the desktop say about each kind | | `video.camera`, `video.background`, `video.resolution`, `video.mirror` | device id; none / blur; auto or WxH; bool | first camera, none, auto, true | the camera of the preview and the default of camera sources | @@ -491,7 +493,7 @@ Environment variables (see `src/dev.rs`): scrolled up), and a stream, without a server (nothing is stored). - `VOELIN_OPEN=[,...]`: `home`, `server` (`server:chat`: the server chat), `settings[:voice|keybinds|streaming|privacy|appearance|profiles]` (`identities` is the same as `profiles`), `about`, `share[:live]`, `bookmark[:edit]`, `emoji`, `client`, `panel`, `no-panel`, - `voice`, `pins`, `topics`, `topic:`, `member`, `poke`, + `voice` (`voice:compact`: the smaller stage, not stored), `pins`, `topics`, `topic:`, `member`, `poke`, `channel-password[:wrong]`, `actions` (the last message's actions, as if hovered: a screenshot cannot hover), `first-run` (Home's banner as before the first server, over the sample data), `link-confirm[:]` (the question