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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ
This commit is contained in:
Claude committed 2026-10-08 04:57:53 +00:00
1 parent 923f119ff6
commit 26c7d9c97c
11 files changed
+165 -35

No files matched your search

+17 -3
View File
@@ -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>();
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");
}
}
}
+3
View File
@@ -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));
});
+9 -2
View File
@@ -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>` (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),
+30 -2
View File
@@ -100,9 +100,25 @@ pub static UI_MEMBERS_WIDTH: Key<u32> = 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<bool> = 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();
+2
View File
@@ -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
+2
View File
@@ -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.
+12
View File
@@ -57,11 +57,17 @@ export global Nav {
in-out property <length> narrow-breakpoint: 800px;
// Wide enough for a third column (home, direct messages).
in-out property <bool> wide: true;
// Too short for the voice channel view's larger stage (under 800 px):
// it shows the smaller one.
in-out property <bool> short: false;
in-out property <bool> right-panel-open: true;
in-out property <length> right-panel-width: 280px;
// The voice channel we are in (people, streams, its chat) instead of
// the plain chat.
in-out property <bool> 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 <bool> voice-compact: false;
// Drawers in place of the members panel (gateway features).
in-out property <bool> pins-open;
in-out property <bool> 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 = "";
+65 -21
View File
@@ -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 <bool> 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;
+13 -2
View File
@@ -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 <length> size: 34px;
// The rail has the settings; the user card leaves them out.
in property <bool> gear: false;
in property <bool> round;
in property <bool> 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); }
}
}