Pop out now opens ViewerWindow: the player alone, titled with the stream, which a pin keeps on top of other windows (always-on-top). The main window goes on; the stream's card on the voice page says it plays in its own window, with Bring back; closing the window brings it back too, on the stream's server, and Leave closes it. Pictures go only to the window that shows the player, so none is scaled twice; full screen and the cursor follow that window. The stream callbacks take a Bridge, the models attach to any Bridge, the theme is copied to every window of its own, and one main-window close handler, installed at start, closes the studio's and the stream's windows (the studio installed its own before). Desktop only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ
669 lines
27 KiB
Plaintext
669 lines
27 KiB
Plaintext
// Streams: the phone's panel (people in our channel, streams, requests to
|
|
// watch ours) and the viewer.
|
|
|
|
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, Art, ListView, ScrollView } from "../components/index.slint";
|
|
import { MemberRow, GroupHeader } from "members.slint";
|
|
import { PageHeader, MessageList, Composer } from "chat.slint";
|
|
|
|
// A stream card: the streamer, the title, watch / show / leave.
|
|
component StreamCard inherits Rectangle {
|
|
in property <StreamItem> stream;
|
|
border-radius: Theme.radius-lg;
|
|
background: stream.watching ? Theme.accent-soft : Theme.surface-2;
|
|
border-width: 1px;
|
|
border-color: stream.watching ? Theme.accent : Theme.border;
|
|
accessible-role: AccessibleRole.groupbox;
|
|
accessible-label: stream.name;
|
|
VerticalLayout {
|
|
padding: Theme.space-4;
|
|
spacing: Theme.space-3;
|
|
HorizontalLayout {
|
|
spacing: Theme.space-3;
|
|
// 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%);
|
|
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 {
|
|
y: parent.height - self.height - 1px;
|
|
height: 14px;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
Text {
|
|
text: stream.id == "" ? @tr("{} is streaming", stream.streamer) : stream.name == "" ? @tr("Untitled stream") : stream.name;
|
|
color: Theme.text;
|
|
font-weight: Theme.weight-semibold;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: stream.id == "" ? (stream.channel == "" ? @tr("Started before you joined; looking it up…") : @tr("In {}; looking it up…", stream.channel))
|
|
: stream.own ? @tr("your stream")
|
|
: stream.channel != "" ? @tr("by {} · in {}", stream.streamer, stream.channel)
|
|
: stream.audio ? @tr("by {} · with sound", stream.streamer) : @tr("by {}", stream.streamer);
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
}
|
|
if stream.id != "" && !stream.own: HorizontalLayout {
|
|
spacing: Theme.space-2;
|
|
if !stream.watching: Button {
|
|
horizontal-stretch: 1;
|
|
small: true;
|
|
kind: ButtonKind.primary;
|
|
icon: Icons.eye;
|
|
text: @tr("Watch");
|
|
accessible-label: @tr("Watch {}", stream.name);
|
|
clicked => { Bridge.watch-stream(stream.id); }
|
|
}
|
|
// Also back from a window of its own.
|
|
if stream.watching && !Bridge.viewer-open: Button {
|
|
horizontal-stretch: 1;
|
|
small: true;
|
|
icon: Bridge.viewer-popped ? Icons.minimize-2 : Icons.monitor;
|
|
text: Bridge.viewer-popped ? @tr("Bring back") : @tr("Show");
|
|
clicked => { Bridge.show-viewer(); }
|
|
}
|
|
if stream.watching: Button {
|
|
horizontal-stretch: 1;
|
|
small: true;
|
|
kind: ButtonKind.danger;
|
|
icon: Icons.log-out;
|
|
text: @tr("Leave");
|
|
clicked => { Bridge.leave-stream(); }
|
|
}
|
|
}
|
|
if stream.id == "": Spinner {
|
|
size: 16px;
|
|
}
|
|
}
|
|
}
|
|
|
|
// The right panel of a server: who is in our channel, the streams there,
|
|
// and requests to watch ours.
|
|
export component StreamsPanel inherits VerticalLayout {
|
|
padding: Theme.space-4;
|
|
spacing: Theme.space-3;
|
|
HorizontalLayout {
|
|
Text {
|
|
text: Bridge.own-channel != "" ? @tr("In voice — {} ({})", Bridge.own-channel, Bridge.members.length) : @tr("Members");
|
|
font-size: Theme.font-lg;
|
|
font-weight: Theme.weight-semibold;
|
|
color: Theme.text;
|
|
horizontal-stretch: 1;
|
|
overflow: elide;
|
|
vertical-alignment: center;
|
|
}
|
|
// The phone's voice channel screen.
|
|
if Bridge.voice-connected: IconButton {
|
|
icon: Icons.chevron-right;
|
|
label: @tr("Open the voice channel");
|
|
size: 28px;
|
|
icon-size: Theme.icon-sm;
|
|
clicked => { Nav.show-voice(true); }
|
|
}
|
|
}
|
|
if Bridge.members.length == 0: Text {
|
|
text: @tr("Join a channel with voice to see who is there.");
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
wrap: word-wrap;
|
|
}
|
|
sv := ScrollView {
|
|
vertical-stretch: 1;
|
|
VerticalLayout {
|
|
width: sv.visible-width;
|
|
spacing: Theme.space-2;
|
|
alignment: start;
|
|
for member in Bridge.members: VerticalLayout {
|
|
if member.first-in-group: GroupHeader {
|
|
member: member;
|
|
}
|
|
MemberRow {
|
|
member: member;
|
|
}
|
|
}
|
|
if Bridge.streams-available: VerticalLayout {
|
|
padding-top: Theme.space-4;
|
|
spacing: Theme.space-3;
|
|
HorizontalLayout {
|
|
spacing: Theme.space-2;
|
|
SectionHeader {
|
|
text: @tr("Streams");
|
|
icon: Icons.radio;
|
|
count: Bridge.streams.length;
|
|
small: true;
|
|
}
|
|
if Bridge.share-state == "live": VerticalLayout {
|
|
alignment: center;
|
|
LiveBadge { text: @tr("YOU ARE LIVE"); }
|
|
}
|
|
}
|
|
if Bridge.streams.length == 0: Text {
|
|
text: @tr("No streams on this server.");
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
}
|
|
for stream in Bridge.streams: StreamCard {
|
|
stream: stream;
|
|
}
|
|
if Bridge.share-state == "live" || Bridge.share-state == "starting": Button {
|
|
icon: Icons.users;
|
|
text: Bridge.share-requests > 0 ? @tr("Viewers ({})", Bridge.share-requests) : @tr("Manage");
|
|
kind: Bridge.share-requests > 0 ? ButtonKind.primary : ButtonKind.secondary;
|
|
clicked => { Nav.open-share(); }
|
|
}
|
|
for viewer in Bridge.share-viewers: HorizontalLayout {
|
|
spacing: Theme.space-2;
|
|
if viewer.state == "requested": Text {
|
|
text: @tr("{} wants to watch", viewer.name);
|
|
horizontal-stretch: 1;
|
|
vertical-alignment: center;
|
|
overflow: elide;
|
|
color: Theme.warning;
|
|
}
|
|
if viewer.state == "requested": Button {
|
|
small: true;
|
|
kind: ButtonKind.primary;
|
|
text: @tr("Accept");
|
|
clicked => { Bridge.respond-viewer(viewer.client, true); }
|
|
}
|
|
if viewer.state == "requested": Button {
|
|
small: true;
|
|
text: @tr("Deny");
|
|
clicked => { Bridge.respond-viewer(viewer.client, false); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// The simulcast layers the streamer offers ("Auto" follows the bandwidth
|
|
// estimate), else the height of the picture that arrives.
|
|
component StreamQuality inherits HorizontalLayout {
|
|
// Over the picture: white on a dark fill.
|
|
in property <bool> on-picture;
|
|
if Bridge.viewer-qualities.length > 1: Select {
|
|
width: 150px;
|
|
horizontal-stretch: 0;
|
|
icon: Icons.sliders-horizontal;
|
|
label: @tr("Quality");
|
|
model: Bridge.viewer-qualities;
|
|
current-index <=> Bridge.viewer-quality;
|
|
y: (parent.height - self.height) / 2;
|
|
selected(_) => { Bridge.set-stream-quality(Bridge.viewer-quality); }
|
|
}
|
|
if Bridge.viewer-qualities.length <= 1 && Bridge.viewer-has-frame: Chip {
|
|
text: @tr("{}p", Bridge.viewer-frame.height);
|
|
tint: root.on-picture ? #ffffff : Theme.text-secondary;
|
|
fill: root.on-picture ? #060a18b0 : Theme.surface-3;
|
|
outlined: true;
|
|
height: 26px;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
}
|
|
|
|
// The player: the picture with the controls over its bottom. `compact`
|
|
// (full screen, the phone, a window of its own) also has the streamer, the
|
|
// title and LIVE over its top, and Leave; otherwise the header shows them.
|
|
//
|
|
// The controls hide 2.5 s after the pointer last moved over the picture,
|
|
// once it has been there (in full screen it is), and come back when it
|
|
// moves; with the pointer elsewhere, as in a screenshot, they stay. A
|
|
// status and the end of the stream keep them. A touch screen has no
|
|
// pointer to move: a tap on the picture shows or hides them.
|
|
export component StreamPlayer inherits Rectangle {
|
|
in property <bool> compact;
|
|
property <bool> touch: !Bridge.desktop;
|
|
property <bool> pinned: Bridge.viewer-status != "" || Bridge.viewer-ended;
|
|
// The pointer has been over the picture (in full screen it is).
|
|
property <bool> woken: Bridge.viewer-fullscreen;
|
|
property <bool> shown: true;
|
|
property <bool> up: root.shown || root.pinned;
|
|
// In full screen the cursor hides with the controls. The window is
|
|
// told: Slint sets a TouchArea's cursor only when the pointer moves,
|
|
// and a move brings the controls back.
|
|
property <bool> no-cursor: Bridge.viewer-fullscreen && !root.up;
|
|
changed no-cursor => { Bridge.show-cursor(!root.no-cursor); }
|
|
border-radius: compact ? 0px : Theme.radius-lg;
|
|
clip: true;
|
|
background: #000000;
|
|
border-width: compact ? 0px : 1px;
|
|
border-color: Theme.border-strong;
|
|
accessible-role: AccessibleRole.groupbox;
|
|
accessible-label: Bridge.viewer-title;
|
|
|
|
function wake() {
|
|
root.woken = true;
|
|
root.shown = true;
|
|
if !root.pinned {
|
|
idle.restart();
|
|
}
|
|
}
|
|
// A touch moves the pointer too: on a control it keeps the controls a
|
|
// while longer, but only a tap on the picture shows or hides them.
|
|
function moved() {
|
|
if !root.touch {
|
|
root.wake();
|
|
} else if root.shown && !root.pinned {
|
|
idle.restart();
|
|
}
|
|
}
|
|
|
|
Image {
|
|
width: parent.width;
|
|
height: parent.height;
|
|
source: Bridge.viewer-frame;
|
|
image-fit: contain;
|
|
visible: Bridge.viewer-has-frame;
|
|
accessible-role: AccessibleRole.image;
|
|
accessible-label: @tr("Stream picture");
|
|
}
|
|
if Bridge.viewer-status != "": Rectangle {
|
|
width: min(parent.width - 32px, status-text.preferred-width + 40px);
|
|
height: status-text.preferred-height + 24px;
|
|
border-radius: Theme.radius-lg;
|
|
background: Theme.overlay;
|
|
border-width: 1px;
|
|
border-color: Theme.border-strong;
|
|
status-text := Text {
|
|
width: min(root.width - 72px, self.preferred-width);
|
|
text: Bridge.viewer-status;
|
|
color: #ffffff;
|
|
horizontal-alignment: center;
|
|
wrap: word-wrap;
|
|
accessible-live-region: polite;
|
|
}
|
|
}
|
|
// Sees the pointer also over the controls: they are its children.
|
|
activity := TouchArea {
|
|
opacity: root.up ? 1 : 0;
|
|
animate opacity { duration: Theme.fast; }
|
|
changed mouse-x => { root.moved(); }
|
|
changed mouse-y => { root.moved(); }
|
|
clicked => {
|
|
if root.touch && root.shown {
|
|
root.shown = false;
|
|
} else {
|
|
root.wake();
|
|
}
|
|
}
|
|
// Shades for what is drawn over the picture.
|
|
if root.compact: Rectangle {
|
|
y: 0;
|
|
height: 140px;
|
|
background: @linear-gradient(180deg, #000000d8 0%, #00000000 100%);
|
|
}
|
|
Rectangle {
|
|
y: parent.height - self.height;
|
|
height: 90px;
|
|
background: @linear-gradient(180deg, #00000000 0%, #000000c8 100%);
|
|
}
|
|
// Who streams what, LIVE and the quality.
|
|
if root.compact: HorizontalLayout {
|
|
y: 0;
|
|
height: 84px;
|
|
padding: Theme.space-4;
|
|
spacing: Theme.space-3;
|
|
VerticalLayout {
|
|
alignment: start;
|
|
Avatar {
|
|
size: 44px;
|
|
image: Bridge.viewer-streamer-avatar;
|
|
initials: Bridge.viewer-streamer-initials;
|
|
tint: Bridge.viewer-streamer-tint;
|
|
label: Bridge.viewer-streamer;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: start;
|
|
horizontal-stretch: 1;
|
|
spacing: 1px;
|
|
Text {
|
|
text: Bridge.viewer-streamer;
|
|
color: Theme.name-text;
|
|
font-size: Theme.font-md;
|
|
font-weight: Theme.weight-semibold;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: Bridge.viewer-title;
|
|
color: #ffffff;
|
|
font-size: Theme.font-md;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: Bridge.viewer-count > 0 ? @tr("{} watching", Bridge.viewer-count) : "";
|
|
color: #ffffffb8;
|
|
font-size: Theme.font-sm;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
if !Bridge.viewer-ended: VerticalLayout {
|
|
alignment: start;
|
|
HorizontalLayout {
|
|
spacing: Theme.space-2;
|
|
LiveBadge {
|
|
large: true;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
if Bridge.viewer-qualities.length > 1 || Bridge.viewer-has-frame: StreamQuality {
|
|
on-picture: true;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Controls. Their tooltips go with them: a bubble is a popup, which
|
|
// the fade does not reach, and it would stay over the picture.
|
|
HorizontalLayout {
|
|
y: parent.height - self.height;
|
|
height: 56px;
|
|
padding-left: Theme.space-3;
|
|
padding-right: Theme.space-3;
|
|
spacing: Theme.space-2;
|
|
IconButton {
|
|
icon: Bridge.viewer-volume > 0 ? Icons.volume-2 : Icons.volume-x;
|
|
label: Bridge.viewer-volume > 0 ? @tr("Mute") : @tr("Unmute");
|
|
tooltip: root.up ? self.label : "";
|
|
tint: #ffffff;
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Bridge.set-stream-volume(Bridge.viewer-volume > 0 ? 0 : 100); }
|
|
}
|
|
Slider {
|
|
width: 110px;
|
|
horizontal-stretch: 0;
|
|
y: (parent.height - self.height) / 2;
|
|
minimum: 0;
|
|
maximum: 200;
|
|
step: 5;
|
|
value <=> Bridge.viewer-volume;
|
|
enabled: !Bridge.viewer-ended;
|
|
label: @tr("Stream volume");
|
|
changed(v) => { Bridge.set-stream-volume(v); }
|
|
}
|
|
if !Bridge.viewer-ended: HorizontalLayout {
|
|
padding-left: Theme.space-3;
|
|
spacing: Theme.space-2;
|
|
horizontal-stretch: 0;
|
|
Rectangle {
|
|
width: 8px;
|
|
height: 8px;
|
|
y: (parent.height - self.height) / 2;
|
|
border-radius: 4px;
|
|
background: Theme.live;
|
|
}
|
|
Text {
|
|
text: @tr("LIVE");
|
|
color: #ffffff;
|
|
font-size: Theme.font-sm;
|
|
font-weight: Theme.weight-semibold;
|
|
vertical-alignment: center;
|
|
}
|
|
Text {
|
|
text: Bridge.viewer-elapsed;
|
|
color: #ffffffa0;
|
|
font-size: Theme.font-sm;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
// What arrives: codec, size, frame rate, bitrate.
|
|
Text {
|
|
horizontal-stretch: 1;
|
|
text: Bridge.viewer-quality-detail;
|
|
color: #ffffff80;
|
|
font-size: Theme.font-xs;
|
|
horizontal-alignment: right;
|
|
vertical-alignment: center;
|
|
overflow: elide;
|
|
}
|
|
if !Bridge.viewer-fullscreen && !Nav.narrow && !Bridge.viewer-popped: IconButton {
|
|
icon: Icons.minimize-2;
|
|
label: @tr("Back to the chat (keeps watching)");
|
|
tooltip: root.up ? self.label : "";
|
|
tint: #ffffff;
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Bridge.hide-viewer(); }
|
|
}
|
|
// Theatre mode: the window without the shell. Checked, it has
|
|
// the accent's colours, as elsewhere (white would not show on
|
|
// the light theme's).
|
|
if !Bridge.viewer-fullscreen && !Nav.narrow && !Bridge.viewer-popped: IconButton {
|
|
icon: Icons.rectangle-horizontal;
|
|
label: Nav.theatre ? @tr("Exit theatre mode") : @tr("Theatre mode");
|
|
tooltip: root.up ? self.label : "";
|
|
checked: Nav.theatre;
|
|
tint: Nav.theatre ? Theme.accent-text : #ffffff;
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Nav.theatre = !Nav.theatre; }
|
|
}
|
|
// In a window of its own: over the other windows or not
|
|
// (picture in picture).
|
|
if Bridge.viewer-popped: IconButton {
|
|
icon: Icons.pin;
|
|
label: Bridge.viewer-on-top ? @tr("Stop keeping on top") : @tr("Keep on top");
|
|
tooltip: root.up ? self.label : "";
|
|
checked: Bridge.viewer-on-top;
|
|
tint: Bridge.viewer-on-top ? Theme.accent-text : #ffffff;
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Bridge.viewer-on-top = !Bridge.viewer-on-top; }
|
|
}
|
|
// Into a window of its own and back (a phone has one window).
|
|
if Bridge.desktop && !Nav.narrow: IconButton {
|
|
icon: Icons.external-link;
|
|
label: Bridge.viewer-popped ? @tr("Back into the main window") : @tr("Pop out");
|
|
tooltip: root.up ? self.label : "";
|
|
checked: Bridge.viewer-popped;
|
|
tint: Bridge.viewer-popped ? Theme.accent-text : #ffffff;
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Bridge.pop-out-viewer(!Bridge.viewer-popped); }
|
|
}
|
|
IconButton {
|
|
icon: Bridge.viewer-fullscreen ? Icons.minimize-2 : Icons.maximize;
|
|
label: Bridge.viewer-fullscreen ? @tr("Exit full screen") : @tr("Full screen");
|
|
tooltip: root.up ? self.label : "";
|
|
tint: #ffffff;
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Bridge.toggle-fullscreen(); }
|
|
}
|
|
if root.compact: IconButton {
|
|
icon: Icons.log-out;
|
|
label: Bridge.viewer-ended ? @tr("Close") : @tr("Leave");
|
|
tooltip: root.up ? self.label : "";
|
|
tint: Theme.danger;
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Bridge.leave-stream(); }
|
|
}
|
|
}
|
|
// While they are hidden a click only brings the controls back.
|
|
if !root.up: TouchArea {
|
|
clicked => { root.wake(); }
|
|
}
|
|
}
|
|
idle := Timer {
|
|
interval: 2500ms;
|
|
running: root.woken && root.shown && !root.pinned;
|
|
triggered => { root.shown = false; }
|
|
}
|
|
}
|
|
|
|
// What is known about the watched stream.
|
|
component StreamInfo inherits VerticalLayout {
|
|
padding: Theme.space-6;
|
|
spacing: Theme.space-3;
|
|
alignment: start;
|
|
for row in [
|
|
{ label: @tr("Title"), value: Bridge.viewer-title },
|
|
{ label: @tr("Streamer"), value: Bridge.viewer-streamer },
|
|
{ label: @tr("Picture"), value: Bridge.viewer-quality-detail },
|
|
{ label: @tr("Watching for"), value: Bridge.viewer-elapsed },
|
|
{ label: @tr("Viewers"), value: Bridge.viewer-count > 0 ? @tr("{}", Bridge.viewer-count) : "" },
|
|
]: HorizontalLayout {
|
|
spacing: Theme.space-4;
|
|
Text {
|
|
width: 120px;
|
|
text: row.label;
|
|
color: Theme.text-muted;
|
|
}
|
|
Text {
|
|
text: row.value != "" ? row.value : "—";
|
|
color: Theme.text;
|
|
horizontal-stretch: 1;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
}
|
|
|
|
// The stream we watch. With the shell, and in theatre mode without it: a
|
|
// header with the streamer, the title and LIVE over our channel's
|
|
// background, the player, a note on the channel the stream belongs to,
|
|
// and our channel's chat below. In full screen and on a phone: the player
|
|
// alone.
|
|
export component StreamViewer inherits Rectangle {
|
|
// Reading our own width here would loop through the layout, so the
|
|
// phone breakpoint (a setting) decides.
|
|
property <bool> alone: Bridge.viewer-fullscreen || Nav.narrow;
|
|
property <bool> info-tab;
|
|
property <string> tab-name: Bridge.current-tab >= 0 && Bridge.current-tab < Bridge.tabs.length ? Bridge.tabs[Bridge.current-tab].name : "";
|
|
background: root.alone ? #000000 : transparent;
|
|
accessible-role: AccessibleRole.groupbox;
|
|
accessible-label: @tr("Stream viewer");
|
|
if root.alone: StreamPlayer {
|
|
compact: true;
|
|
}
|
|
if !root.alone: VerticalLayout {
|
|
// The stream's facts are here, not over the picture, so nothing
|
|
// covers it while the controls are hidden.
|
|
PageHeader {
|
|
banner: Bridge.own-channel-banner;
|
|
person: Bridge.viewer-streamer;
|
|
avatar: Bridge.viewer-streamer-avatar;
|
|
initials: Bridge.viewer-streamer-initials;
|
|
tint: Bridge.viewer-streamer-tint;
|
|
title: Bridge.viewer-title != "" ? Bridge.viewer-title : Bridge.viewer-streamer;
|
|
description: Bridge.viewer-count > 0 ? @tr("{} · {} watching", Bridge.viewer-streamer, Bridge.viewer-count) : Bridge.viewer-streamer;
|
|
if !Bridge.viewer-ended: LiveBadge {
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
if Bridge.viewer-qualities.length > 1 || Bridge.viewer-has-frame: StreamQuality {
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
// In theatre mode the window has no members panel to open.
|
|
if Bridge.members.length > 0 && !Nav.theatre: IconButton {
|
|
icon: Icons.users;
|
|
label: @tr("Members");
|
|
checked: Nav.right-panel-open && !Nav.pins-open && !Nav.topics-open;
|
|
count: Bridge.members.length;
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Nav.toggle-members(); }
|
|
}
|
|
Button {
|
|
kind: ButtonKind.danger;
|
|
icon: Icons.log-out;
|
|
text: Bridge.viewer-ended ? @tr("Close") : @tr("Leave");
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Bridge.leave-stream(); }
|
|
}
|
|
}
|
|
HorizontalLayout {
|
|
vertical-stretch: 3;
|
|
min-height: 200px;
|
|
padding: Theme.space-4;
|
|
padding-bottom: Theme.space-3;
|
|
StreamPlayer { }
|
|
}
|
|
// Streams on TeamSpeak belong to a channel (and can be watched from
|
|
// any channel; the streamer decides who may).
|
|
if Bridge.viewer-channel != "": HorizontalLayout {
|
|
padding-left: Theme.space-4;
|
|
padding-right: Theme.space-4;
|
|
Rectangle {
|
|
height: 40px;
|
|
border-radius: Theme.radius-md;
|
|
background: Theme.surface-2;
|
|
border-width: 1px;
|
|
border-color: Theme.border;
|
|
HorizontalLayout {
|
|
padding-left: Theme.space-4;
|
|
padding-right: Theme.space-4;
|
|
spacing: Theme.space-3;
|
|
Icon {
|
|
source: Icons.lock;
|
|
size: Theme.icon-sm;
|
|
tint: Theme.accent-text;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
Text {
|
|
text: Bridge.viewer-channel == Bridge.own-channel ? @tr("Streamed in your voice channel, {}. The streamer decides who may watch.", Bridge.viewer-channel) : @tr("Streamed in the {} voice channel. The streamer decides who may watch.", Bridge.viewer-channel);
|
|
color: Theme.text-secondary;
|
|
font-size: Theme.font-sm;
|
|
vertical-alignment: center;
|
|
horizontal-stretch: 1;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
HorizontalLayout {
|
|
padding-left: Theme.space-4;
|
|
padding-top: Theme.space-2;
|
|
alignment: start;
|
|
TabItem {
|
|
text: root.tab-name != "" ? @tr("{} Chat", root.tab-name) : @tr("Chat");
|
|
selected: !root.info-tab;
|
|
clicked => { root.info-tab = false; }
|
|
}
|
|
TabItem {
|
|
text: @tr("Stream Info");
|
|
selected: root.info-tab;
|
|
clicked => { root.info-tab = true; }
|
|
}
|
|
}
|
|
Rectangle {
|
|
height: 1px;
|
|
background: Theme.border;
|
|
}
|
|
if !root.info-tab: MessageList {
|
|
vertical-stretch: 2;
|
|
min-height: 120px;
|
|
model: Bridge.messages;
|
|
}
|
|
if !root.info-tab: Composer {
|
|
placeholder: root.tab-name != "" ? @tr("Message {}", root.tab-name) : @tr("Message");
|
|
}
|
|
if root.info-tab: StreamInfo {
|
|
vertical-stretch: 2;
|
|
}
|
|
}
|
|
}
|