From e1b4a207c549ba6544be6477174bf1dbea048cae Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 8 Oct 2026 06:25:08 +0000 Subject: [PATCH] ui: stream cards show the streamer's avatar on a painted scene TeamSpeak streams carry no thumbnail, and a peek would be a join request the streamer sees, so a stream card not being watched now shows the streamer: their avatar, ringed, with what they share, on the art scene tinted with their colour (Art moves from home.slint to components). The compact rows and the phone's Activity cards show the avatar too, and our own stream from the Stream Studio shows the studio's picture while live. StreamItem gets avatar, initials, tint and studio; the kind label is the pure vm::streams::kind_label, used by Home as well. In the demo, the studio going live announces our stream, and studio:live starts the studio itself, so studio:live,server,voice shows the card. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ --- CHANGELOG.md | 4 + crates/voelin-ui/src/dev.rs | 4 +- crates/voelin-ui/src/home.rs | 18 +---- crates/voelin-ui/src/streams.rs | 27 ++++--- crates/voelin-ui/src/studio.rs | 35 ++++++++- crates/voelin-ui/src/vm/mod.rs | 1 + crates/voelin-ui/src/vm/streams.rs | 69 +++++++++++++++++ crates/voelin-ui/ui/bridge.slint | 7 ++ crates/voelin-ui/ui/components/art.slint | 17 ++++ crates/voelin-ui/ui/components/index.slint | 1 + crates/voelin-ui/ui/screens/home.slint | 20 +---- crates/voelin-ui/ui/screens/streams.slint | 30 ++++++-- crates/voelin-ui/ui/screens/voice-parts.slint | 77 ++++++++++++++++--- docs/ui.md | 16 +++- 14 files changed, 254 insertions(+), 72 deletions(-) create mode 100644 crates/voelin-ui/src/vm/streams.rs create mode 100644 crates/voelin-ui/ui/components/art.slint diff --git a/CHANGELOG.md b/CHANGELOG.md index e9f7dc4..e01e217 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -134,6 +134,10 @@ User-visible changes of the apps and the `tsgw` gateway. The format follows - Private chats live on the Direct Messages page, not in the server's chat tabs, and their unread messages count there (on the phone, on the Home tab) instead of on the server rail. +- Stream cards show the streamer: their avatar on a painted scene in their + colour, with what they share, instead of a bare screen icon (TeamSpeak + streams have no preview pictures). Your own stream from the Stream Studio + shows its picture. - Banners: up to 128 MiB, more time on slow hosts, BMP and ICO too, and SVG after a comment or DOCTYPE; pictures larger than 4096 pixels on a side are scaled down. A banner that fails is tried again for as long as diff --git a/crates/voelin-ui/src/dev.rs b/crates/voelin-ui/src/dev.rs index d55ed10..a7ea489 100644 --- a/crates/voelin-ui/src/dev.rs +++ b/crates/voelin-ui/src/dev.rs @@ -50,7 +50,9 @@ //! `integrations`, `advanced` (5-10); //! `studio[:]`: the Stream Studio (with `VOELIN_DEMO_UI` a demo //! studio from synthetic sources), `studio:window` in a window of its own, -//! `studio:live` going live, `studio:record`, or a dialog: `studio:source`, +//! `studio:live` going live (also with a screen opened after it: +//! `studio:live,server,voice` shows our stream's card with the studio's +//! picture), `studio:record`, or a dialog: `studio:source`, //! `studio:audio`, `studio:camera`, `studio:scene`, `studio:settings`. //! A screenshot also saves the studio's window (`-window.png`) and //! draws it over the main window. diff --git a/crates/voelin-ui/src/home.rs b/crates/voelin-ui/src/home.rs index aa0c5ac..5686519 100644 --- a/crates/voelin-ui/src/home.rs +++ b/crates/voelin-ui/src/home.rs @@ -24,12 +24,6 @@ pub(crate) enum Happening { News(i64), } -/// "screen" → "Screen". -fn kind_label(kind: &str) -> String { - let mut chars = kind.chars(); - chars.next().map(|c| c.to_uppercase().chain(chars).collect()).unwrap_or_default() -} - impl App { /// Streams on our servers: those the server lists (any channel; we can /// watch them at once), the gateways' directories, and clients flagged @@ -75,13 +69,7 @@ impl App { let mut room = item(s.id.clone(), title, Some(s.streamer.0), None, name); room.channel = channel_of(view.channel_of(s.streamer.0)).into(); room.viewers = view.stream_viewers.get(&s.id).map_or(0, |v| *v as i32); - room.kind = match s.kind { - voelin_core::stream::StreamKind::Screen => "Screen", - voelin_core::stream::StreamKind::Window => "Window", - voelin_core::stream::StreamKind::Camera => "Camera", - voelin_core::stream::StreamKind::Other(_) => "", - } - .into(); + room.kind = vm::streams::kind_label(&s.kind).into(); room.watchable = view.state.own_client != Some(s.streamer.0); covered.push(s.streamer.0); rooms.push(room); @@ -105,7 +93,7 @@ impl App { ); room.channel = channel_of(e.channel).into(); room.viewers = e.viewers.map_or(0, |v| v as i32); - room.kind = kind_label(&e.kind).into(); + room.kind = vm::streams::directory_kind_label(&e.kind).into(); covered.extend(e.client_id); rooms.push(room); } @@ -384,7 +372,5 @@ mod tests { assert!(items.iter().any(|i| i.clip && i.detail.starts_with("2 B"))); assert!(recordings_in(&dir.join("missing")).is_empty()); std::fs::remove_dir_all(&dir).unwrap(); - assert_eq!(kind_label("screen"), "Screen"); - assert_eq!(kind_label(""), ""); } } diff --git a/crates/voelin-ui/src/streams.rs b/crates/voelin-ui/src/streams.rs index 2eb6416..810fd11 100644 --- a/crates/voelin-ui/src/streams.rs +++ b/crates/voelin-ui/src/streams.rs @@ -11,7 +11,7 @@ use voelin_core::settings::{ AudioSourceSetting, STREAM_AUDIO_SOURCES, STREAM_BITRATE_KBPS, STREAM_FPS, }; use voelin_core::stream::{ - EndReason, LayerId, LayerSpec, LeaveReason, StreamKind, StreamSetup, ViewerInfo, ViewerState, + EndReason, LayerId, LayerSpec, LeaveReason, StreamSetup, ViewerInfo, ViewerState, }; use voelin_core::{Command, Event, StreamState, WatchState}; @@ -295,29 +295,30 @@ impl App { let own_channel = view.state.own_channel; let mut streams: Vec<_> = view.streams.iter().collect(); streams.sort_by_key(|s| view.channel_of(s.streamer.0) != own_channel); + // Our own stream from the studio shows its preview. + let studio = current.is_some_and(|c| self.studio_streams_to(c)); for s in streams { let watching = self .watch .as_ref() .is_some_and(|w| w.session == current && w.stream_id == s.id && !w.ended); + let own = view.state.own_client == Some(s.streamer.0); items.push(StreamItem { id: s.id.clone().into(), name: s.name.clone().into(), - streamer: view.nickname(s.streamer.0).into(), channel: view.other_channel_name(s.streamer.0).into(), streamer_id: i32::from(s.streamer.0), viewers: viewer_count(view, &s.id).unwrap_or(0) as i32, audio: s.audio, watching, - own: view.state.own_client == Some(s.streamer.0), - kind: match s.kind { - StreamKind::Screen => "Screen", - StreamKind::Window => "Window", - StreamKind::Camera => "Camera", - StreamKind::Other(_) => "", - } - .into(), + own, + studio: own && studio, + kind: crate::vm::streams::kind_label(&s.kind).into(), bitrate: bitrate_text(s.bitrate).into(), + ..crate::vm::streams::streamer( + &view.nickname(s.streamer.0), + view.avatar(s.streamer.0), + ) }); } // Streams that started before we joined, or in another channel: @@ -329,10 +330,9 @@ impl App { if c.streaming == Some(true) && !announced && view.state.own_client != Some(c.id) { items.push(StreamItem { name: c.nickname.clone().into(), - streamer: c.nickname.clone().into(), channel: view.other_channel_name(c.id).into(), streamer_id: i32::from(c.id), - ..StreamItem::default() + ..crate::vm::streams::streamer(&c.nickname, view.avatar(c.id)) }); } } @@ -341,11 +341,10 @@ impl App { items.push(StreamItem { id: "demo".into(), name: "Test pattern".into(), - streamer: "local preview".into(), audio: false, watching: self.watch.as_ref().is_some_and(|w| w.session.is_none() && !w.ended), own: false, - ..StreamItem::default() + ..crate::vm::streams::streamer("local preview", None) }); } bridge.set_streams_available(self.demo || view.is_some_and(|v| v.streams_available())); diff --git a/crates/voelin-ui/src/studio.rs b/crates/voelin-ui/src/studio.rs index 0d20385..8078c93 100644 --- a/crates/voelin-ui/src/studio.rs +++ b/crates/voelin-ui/src/studio.rs @@ -36,7 +36,9 @@ use voelin_core::settings::{ STREAM_BITRATE_KBPS, STREAM_LAYERS, STUDIO_RECORDING_DIR, STUDIO_REPLAY_MEMORY_MB, STUDIO_REPLAY_SECONDS, STUDIO_SCENES, Settings, layer_specs, }; -use voelin_core::stream::{EndReason, LayerSpec, StreamSetup, ViewerInfo, ViewerState}; +use voelin_core::stream::{ + EndReason, LayerSpec, StreamInfo, StreamKind, StreamSetup, ViewerInfo, ViewerState, +}; use voelin_core::studio::scene::{ Align, Background, Colour, Crop, Fit, Scene, Scenes, Source, SourceKind, Transform, }; @@ -1998,6 +2000,7 @@ impl App { pub(crate) fn studio_end(&mut self) { let Some(out) = &self.studio.stream else { return }; if self.demo_ui { + self.studio_demo_announce(false); self.studio_ended(None); } else { self.engine.send(Command::StopStream { session: out.session as u64 }); @@ -2170,6 +2173,12 @@ impl App { match what { "" => {} "window" => self.studio_detach(), + // Started here: a screen opened after it (`studio:live,server`) + // leaves the studio page before it is drawn, which starts it. + "live" => { + self.studio.dev.push(what.into()); + self.studio_open(); + } other => self.studio.dev.push(other.into()), } } @@ -2245,6 +2254,30 @@ impl App { viewer(6, ViewerState::Requested, 0), ]; } + self.studio_demo_announce(true); self.studio_now_live(); } + + /// VOELIN_DEMO_UI: the sample server announces our stream, or its end, + /// as a server would (the voice view shows its card). + fn studio_demo_announce(&mut self, live: bool) { + let Some(session) = self.studio.stream.as_ref().map(|s| s.session) else { return }; + let name = stream_name(&self.studio.ui); + let audio = self.studio.ui.audio; + let Some(view) = self.sessions.get_mut(&session) else { return }; + view.streams.retain(|s| s.id != "demo-studio"); + if live && let Some(own) = view.state.own_client { + view.streams.push(StreamInfo { + id: "demo-studio".into(), + streamer: tsclientlib::ClientId(own), + name, + kind: StreamKind::Screen, + bitrate: 8000, + viewer_limit: 0, + audio, + viewers: Some(3), + }); + } + self.refresh_streams(); + } } diff --git a/crates/voelin-ui/src/vm/mod.rs b/crates/voelin-ui/src/vm/mod.rs index 661237e..bee6a0a 100644 --- a/crates/voelin-ui/src/vm/mod.rs +++ b/crates/voelin-ui/src/vm/mod.rs @@ -10,5 +10,6 @@ pub mod home; pub mod list; pub mod servers; pub mod social; +pub mod streams; pub mod studio; pub mod tree; diff --git a/crates/voelin-ui/src/vm/streams.rs b/crates/voelin-ui/src/vm/streams.rs new file mode 100644 index 0000000..f922a4b --- /dev/null +++ b/crates/voelin-ui/src/vm/streams.rs @@ -0,0 +1,69 @@ +//! Streams on the voice view, the phone's Activity tab and Home: what is +//! shared, and who shares it. + +use std::path::PathBuf; + +use voelin_core::stream::StreamKind; + +use crate::app::StreamItem; +use crate::vm::avatar; + +/// "Screen", "Window", "Camera"; "" for a kind we do not know. +pub fn kind_label(kind: &StreamKind) -> &'static str { + match kind { + StreamKind::Screen => "Screen", + StreamKind::Window => "Window", + StreamKind::Camera => "Camera", + StreamKind::Other(_) => "", + } +} + +/// A gateway directory's kind as a label: "screen" → "Screen". +pub fn directory_kind_label(kind: &str) -> String { + let mut chars = kind.chars(); + chars.next().map(|c| c.to_uppercase().chain(chars).collect()).unwrap_or_default() +} + +/// A stream with its streamer: the name, and the avatar as the members +/// show it (the picture from the engine's cache, else the initials on the +/// name's colour). The caller fills in the rest. +pub fn streamer(name: &str, picture: Option<&PathBuf>) -> StreamItem { + StreamItem { + streamer: name.into(), + initials: avatar::initials(name).into(), + tint: avatar::tint(name), + avatar: avatar::image(picture), + ..StreamItem::default() + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn kinds_have_labels() { + assert_eq!(kind_label(&StreamKind::Screen), "Screen"); + assert_eq!(kind_label(&StreamKind::Window), "Window"); + assert_eq!(kind_label(&StreamKind::Camera), "Camera"); + assert_eq!(kind_label(&StreamKind::Other(9)), ""); + assert_eq!(kind_label(&StreamKind::from_u8(2)), "Camera"); + } + + #[test] + fn directory_kinds_are_capitalised() { + assert_eq!(directory_kind_label("screen"), "Screen"); + assert_eq!(directory_kind_label("Camera"), "Camera"); + assert_eq!(directory_kind_label(""), ""); + } + + #[test] + fn streamers_look_as_in_the_members() { + let item = streamer("Nova Star", None); + assert_eq!(item.streamer, "Nova Star"); + assert_eq!(item.initials, "NS"); + assert_eq!(item.tint, avatar::tint("Nova Star")); + assert_eq!(item.avatar.size(), slint::Image::default().size()); + assert!(item.id.is_empty() && !item.own && !item.studio); + } +} diff --git a/crates/voelin-ui/ui/bridge.slint b/crates/voelin-ui/ui/bridge.slint index 9353f97..ea8ab5a 100644 --- a/crates/voelin-ui/ui/bridge.slint +++ b/crates/voelin-ui/ui/bridge.slint @@ -316,6 +316,11 @@ export struct StreamItem { channel: string, // The streamer's client id (their avatar in the members). streamer-id: int, + // The streamer's avatar, as the members show it: their picture, or + // their initials on their colour (also the card's picture's colour). + initials: string, + tint: color, + avatar: image, // How many watch it (the gateway's directory; 0 unknown). viewers: int, audio: bool, @@ -326,6 +331,8 @@ export struct StreamItem { watching: bool, // Our own stream. own: bool, + // Ours from the Stream Studio: its preview is the card's picture. + studio: bool, } // A viewer of our stream. state: "requested", "connecting" or "connected". diff --git a/crates/voelin-ui/ui/components/art.slint b/crates/voelin-ui/ui/components/art.slint new file mode 100644 index 0000000..e568ec9 --- /dev/null +++ b/crates/voelin-ui/ui/components/art.slint @@ -0,0 +1,17 @@ +// A painted picture (Icons.art-*) covering an area of the given size, cut +// at the sides or at the bottom by the parent's clip. Drawn at its own +// aspect ratio: with `image-fit: cover` the renderer would draw the SVG at +// another size and stretch it, which looks jagged. +export component Art inherits Image { + in property cover-width; + in property cover-height; + // 0: keep the left (top) edge, 1: the right (bottom) one. + in property align-x: 0.5; + in property align-y: 0.5; + property ratio: self.source.width * 1.0 / max(1, self.source.height); + width: max(root.cover-width, root.cover-height * root.ratio); + height: self.width / root.ratio; + x: (root.cover-width - self.width) * root.align-x; + y: (root.cover-height - self.height) * root.align-y; + image-fit: fill; +} diff --git a/crates/voelin-ui/ui/components/index.slint b/crates/voelin-ui/ui/components/index.slint index c1e7acd..740f11b 100644 --- a/crates/voelin-ui/ui/components/index.slint +++ b/crates/voelin-ui/ui/components/index.slint @@ -10,6 +10,7 @@ export { Slider } from "slider.slint"; export { SegmentedTabs, TabItem } from "tabs.slint"; export { Status, Avatar } from "avatar.slint"; export { BannerPicture } from "banner-picture.slint"; +export { Art } from "art.slint"; export { CountBadge, LiveBadge, Chip, BadgeIcons, Dot } from "badge.slint"; export { SectionHeader, Card, Divider, Banner } from "card.slint"; export { Meter, SpeakingBars } from "meter.slint"; diff --git a/crates/voelin-ui/ui/screens/home.slint b/crates/voelin-ui/ui/screens/home.slint index ff68843..88b5164 100644 --- a/crates/voelin-ui/ui/screens/home.slint +++ b/crates/voelin-ui/ui/screens/home.slint @@ -10,28 +10,10 @@ import { Theme } from "../theme.slint"; import { Icons } from "../icons.slint"; import { Bridge, ServerItem, ContactItem, LiveItem, ConversationItem, HappeningItem, RecordingItem, ResumeItem } from "../bridge.slint"; import { Nav, Page, SettingsSection } from "../nav.slint"; -import { Icon, Button, ButtonKind, IconButton, Avatar, Status, Chip, SectionHeader, NavItem, Divider, CountBadge, LiveBadge, ScrollView, ListView } from "../components/index.slint"; +import { Icon, Button, ButtonKind, IconButton, Avatar, Status, Chip, SectionHeader, NavItem, Divider, CountBadge, LiveBadge, Art, ScrollView, ListView } from "../components/index.slint"; import { ConversationRow } from "messages.slint"; import { NoticeRow } from "overlays.slint"; -// A painted picture (Icons.art-*) covering an area of the given size, cut -// at the sides or at the bottom by the parent's clip. Drawn at its own -// aspect ratio: with `image-fit: cover` the renderer would draw the SVG at -// another size and stretch it, which looks jagged. -component Art inherits Image { - in property cover-width; - in property cover-height; - // 0: keep the left (top) edge, 1: the right (bottom) one. - in property align-x: 0.5; - in property align-y: 0.5; - property ratio: self.source.width * 1.0 / max(1, self.source.height); - width: max(root.cover-width, root.cover-height * root.ratio); - height: self.width / root.ratio; - x: (root.cover-width - self.width) * root.align-x; - y: (root.cover-height - self.height) * root.align-y; - image-fit: fill; -} - // The sidebar next to the home page, the friends, the messages and the // Library. Under its links the newest private chats, except on the // messages page, which lists them all. diff --git a/crates/voelin-ui/ui/screens/streams.slint b/crates/voelin-ui/ui/screens/streams.slint index 08d9e7c..b7452a4 100644 --- a/crates/voelin-ui/ui/screens/streams.slint +++ b/crates/voelin-ui/ui/screens/streams.slint @@ -5,7 +5,7 @@ import { Theme } from "../theme.slint"; import { Icons } from "../icons.slint"; import { Bridge, StreamItem, MemberItem } from "../bridge.slint"; import { Nav } from "../nav.slint"; -import { Icon, Button, ButtonKind, IconButton, Avatar, Status, LiveBadge, Chip, Select, SectionHeader, SpeakingBars, Slider, Spinner, TextField, TabItem, ListView, ScrollView } from "../components/index.slint"; +import { Icon, Button, ButtonKind, IconButton, Avatar, Status, LiveBadge, Chip, Select, SectionHeader, SpeakingBars, Slider, Spinner, TextField, TabItem, Art, ListView, ScrollView } from "../components/index.slint"; import { MemberRow, GroupHeader } from "members.slint"; import { PageHeader, MessageList, Composer } from "chat.slint"; @@ -23,20 +23,34 @@ component StreamCard inherits Rectangle { spacing: Theme.space-3; HorizontalLayout { spacing: Theme.space-3; - // A picture-less preview: the live mark on a gradient. + // No picture before watching (the protocol has none): the + // streamer's avatar on a painted scene in their colour, LIVE + // under it. Rectangle { width: 64px; height: 40px; border-radius: Theme.radius-sm; + clip: true; background: @linear-gradient(135deg, #2b1f6e 0%, #0f2a66 100%); - Icon { - source: Icons.monitor-up; - size: Theme.icon-md; - tint: #ffffffc0; + Art { + source: Icons.art-scenes[mod(stream.streamer-id, 3)]; + cover-width: parent.width; + cover-height: parent.height; + align-y: 0.3; + } + Rectangle { + background: stream.tint.with-alpha(0.3); + } + Avatar { + y: 3px; + size: 28px; + initials: stream.initials; + tint: stream.tint; + image: stream.avatar; + label: stream.streamer; } if stream.id != "": LiveBadge { - x: 3px; - y: 3px; + y: parent.height - self.height - 1px; height: 14px; } } diff --git a/crates/voelin-ui/ui/screens/voice-parts.slint b/crates/voelin-ui/ui/screens/voice-parts.slint index 1a2cd16..2a22f5d 100644 --- a/crates/voelin-ui/ui/screens/voice-parts.slint +++ b/crates/voelin-ui/ui/screens/voice-parts.slint @@ -5,7 +5,8 @@ import { Theme } from "../theme.slint"; import { Icons } from "../icons.slint"; import { Bridge, MemberItem, StreamItem } from "../bridge.slint"; -import { Icon, Button, ButtonKind, Avatar, LiveBadge, Chip, SpeakingBars } from "../components/index.slint"; +import { StudioBridge } from "../studio-bridge.slint"; +import { Icon, Button, ButtonKind, Avatar, LiveBadge, Chip, SpeakingBars, Art } from "../components/index.slint"; // One person: an avatar with a ring (green while talking, blue while // streaming), the muted mark, the name with the crown, and what they do. @@ -110,11 +111,16 @@ export component Participant inherits VerticalLayout { // A stream in the channel: LIVE, the title, who streams it, and Watch (or // Show, while we watch it). A large card with the picture while we watch -// it, the viewers, the kind, the bitrate and the sound; compact, a row that +// it (else the streamer on a painted scene), the viewers, the kind, the +// bitrate and the sound; compact, a row with the streamer's avatar that // says where it is. export component StreamCard inherits Rectangle { in property stream; in property compact; + // The picture: the stream while we watch it (the viewer hidden behind + // the chat), or our own from the studio while it is live. + property watched: stream.watching && Bridge.viewer-has-frame; + property previewed: stream.studio && StudioBridge.status.live && StudioBridge.has-preview; height: compact ? 76px : 236px; border-radius: Theme.radius-lg; clip: true; @@ -125,17 +131,58 @@ export component StreamCard inherits Rectangle { accessible-role: AccessibleRole.groupbox; accessible-label: stream.name; if !root.compact: Rectangle { - // The picture while we watch it (the viewer hidden behind the chat). - if stream.watching && Bridge.viewer-has-frame: Image { + if root.watched || root.previewed: Image { width: parent.width; height: parent.height; - source: Bridge.viewer-frame; + source: root.watched ? Bridge.viewer-frame : StudioBridge.preview; image-fit: cover; } - if !(stream.watching && Bridge.viewer-has-frame): Icon { - source: stream.kind == "Camera" ? Icons.video : Icons.monitor-up; - size: 72px; - tint: #ffffff22; + // Else (the protocol has no thumbnails: a picture means joining) + // a painted scene in the streamer's colour, their avatar ringed as + // streaming between LIVE and the title, and what they share. + if !root.watched && !root.previewed: scene := Rectangle { + // The ring: 80 px, less on a narrow card. + property ring: max(32px, min(80px, self.width - 2 * Theme.space-3)); + Art { + source: Icons.art-scenes[mod(root.stream.streamer-id, 3)]; + cover-width: parent.width; + cover-height: parent.height; + align-y: 0.3; + } + Rectangle { + background: root.stream.tint.with-alpha(0.3); + } + Rectangle { + x: (parent.width - self.width) / 2; + y: 52px + (80px - self.height) / 2; + width: scene.ring; + height: self.width; + border-radius: self.width / 2; + border-width: 3px; + border-color: Theme.accent; + Avatar { + size: parent.width - 8px; + initials: root.stream.initials; + tint: root.stream.tint; + image: root.stream.avatar; + label: root.stream.streamer; + } + Rectangle { + x: parent.width - self.width + 2px; + y: parent.height - self.height + 2px; + width: max(20px, parent.width * 0.35); + height: self.width; + border-radius: self.width / 2; + background: Theme.accent; + border-width: 2px; + border-color: Theme.surface; + Icon { + source: root.stream.kind == "Camera" ? Icons.video : root.stream.kind == "Window" ? Icons.app-window : Icons.monitor; + size: parent.width / 2; + tint: Theme.on-accent; + } + } + } } // Darker at the bottom, for the text. Rectangle { @@ -167,6 +214,18 @@ export component StreamCard inherits Rectangle { padding-left: Theme.space-4; padding-top: root.compact ? Theme.space-3 : 0px; spacing: Theme.space-3; + // Centred beside the text (with a `y` of its own it stayed at the + // top of the row). + if root.compact: VerticalLayout { + alignment: center; + Avatar { + size: 40px; + initials: root.stream.initials; + tint: root.stream.tint; + image: root.stream.avatar; + label: root.stream.streamer; + } + } VerticalLayout { alignment: root.compact ? LayoutAlignment.center : LayoutAlignment.end; horizontal-stretch: 1; diff --git a/docs/ui.md b/docs/ui.md index acb5f9e..efaf564 100644 --- a/docs/ui.md +++ b/docs/ui.md @@ -110,6 +110,7 @@ puts them on an inner `face`). | `SegmentedTabs` | tabs.slint | `model`, `current-index`, `label`; `selected(int)` | | `TabItem` | tabs.slint | underlined tab: `text`, `selected`, `badge`, `closable`; `clicked`, `close` | | `Avatar` | avatar.slint | `image` or `initials` + `tint` (one letter under 28 px, through `Images.first-letter`), `size`, `status` (`Status.online/idle/dnd/offline/info`), `speaking` (green ring), `crown`, `square` (server icons); a server icon at most half as wide (TeamSpeak's 16 px ones) is drawn at twice its size, sharp, on the tint (a person's picture always fills it) | +| `Art` | art.slint | a painted picture (`Icons.art-*`) covering `cover-width` × `cover-height` at its own aspect ratio, cut by the parent's clip; `align-x`, `align-y` (0 keeps the left or top edge, 1 the other); home's banner and cards, the stream cards | | `CountBadge` | badge.slint | count bubble: `count`, `fill` (red), `ink` (the number) | | `LiveBadge` | badge.slint | `text` (LIVE), `large` | | `Chip` | badge.slint | tag: `text`, `icon`, `picture` (in its own colours, a badge's), `tint`, `fill`, `outlined` | @@ -152,7 +153,11 @@ 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 `StreamCard` (`stream`), both with `compact`, the phone's smaller look (a person ringed only while talking or streaming, LIVE below the name; a stream -as a row). +as a row with the streamer's avatar). The protocol has no thumbnails (a +picture means joining the stream, which the streamer sees as a request), so +a stream card shows the stream only while we watch it, and our own from the +Stream Studio its preview while live; otherwise the streamer's avatar, +ringed, with what they share, on a painted scene in their colour. ## The server page @@ -168,13 +173,14 @@ 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`, `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 | +| 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` | 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 closes the other, and the members button brings the panel back. On the phone the chat is the Chat tab and the members of our channel are on the -Activity tab. The Chat tab counts the server's unread chats; private chats +Activity tab, with the streams (the streamer's avatar on their colour, Watch, +Show and Leave). The Chat tab counts the server's unread chats; private chats count on the Home tab, where the direct messages are. ## Home, friends, messages and the settings pages @@ -511,7 +517,9 @@ Environment variables (see `src/dev.rs`): `profiles`, `devices`, `notifications`, `integrations`, `advanced` (above). With sample data, `watch` plays the local test pattern in the sample stream's place. `studio[:window|live|record|source|audio|camera|scene|settings]` - opens the Stream Studio (above) in that state; with its window open a + opens the Stream Studio (above) in that state (`studio:live` also with a + screen opened after it: `studio:live,server,voice` shows our stream's card + with the studio's picture); with its window open a screenshot also saves the window alone (`-window.png`) and draws it over the main window. - `VOELIN_WINDOW_SIZE=390x844`: window size (phone layout below the breakpoint).