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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ
This commit is contained in:
Claude committed 2026-10-08 07:21:20 +00:00
1 parent 26c7d9c97c
commit e1b4a207c5
14 files changed
+254 -72

No files matched your search

+7
View File
@@ -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".
+17
View File
@@ -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 <length> cover-width;
in property <length> cover-height;
// 0: keep the left (top) edge, 1: the right (bottom) one.
in property <float> align-x: 0.5;
in property <float> align-y: 0.5;
property <float> 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;
}
@@ -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";
+1 -19
View File
@@ -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 <length> cover-width;
in property <length> cover-height;
// 0: keep the left (top) edge, 1: the right (bottom) one.
in property <float> align-x: 0.5;
in property <float> align-y: 0.5;
property <float> 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.
+22 -8
View File
@@ -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;
}
}
+68 -9
View File
@@ -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 <StreamItem> stream;
in property <bool> 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 <bool> watched: stream.watching && Bridge.viewer-has-frame;
property <bool> 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 <length> 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;