722 lines
25 KiB
Plaintext
722 lines
25 KiB
Plaintext
// The voice channel on the phone (design mockup 02): the channel's name
|
|
// and Leave, the stream we watch (or a card to watch one), the people in
|
|
// the channel, the channel's chat, and the voice controls at the bottom in
|
|
// place of the navigation.
|
|
|
|
import { Theme } from "../theme.slint";
|
|
import { Icons } from "../icons.slint";
|
|
import { Bridge, MemberItem, StreamItem } from "../bridge.slint";
|
|
import { Nav, MobileTab } from "../nav.slint";
|
|
import { Icon, IconButton, Button, ButtonKind, Avatar, LiveBadge, Select, Slider, SpeakingBars, ScrollView, BannerPicture } from "../components/index.slint";
|
|
import { MessageList, Composer } from "chat.slint";
|
|
import { StudioBridge } from "../studio-bridge.slint";
|
|
|
|
// Back to the navigation; a stream we watch goes on behind it.
|
|
export global PhoneVoice {
|
|
public function close() {
|
|
if Bridge.viewer-open {
|
|
Bridge.hide-viewer();
|
|
}
|
|
Nav.show-voice(false);
|
|
}
|
|
}
|
|
|
|
// Channel background behind its name, topic, Back and Leave.
|
|
component ChannelBar inherits Rectangle {
|
|
height: 56px;
|
|
clip: true;
|
|
if Bridge.own-channel-banner.width > 0: BannerPicture {
|
|
y: 0;
|
|
source: Bridge.own-channel-banner;
|
|
}
|
|
HorizontalLayout {
|
|
height: 56px;
|
|
padding-left: Theme.space-3;
|
|
padding-right: Theme.space-3;
|
|
spacing: Theme.space-3;
|
|
IconButton {
|
|
icon: Icons.arrow-left;
|
|
label: @tr("Back");
|
|
round: true;
|
|
filled: true;
|
|
size: 40px;
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { PhoneVoice.close(); }
|
|
}
|
|
Icon {
|
|
source: Icons.volume-2;
|
|
size: 28px;
|
|
tint: Theme.text-secondary;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
Text {
|
|
text: Bridge.own-channel;
|
|
color: Theme.text;
|
|
font-size: Theme.font-lg;
|
|
font-weight: Theme.weight-semibold;
|
|
overflow: elide;
|
|
}
|
|
if Bridge.own-channel-topic != "": Text {
|
|
text: Bridge.own-channel-topic;
|
|
color: Bridge.own-channel-banner.width > 0 ? Theme.text : Theme.text-secondary;
|
|
font-size: Theme.font-sm;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
Button {
|
|
kind: ButtonKind.danger;
|
|
icon: Icons.log-out;
|
|
text: @tr("Leave");
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => {
|
|
PhoneVoice.close();
|
|
Bridge.disconnect-voice();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// A translucent pill over the picture.
|
|
component OverlayChip inherits Rectangle {
|
|
in property <string> text;
|
|
in property <image> icon;
|
|
height: 26px;
|
|
width: row.preferred-width;
|
|
border-radius: Theme.radius-pill;
|
|
background: #060a18b0;
|
|
border-width: 1px;
|
|
border-color: #ffffff24;
|
|
row := HorizontalLayout {
|
|
padding-left: Theme.space-3;
|
|
padding-right: Theme.space-3;
|
|
spacing: Theme.space-2;
|
|
if root.icon.width > 0: Icon {
|
|
source: root.icon;
|
|
size: 14px;
|
|
tint: #ffffff;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
Text {
|
|
text: root.text;
|
|
color: #ffffff;
|
|
font-size: Theme.font-sm;
|
|
font-weight: Theme.weight-medium;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
}
|
|
|
|
// The stream we watch: the picture with LIVE, the viewers and the quality
|
|
// over its top, the title and who streams it over its bottom, and volume
|
|
// and full screen below them.
|
|
component PhonePlayer inherits Rectangle {
|
|
border-radius: Theme.radius-lg;
|
|
clip: true;
|
|
background: #000000;
|
|
border-width: 1px;
|
|
border-color: Theme.accent.transparentize(0.45);
|
|
accessible-role: AccessibleRole.groupbox;
|
|
accessible-label: Bridge.viewer-title;
|
|
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 != "": Text {
|
|
width: parent.width - 48px;
|
|
text: Bridge.viewer-status;
|
|
color: #ffffff;
|
|
font-size: Theme.font-sm;
|
|
horizontal-alignment: center;
|
|
vertical-alignment: center;
|
|
wrap: word-wrap;
|
|
accessible-live-region: polite;
|
|
}
|
|
// Shades for what is drawn over the picture.
|
|
Rectangle {
|
|
y: 0;
|
|
height: 64px;
|
|
background: @linear-gradient(180deg, #000000b0 0%, #00000000 100%);
|
|
}
|
|
Rectangle {
|
|
y: parent.height - self.height;
|
|
height: 104px;
|
|
background: @linear-gradient(180deg, #00000000 0%, #000000d0 100%);
|
|
}
|
|
// LIVE, viewers; the quality and full screen.
|
|
HorizontalLayout {
|
|
y: Theme.space-3;
|
|
height: 30px;
|
|
padding-left: Theme.space-3;
|
|
padding-right: Theme.space-3;
|
|
spacing: Theme.space-2;
|
|
if !Bridge.viewer-ended: LiveBadge {
|
|
large: true;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
if Bridge.viewer-count > 0: OverlayChip {
|
|
icon: Icons.eye;
|
|
text: Bridge.viewer-count;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
Rectangle { horizontal-stretch: 1; }
|
|
// Simulcast layers the streamer offers ("Auto" follows the
|
|
// bandwidth estimate); otherwise the height of what arrives.
|
|
if Bridge.viewer-qualities.length > 1: Select {
|
|
width: 116px;
|
|
horizontal-stretch: 0;
|
|
label: @tr("Quality");
|
|
model: Bridge.viewer-qualities;
|
|
current-index <=> Bridge.viewer-quality;
|
|
selected(_) => { Bridge.set-stream-quality(Bridge.viewer-quality); }
|
|
}
|
|
if Bridge.viewer-qualities.length <= 1 && Bridge.viewer-has-frame: OverlayChip {
|
|
text: @tr("{}p", Bridge.viewer-frame.height);
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
IconButton {
|
|
icon: Icons.maximize;
|
|
label: @tr("Full screen");
|
|
size: 30px;
|
|
icon-size: 16px;
|
|
tint: #ffffff;
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Bridge.toggle-fullscreen(); }
|
|
}
|
|
}
|
|
// The title, who streams it, and the controls.
|
|
VerticalLayout {
|
|
height: self.preferred-height;
|
|
y: parent.height - self.height;
|
|
padding-left: Theme.space-4;
|
|
padding-right: Theme.space-3;
|
|
padding-bottom: Theme.space-1;
|
|
spacing: 1px;
|
|
Text {
|
|
text: Bridge.viewer-title;
|
|
color: #ffffff;
|
|
font-size: Theme.font-md;
|
|
font-weight: Theme.weight-semibold;
|
|
overflow: elide;
|
|
}
|
|
HorizontalLayout {
|
|
spacing: Theme.space-2;
|
|
alignment: start;
|
|
Text {
|
|
text: Bridge.viewer-streamer;
|
|
color: #ffffffd0;
|
|
font-size: Theme.font-sm;
|
|
vertical-alignment: center;
|
|
overflow: elide;
|
|
}
|
|
if Bridge.viewer-streamer-admin: Icon {
|
|
source: Icons.crown;
|
|
size: 14px;
|
|
tint: Theme.gold;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
if !Bridge.viewer-ended: Text {
|
|
text: "• " + Bridge.viewer-elapsed;
|
|
color: #ffffffa0;
|
|
font-size: Theme.font-sm;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
HorizontalLayout {
|
|
height: 40px;
|
|
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");
|
|
size: 34px;
|
|
tint: #ffffff;
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Bridge.set-stream-volume(Bridge.viewer-volume > 0 ? 0 : 100); }
|
|
}
|
|
Slider {
|
|
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); }
|
|
}
|
|
IconButton {
|
|
icon: Bridge.viewer-ended ? Icons.x : Icons.log-out;
|
|
label: Bridge.viewer-ended ? @tr("Close") : @tr("Stop watching");
|
|
size: 34px;
|
|
tint: #ffffff;
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Bridge.leave-stream(); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// A stream in the channel that we do not show: LIVE, the title, who, and
|
|
// Watch (or Show, if we watch it already).
|
|
component StreamPrompt inherits Rectangle {
|
|
in property <StreamItem> stream;
|
|
height: 76px;
|
|
border-radius: Theme.radius-lg;
|
|
clip: true;
|
|
background: @linear-gradient(160deg, #26237a 0%, #0c1430 100%);
|
|
border-width: 1px;
|
|
border-color: stream.watching ? Theme.accent : Theme.border-strong;
|
|
accessible-role: AccessibleRole.groupbox;
|
|
accessible-label: stream.name;
|
|
HorizontalLayout {
|
|
padding: Theme.space-3;
|
|
padding-left: Theme.space-4;
|
|
spacing: Theme.space-3;
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
spacing: Theme.space-1;
|
|
HorizontalLayout {
|
|
spacing: Theme.space-2;
|
|
alignment: start;
|
|
if stream.id != "": LiveBadge {
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
Text {
|
|
text: stream.id == "" ? @tr("{} is streaming", stream.streamer) : stream.name != "" ? stream.name : @tr("Untitled stream");
|
|
color: #ffffff;
|
|
font-weight: Theme.weight-semibold;
|
|
vertical-alignment: center;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
Text {
|
|
text: stream.id == "" ? (stream.channel == "" ? @tr("Looking it up…") : @tr("In {}; looking it up…", stream.channel))
|
|
: stream.own ? @tr("Your stream")
|
|
: stream.channel != "" ? @tr("{} · in {}", stream.streamer, stream.channel)
|
|
: stream.viewers > 0 ? @tr("{} · {} watching", stream.streamer, stream.viewers)
|
|
: stream.streamer;
|
|
color: #ffffffb0;
|
|
font-size: Theme.font-sm;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
if stream.id != "" && !stream.own: Button {
|
|
kind: ButtonKind.primary;
|
|
small: true;
|
|
icon: stream.watching ? Icons.monitor : Icons.eye;
|
|
text: stream.watching ? @tr("Show") : @tr("Watch");
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => {
|
|
if stream.watching {
|
|
Bridge.show-viewer();
|
|
} else {
|
|
Bridge.watch-stream(stream.id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// One person: an avatar ringed green while talking (blue while
|
|
// streaming), the muted mark, the name with the crown, LIVE below.
|
|
component VoiceMember inherits VerticalLayout {
|
|
in property <MemberItem> member;
|
|
property <length> size: 54px;
|
|
width: 68px;
|
|
spacing: Theme.space-1;
|
|
accessible-role: AccessibleRole.list-item;
|
|
accessible-label: member.name;
|
|
accessible-description: member.status;
|
|
accessible-action-default => { Bridge.open-member(member.id); }
|
|
HorizontalLayout {
|
|
alignment: center;
|
|
Rectangle {
|
|
width: root.size + 8px;
|
|
height: root.size + 8px;
|
|
border-radius: self.width / 2;
|
|
border-width: member.talking || member.streaming ? 2px : 0px;
|
|
border-color: member.talking ? Theme.success : Theme.accent;
|
|
Avatar {
|
|
size: root.size;
|
|
initials: member.initials;
|
|
tint: member.tint;
|
|
image: member.avatar;
|
|
label: member.name;
|
|
}
|
|
if member.talking || member.muted || member.sound-off: Rectangle {
|
|
x: parent.width - self.width;
|
|
y: parent.height - self.height;
|
|
width: 22px;
|
|
height: 22px;
|
|
border-radius: 11px;
|
|
background: member.talking ? Theme.accent : Theme.surface;
|
|
border-width: 2px;
|
|
border-color: Theme.surface;
|
|
if member.talking: SpeakingBars {
|
|
width: 12px;
|
|
height: 12px;
|
|
tint: #ffffff;
|
|
}
|
|
if !member.talking: Icon {
|
|
source: member.sound-off ? Icons.headphone-off : Icons.mic-off;
|
|
size: 12px;
|
|
tint: Theme.danger;
|
|
}
|
|
}
|
|
TouchArea {
|
|
clicked => { Bridge.open-member(member.id); }
|
|
}
|
|
}
|
|
}
|
|
HorizontalLayout {
|
|
alignment: center;
|
|
spacing: Theme.space-1;
|
|
Text {
|
|
text: member.name;
|
|
color: member.myself ? Theme.accent-text : Theme.text;
|
|
font-size: Theme.font-sm;
|
|
overflow: elide;
|
|
max-width: root.width - (member.admin ? 16px : 0px);
|
|
}
|
|
if member.admin: Icon {
|
|
source: Icons.crown;
|
|
size: 13px;
|
|
tint: Theme.gold;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
}
|
|
if member.streaming: HorizontalLayout {
|
|
alignment: center;
|
|
LiveBadge { }
|
|
}
|
|
}
|
|
|
|
// "# Chill Zone Chat · Linked to this voice channel", with the pins, the
|
|
// topics and the members.
|
|
component ChatHeader inherits Rectangle {
|
|
height: 56px;
|
|
border-radius: Theme.radius-lg;
|
|
background: Theme.surface-2;
|
|
border-width: 1px;
|
|
border-color: Theme.border;
|
|
HorizontalLayout {
|
|
padding-left: Theme.space-4;
|
|
padding-right: Theme.space-3;
|
|
spacing: Theme.space-3;
|
|
Icon {
|
|
source: Icons.hash;
|
|
size: 24px;
|
|
tint: Theme.text-secondary;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
Text {
|
|
text: @tr("{} Chat", Bridge.own-channel);
|
|
color: Theme.text;
|
|
font-size: Theme.font-md;
|
|
font-weight: Theme.weight-semibold;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: @tr("Linked to this voice channel");
|
|
color: Theme.text-secondary;
|
|
font-size: Theme.font-xs;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
if Bridge.has-pins: IconButton {
|
|
icon: Icons.pin;
|
|
label: @tr("Pinned Messages");
|
|
filled: true;
|
|
size: 36px;
|
|
icon-size: 18px;
|
|
tint: Theme.accent-text;
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Nav.show-pins(true); }
|
|
}
|
|
if Bridge.has-topics: IconButton {
|
|
icon: Icons.book-open;
|
|
label: @tr("Topics");
|
|
filled: true;
|
|
size: 36px;
|
|
icon-size: 18px;
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Nav.show-topics(true); }
|
|
}
|
|
IconButton {
|
|
icon: Icons.users;
|
|
label: @tr("Members");
|
|
filled: true;
|
|
size: 36px;
|
|
icon-size: 18px;
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Nav.members-open = true; }
|
|
}
|
|
}
|
|
}
|
|
|
|
// A round control with its caption, for the voice bar.
|
|
component VoiceControl inherits VerticalLayout {
|
|
in property <image> icon;
|
|
in property <string> text;
|
|
in property <bool> checked;
|
|
in property <bool> danger;
|
|
in property <bool> enabled: true;
|
|
// Filled red (Leave).
|
|
in property <bool> alarm;
|
|
callback clicked();
|
|
horizontal-stretch: 1;
|
|
spacing: Theme.space-1;
|
|
alignment: center;
|
|
accessible-role: AccessibleRole.button;
|
|
accessible-label: text;
|
|
accessible-enabled: enabled;
|
|
accessible-checkable: !alarm;
|
|
accessible-checked: checked;
|
|
accessible-action-default => { if enabled { clicked(); } }
|
|
HorizontalLayout {
|
|
alignment: center;
|
|
Rectangle {
|
|
width: 48px;
|
|
height: 48px;
|
|
border-radius: 24px;
|
|
background: root.alarm ? (touch.pressed ? Theme.danger.darker(0.2) : Theme.danger)
|
|
: root.checked ? (root.danger ? Theme.danger-soft : Theme.accent-soft)
|
|
: touch.pressed ? Theme.surface-4 : Theme.surface-2;
|
|
border-width: root.alarm ? 0px : 1px;
|
|
border-color: root.checked ? (root.danger ? Theme.danger.transparentize(0.5) : Theme.accent) : Theme.border-strong;
|
|
opacity: root.enabled ? 1.0 : 0.45;
|
|
Icon {
|
|
source: root.icon;
|
|
size: 22px;
|
|
tint: root.alarm ? #ffffff : root.checked ? (root.danger ? Theme.danger : Theme.accent-text) : Theme.icon;
|
|
}
|
|
touch := TouchArea {
|
|
enabled: root.enabled;
|
|
clicked => { root.clicked(); }
|
|
}
|
|
}
|
|
}
|
|
Text {
|
|
text: root.text;
|
|
color: root.checked && root.danger ? Theme.danger : Theme.text-secondary;
|
|
font-size: Theme.font-xs;
|
|
horizontal-alignment: center;
|
|
accessible-role: AccessibleRole.none;
|
|
}
|
|
}
|
|
|
|
// Mute, Deafen, Go Live (the Stream Studio; "Live" while it or a share
|
|
// is), Share (the screen, at once) and Leave.
|
|
component VoiceBar inherits Rectangle {
|
|
height: 84px;
|
|
background: Theme.surface;
|
|
border-width: 1px;
|
|
border-color: Theme.border;
|
|
accessible-role: AccessibleRole.groupbox;
|
|
accessible-label: @tr("Voice");
|
|
HorizontalLayout {
|
|
padding-left: Theme.space-2;
|
|
padding-right: Theme.space-2;
|
|
padding-top: Theme.space-3;
|
|
padding-bottom: Theme.space-3;
|
|
VoiceControl {
|
|
icon: Bridge.input-muted ? Icons.mic-off : Icons.mic;
|
|
text: Bridge.input-muted ? @tr("Unmute") : @tr("Mute");
|
|
checked: Bridge.input-muted;
|
|
danger: true;
|
|
clicked => { Bridge.set-input-muted(!Bridge.input-muted); }
|
|
}
|
|
VoiceControl {
|
|
icon: Bridge.output-muted ? Icons.headphone-off : Icons.headphones;
|
|
text: Bridge.output-muted ? @tr("Undeafen") : @tr("Deafen");
|
|
checked: Bridge.output-muted;
|
|
danger: true;
|
|
clicked => { Bridge.set-output-muted(!Bridge.output-muted); }
|
|
}
|
|
// The big one: the Stream Studio, or live there.
|
|
if Bridge.streams-available && Bridge.can-share: VerticalLayout {
|
|
horizontal-stretch: 1.6;
|
|
spacing: Theme.space-1;
|
|
alignment: center;
|
|
accessible-role: AccessibleRole.button;
|
|
accessible-label: @tr("Go Live");
|
|
accessible-action-default => { Nav.open-studio(); }
|
|
Rectangle {
|
|
height: 48px;
|
|
border-radius: 24px;
|
|
background: live.pressed ? Theme.accent-pressed : Theme.accent;
|
|
border-width: 2px;
|
|
border-color: Theme.glow;
|
|
Icon {
|
|
source: Icons.radio;
|
|
size: 26px;
|
|
tint: Theme.on-accent;
|
|
}
|
|
live := TouchArea {
|
|
clicked => { Nav.open-studio(); }
|
|
}
|
|
}
|
|
Text {
|
|
text: Bridge.share-state == "live" || StudioBridge.status.live ? @tr("Live") : @tr("Go Live");
|
|
color: Theme.text;
|
|
font-size: Theme.font-xs;
|
|
font-weight: Theme.weight-semibold;
|
|
horizontal-alignment: center;
|
|
}
|
|
}
|
|
if Bridge.streams-available && Bridge.can-share: VoiceControl {
|
|
icon: Icons.screen-share;
|
|
text: Bridge.share-state == "live" ? @tr("Sharing") : @tr("Share");
|
|
checked: Bridge.share-state == "live";
|
|
clicked => { Nav.open-share(); }
|
|
}
|
|
VoiceControl {
|
|
icon: Icons.phone-off;
|
|
text: @tr("Leave");
|
|
alarm: true;
|
|
clicked => {
|
|
PhoneVoice.close();
|
|
Bridge.disconnect-voice();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Push-to-talk at the end of the composer: talks while held.
|
|
component TalkButton inherits Rectangle {
|
|
width: 48px;
|
|
height: 48px;
|
|
border-radius: 24px;
|
|
background: Bridge.transmitting ? Theme.success : touch.pressed ? Theme.accent-pressed : Theme.accent;
|
|
border-width: 2px;
|
|
border-color: Bridge.transmitting ? Theme.success.transparentize(0.4) : Theme.glow;
|
|
accessible-role: AccessibleRole.button;
|
|
accessible-label: @tr("Hold to talk");
|
|
accessible-checkable: true;
|
|
accessible-checked: Bridge.transmitting;
|
|
accessible-action-default => { Bridge.push-to-talk(!Bridge.transmitting); }
|
|
Icon {
|
|
source: Icons.mic;
|
|
size: 22px;
|
|
tint: Theme.on-accent;
|
|
}
|
|
touch := TouchArea {
|
|
pointer-event(e) => {
|
|
if e.kind == PointerEventKind.down {
|
|
Bridge.push-to-talk(true);
|
|
} else if e.kind == PointerEventKind.up || e.kind == PointerEventKind.cancel {
|
|
Bridge.push-to-talk(false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// The whole screen.
|
|
export component MobileVoice inherits VerticalLayout {
|
|
// A topic opened from the drawer shows in the chat page.
|
|
property <int> topic: Bridge.current-topic;
|
|
changed topic => {
|
|
if topic >= 0 {
|
|
PhoneVoice.close();
|
|
Nav.mobile-tab = MobileTab.chat;
|
|
}
|
|
}
|
|
clip := TextInput {
|
|
visible: false;
|
|
width: 0;
|
|
height: 0;
|
|
}
|
|
ChannelBar { }
|
|
sv := ScrollView {
|
|
// The stream, the people and the chat header scroll away together
|
|
// when the window is short; the messages always keep some room.
|
|
vertical-stretch: 0;
|
|
height: min(content.preferred-height, root.height * 0.55);
|
|
content := VerticalLayout {
|
|
width: sv.visible-width;
|
|
padding-left: Theme.space-3;
|
|
padding-right: Theme.space-3;
|
|
spacing: Theme.space-3;
|
|
if Bridge.viewer-open: PhonePlayer {
|
|
height: (sv.visible-width - 2 * Theme.space-3) * 9 / 16;
|
|
}
|
|
if !Bridge.viewer-open: VerticalLayout {
|
|
spacing: Theme.space-2;
|
|
for stream in Bridge.streams: StreamPrompt {
|
|
stream: stream;
|
|
}
|
|
}
|
|
people := ScrollView {
|
|
height: 112px;
|
|
HorizontalLayout {
|
|
padding-top: Theme.space-2;
|
|
spacing: Theme.space-2;
|
|
alignment: start;
|
|
for member in Bridge.members: VoiceMember {
|
|
member: member;
|
|
}
|
|
VerticalLayout {
|
|
width: 68px;
|
|
spacing: Theme.space-1;
|
|
alignment: start;
|
|
HorizontalLayout {
|
|
alignment: center;
|
|
IconButton {
|
|
icon: Icons.user-plus;
|
|
label: @tr("Invite: copy a link to this channel");
|
|
round: true;
|
|
filled: true;
|
|
size: 62px;
|
|
icon-size: 24px;
|
|
// Through a text field: Slint copies only
|
|
// what is selected in one.
|
|
clicked => {
|
|
clip.text = Bridge.invite();
|
|
clip.select-all();
|
|
clip.copy();
|
|
}
|
|
}
|
|
}
|
|
Text {
|
|
text: @tr("Invite");
|
|
color: Theme.text-secondary;
|
|
font-size: Theme.font-sm;
|
|
horizontal-alignment: center;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
ChatHeader { }
|
|
}
|
|
}
|
|
MessageList {
|
|
vertical-stretch: 1;
|
|
min-height: 96px;
|
|
model: Bridge.messages;
|
|
older: true;
|
|
}
|
|
HorizontalLayout {
|
|
padding-right: Bridge.audio.transmit == 0 ? Theme.space-4 : 0px;
|
|
Composer {
|
|
placeholder: @tr("Message #{}…", Bridge.own-channel);
|
|
padding: Theme.space-3;
|
|
padding-right: Bridge.audio.transmit == 0 ? Theme.space-3 : Theme.space-5;
|
|
}
|
|
// Push-to-talk is the transmit mode: talking is at hand.
|
|
if Bridge.audio.transmit == 0: TalkButton {
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
}
|
|
VoiceBar { }
|
|
}
|