voelin-ui: the server screens of the new design

The server page had one layout: a channel tree, a chat and a panel of
members and streams. The design asks for more of it at once, so the same
page now carries the pieces it was missing.

The chat shows reactions, a pin marker, file cards and older messages,
and every message can be reacted to, pinned or made into a topic where
the gateway offers it. A compact voice bar sits over it with the
connected channel, who is talking and the voice controls, so the sidebar
card is no longer the only way to leave or mute.

The members panel groups people by server group with the group's icon,
shows the badges and talk power a TeamSpeak client expects, and opens a
card with the person's description, groups, private chat, poke, contact
and volume. Its width is the setting `ui.members_width`, so dragging the
handle keeps it.

Pins and topics are drawers over the chat, the voice channel can be seen
as a grid of tiles with the streams in it, and the stream viewer gained
the elapsed time, the viewer count, a quality picker, a mute button, the
chat beside the player and a pop-out that hides the shell.

The quality picker stays hidden for now: the engine tells a viewer
neither which simulcast layers a streamer offers nor lets it ask for
one, so there is nothing to choose between.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 5 committed 2026-09-29 18:38:04 +03:00
1 parent 489bef8174
commit ff7ef96b75
15 files changed
+1795 -184

No files matched your search

+4
View File
@@ -288,6 +288,8 @@ pub(crate) struct Models {
pub pins: Rc<VecModel<PinItem>>,
pub topics: Rc<VecModel<TopicItem>>,
pub topic_messages: Rc<VecModel<ChatLine>>,
/// The quality choices of the watched stream.
pub qualities: Rc<VecModel<slint::SharedString>>,
/// Shown when there is no chat.
pub no_chat: Rc<VecModel<ChatLine>>,
}
@@ -304,6 +306,7 @@ impl Models {
pins: Rc::default(),
topics: Rc::default(),
topic_messages: Rc::default(),
qualities: Rc::default(),
no_chat: Rc::default(),
};
bridge.set_servers(ModelRc::from(models.servers.clone()));
@@ -315,6 +318,7 @@ impl Models {
bridge.set_pins(ModelRc::from(models.pins.clone()));
bridge.set_topics(ModelRc::from(models.topics.clone()));
bridge.set_topic_messages(ModelRc::from(models.topic_messages.clone()));
bridge.set_viewer_qualities(ModelRc::from(models.qualities.clone()));
bridge.set_messages(ModelRc::from(models.no_chat.clone()));
models
}
+19 -2
View File
@@ -8,7 +8,7 @@ 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_NARROW_BREAKPOINT, UI_THEME,
ThemeChoice, UI_FONT_SCALE, UI_IMAGE_CACHE_MB, UI_MEMBERS_WIDTH, UI_NARROW_BREAKPOINT, UI_THEME,
};
impl App {
@@ -23,7 +23,12 @@ impl App {
let t = ui.global::<Theme>();
t.set_mode(theme.as_str().into());
t.set_font_scale(scale);
ui.global::<Nav>().set_narrow_breakpoint(breakpoint as f32);
let nav = ui.global::<Nav>();
nav.set_narrow_breakpoint(breakpoint as f32);
let width = self.prefs.get(&UI_MEMBERS_WIDTH) as f32;
if nav.get_right_panel_width() != width {
nav.set_right_panel_width(width);
}
let bridge = ui.global::<Bridge>();
bridge.set_appearance(AppearanceForm {
theme: theme.as_str().into(),
@@ -53,4 +58,16 @@ impl App {
// may not run the settings service (tests, a hosted engine).
self.apply_appearance();
}
/// The members panel was dragged to another width: store it, so it
/// comes back the same and `--set ui.members_width` can change it.
pub(crate) fn panel_resized(&mut self, width: f32) {
let width = width.max(0.0).round() as u32;
if self.prefs.get(&UI_MEMBERS_WIDTH) == width {
return;
}
if let Err(e) = self.prefs.set(&UI_MEMBERS_WIDTH, width) {
warn!(%e, "could not store the panel width");
}
}
}
+3 -1
View File
@@ -35,7 +35,9 @@ fn show(ui: &MainWindow, category: i32, list: Vec<PickerEmoji>) {
}
pub(super) fn wire(ui: &MainWindow) {
ui.global::<Images>().on_emoji(|key| images::emoji(&key));
let images_global = ui.global::<Images>();
images_global.on_emoji(|key| images::emoji(&key));
images_global.on_emoji_text(|key| emoji::text_of(&key).into());
let global = ui.global::<Emoji>();
let weak = ui.as_weak();
global.on_load(move || {
+3
View File
@@ -27,6 +27,9 @@ pub(super) fn wire(ui: &MainWindow) {
bridge.on_download_h264(|| {
with_app(|app| app.download_h264());
});
bridge.on_panel_resized(|width| {
with_app(|app| app.panel_resized(width));
});
bridge.on_appearance_changed(|form| {
with_app(|app| app.appearance_changed(&form));
});
+3
View File
@@ -37,4 +37,7 @@ pub(super) fn wire(ui: &MainWindow) {
bridge.on_toggle_fullscreen(|| {
with_app(|app| app.toggle_fullscreen());
});
bridge.on_set_stream_quality(|index| {
with_app(|app| app.set_stream_quality(index));
});
}
+1 -1
View File
@@ -253,7 +253,7 @@ fn key_of(cps: &[u32]) -> String {
/// The characters of an archive key, with U+FE0F after a lone character
/// that is text by default, so other clients show an emoji too.
fn text_of(key: &str) -> String {
pub fn text_of(key: &str) -> String {
let cps: Vec<u32> = key.split('-').filter_map(|p| u32::from_str_radix(p, 16).ok()).collect();
let mut text: String = cps.iter().filter_map(|&cp| char::from_u32(cp)).collect();
if cps.len() == 1 && !emoji_presentation(cps[0]) {
+11 -2
View File
@@ -91,9 +91,18 @@ pub static UI_IMAGE_CACHE_MB: Key<u32> = Key::new(
|| 64,
);
/// `ui.members_width`: how wide the members and streams panel is, in
/// pixels. Dragging its handle stores it; there is no built-in maximum.
pub static UI_MEMBERS_WIDTH: Key<u32> = Key::new(
"ui.members_width",
Kind::UInt { min: 0 },
"Width of the members and streams panel in pixels.",
|| 280,
);
/// The UI's keys besides [`UI`] and [`CLIENT_PLAYBACK`], for registering.
pub fn appearance_keys() -> [&'static dyn voelin_core::settings::Setting; 4] {
[&UI_THEME, &UI_FONT_SCALE, &UI_NARROW_BREAKPOINT, &UI_IMAGE_CACHE_MB]
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]
}
/// Frame rates and bitrates (kbit/s) the share dialog offers; any other
+82 -3
View File
@@ -6,7 +6,9 @@ use slint::{ComponentHandle, Model};
use tracing::warn;
use voelin_core::media::audio_source_specs;
use voelin_core::settings::{STREAM_AUDIO_SOURCES, STREAM_BITRATE_KBPS, STREAM_FPS};
use voelin_core::stream::{EndReason, LeaveReason, StreamSetup, ViewerInfo, ViewerState};
use voelin_core::stream::{
EndReason, LayerId, LayerSpec, LeaveReason, StreamSetup, ViewerInfo, ViewerState,
};
use voelin_core::{Command, Event, StreamState, WatchState};
use crate::app::{App, Bridge, ShareForm, SourceItem, StreamItem, ViewerItem, later, model};
@@ -42,6 +44,45 @@ pub(crate) struct Watch {
/// Shown instead of the chat.
shown: bool,
decoder: Option<Decoder>,
/// When the picture started, for the elapsed time.
since: Option<std::time::Instant>,
/// The simulcast layers the streamer offers, largest first.
layers: Vec<LayerSpec>,
/// The layer chosen by hand; `None` follows the bandwidth estimate.
layer: Option<LayerId>,
/// People watching the same stream, as the directory reports it.
viewers: u32,
}
impl Watch {
/// "12:34" since the picture started.
fn elapsed(&self) -> String {
let Some(since) = self.since else { return String::new() };
let seconds = since.elapsed().as_secs();
match seconds / 3600 {
0 => format!("{:02}:{:02}", seconds / 60, seconds % 60),
hours => format!("{hours}:{:02}:{:02}", (seconds / 60) % 60, seconds % 60),
}
}
/// "Auto" and one entry per layer the streamer offers.
fn qualities(&self) -> Vec<slint::SharedString> {
if self.layers.len() < 2 {
return Vec::new();
}
let mut names = vec![slint::SharedString::from("Auto")];
names.extend(self.layers.iter().map(|l| layer_name(l).into()));
names
}
}
/// "720p · 2.4 Mbit/s", or the scale when the size is not fixed.
fn layer_name(layer: &LayerSpec) -> String {
let size = match layer.size {
Some((_, h)) => format!("{h}p"),
None => format!("{:.0}%", layer.scale * 100.0),
};
format!("{size} · {:.1} Mbit/s", layer.bitrate as f64 / 1_000_000.0)
}
fn end_text(reason: &EndReason, streamer: &str) -> String {
@@ -272,13 +313,42 @@ impl App {
bridge.set_viewer_ended(watch.ended);
bridge.set_viewer_has_frame(watch.has_frame);
bridge.set_viewer_volume(self.stream_volume);
let info = watch.decoder.as_ref().map(Decoder::info).unwrap_or_default();
let info = [format!("by {}", watch.streamer), info]
let decoded = watch.decoder.as_ref().map(Decoder::info).unwrap_or_default();
let info = [format!("by {}", watch.streamer), decoded.clone()]
.into_iter()
.filter(|s| !s.is_empty())
.collect::<Vec<_>>()
.join(" · ");
bridge.set_viewer_info(info.into());
bridge.set_viewer_elapsed(watch.elapsed().into());
bridge.set_viewer_count(watch.viewers as i32);
let qualities = watch.qualities();
let chosen = watch
.layer
.and_then(|id| watch.layers.iter().position(|l| l.id == id))
.map_or(0, |i| i as i32 + 1);
crate::vm::list::sync(&self.models.qualities, &qualities);
if bridge.get_viewer_quality() != chosen {
bridge.set_viewer_quality(chosen);
}
bridge.set_viewer_quality_detail(decoded.into());
}
/// A simulcast layer of the watched stream (0: follow the bandwidth
/// estimate). The streamer picks the layer from each viewer's estimate,
/// so this asks for the picture again; a viewer-side choice needs an
/// engine API that does not exist yet.
pub(crate) fn set_stream_quality(&mut self, index: i32) {
let Some(watch) = &mut self.watch else { return };
watch.layer =
usize::try_from(index - 1).ok().and_then(|i| watch.layers.get(i)).map(|l| l.id);
if let Some(session) = watch.session {
self.engine.send(Command::RequestStreamKeyframe {
session: session as u64,
stream_id: watch.stream_id.clone(),
});
}
self.refresh_viewer();
}
/// Once a second: statistics, a capture that ended, decoder problems.
@@ -524,6 +594,10 @@ impl App {
has_frame: false,
shown: true,
decoder: Some(decoder),
since: None,
layers: Vec::new(),
layer: None,
viewers: 0,
});
self.refresh_viewer();
self.refresh_streams();
@@ -543,6 +617,10 @@ impl App {
has_frame: false,
shown: true,
decoder: None,
since: None,
layers: Vec::new(),
layer: None,
viewers: 0,
});
let runtime = self.engine.runtime().clone();
let wake = || later(|app| app.show_picture());
@@ -570,6 +648,7 @@ impl App {
watch.has_frame = true;
if first {
watch.status.clear();
watch.since = Some(std::time::Instant::now());
}
if let Some(ui) = self.ui.upgrade() {
let bridge = ui.global::<Bridge>();