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:
1 parent
26c7d9c97c
commit
e1b4a207c5
14 files changed
+254
-72
No files matched your search
@@ -50,7 +50,9 @@
|
||||
//! `integrations`, `advanced` (5-10);
|
||||
//! `studio[:<what>]`: 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 (`<name>-window.png`) and
|
||||
//! draws it over the main window.
|
||||
|
||||
@@ -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(""), "");
|
||||
}
|
||||
}
|
||||
@@ -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()));
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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".
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user