Finish banner rendering, image cache invalidation, avatar/icon wiring and image-format support. Bound raster decoding, retain readable text contrast, and recover failed downloads while stopping obsolete reload timers. Validated with 168 library tests, a private TS6 banner lifecycle test including the real 60-second reload, desktop builds, strict scoped Clippy, formatting, license notices, independent source review and six headless desktop/mobile renders.
1406 lines
49 KiB
Plaintext
1406 lines
49 KiB
Plaintext
// The home page (design mockup 01): a banner with Voelin and the user's
|
|
// servers, friends online, live streams on our servers, the servers, the
|
|
// latest chats; at the right what friends do, quick actions and what is
|
|
// happening (events, scheduled streams, server news). Also the sidebar
|
|
// that leads to Friends, Direct Messages and the Library, and the Library.
|
|
|
|
import { Theme } from "../theme.slint";
|
|
import { Icons } from "../icons.slint";
|
|
import { Bridge, ServerItem, ContactItem, LiveItem, ConversationItem, HappeningItem, RecordingItem } 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";
|
|
|
|
// 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;
|
|
}
|
|
|
|
// A quick action of the sidebar: an icon in a rounded square.
|
|
component QuickNav inherits Rectangle {
|
|
in property <image> icon;
|
|
in property <string> text;
|
|
callback clicked();
|
|
height: 44px;
|
|
border-radius: Theme.radius-md;
|
|
background: touch.has-hover ? Theme.surface-3 : transparent;
|
|
accessible-role: AccessibleRole.button;
|
|
accessible-label: text;
|
|
accessible-action-default => { clicked(); }
|
|
touch := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
clicked => { root.clicked(); }
|
|
}
|
|
HorizontalLayout {
|
|
padding-left: Theme.space-2;
|
|
spacing: Theme.space-4;
|
|
Rectangle {
|
|
width: 34px;
|
|
height: 34px;
|
|
y: (parent.height - self.height) / 2;
|
|
border-radius: Theme.radius-md;
|
|
background: Theme.surface-2;
|
|
border-width: 1px;
|
|
border-color: Theme.border-strong;
|
|
Icon {
|
|
source: root.icon;
|
|
size: Theme.icon-md;
|
|
tint: Theme.text-secondary;
|
|
}
|
|
}
|
|
Text {
|
|
text: root.text;
|
|
color: Theme.text;
|
|
vertical-alignment: center;
|
|
horizontal-stretch: 1;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
}
|
|
|
|
// The painted picture at the bottom of the home sidebar.
|
|
component SidebarArt inherits Rectangle {
|
|
min-height: 140px;
|
|
// Out to the panel's edges (over the sidebar's padding, not its
|
|
// border), so no side edges show; the top fades into the panel slowly,
|
|
// easing out.
|
|
Rectangle {
|
|
x: 1px - Theme.space-3;
|
|
width: parent.width + 2 * (Theme.space-3 - 1px);
|
|
clip: true;
|
|
Art {
|
|
source: Icons.art-sidebar;
|
|
cover-width: parent.width;
|
|
cover-height: parent.height;
|
|
align-y: 1;
|
|
}
|
|
Rectangle {
|
|
y: 0;
|
|
height: min(parent.height * 0.55, 220px);
|
|
background: @linear-gradient(180deg,
|
|
Theme.surface 0%,
|
|
Theme.surface.transparentize(0.2) 30%,
|
|
Theme.surface.transparentize(0.65) 65%,
|
|
Theme.surface.transparentize(1) 100%);
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: end;
|
|
padding: Theme.space-5;
|
|
padding-bottom: Theme.space-8;
|
|
spacing: Theme.space-1;
|
|
visible: root.height > 170px;
|
|
for line in [@tr("Hang out"), @tr("Play together"), @tr("Find your people")]: Text {
|
|
text: line;
|
|
color: #e8edff;
|
|
font-size: Theme.font-lg;
|
|
font-weight: Theme.weight-medium;
|
|
}
|
|
Rectangle {
|
|
height: Theme.space-5;
|
|
}
|
|
Rectangle {
|
|
width: 44px;
|
|
height: 2px;
|
|
background: Theme.accent;
|
|
}
|
|
}
|
|
}
|
|
|
|
// The sidebar next to the home page, the friends, the messages and the
|
|
// Library.
|
|
export component HomeNav inherits VerticalLayout {
|
|
spacing: Theme.space-2;
|
|
NavItem {
|
|
icon: Icons.home;
|
|
text: @tr("Home");
|
|
selected: Nav.page == Page.home;
|
|
clicked => { Nav.show(Page.home); }
|
|
}
|
|
NavItem {
|
|
icon: Icons.users;
|
|
text: @tr("Friends");
|
|
selected: Nav.page == Page.friends;
|
|
clicked => { Nav.show(Page.friends); }
|
|
}
|
|
NavItem {
|
|
icon: Icons.message-square;
|
|
text: @tr("Direct Messages");
|
|
selected: Nav.page == Page.messages;
|
|
badge: Bridge.dm-unread + Bridge.inbox-unread;
|
|
clicked => { Nav.show(Page.messages); }
|
|
}
|
|
NavItem {
|
|
icon: Icons.library;
|
|
text: @tr("Library");
|
|
selected: Nav.page == Page.library;
|
|
clicked => { Nav.show(Page.library); }
|
|
}
|
|
Divider { }
|
|
VerticalLayout {
|
|
padding-top: Theme.space-3;
|
|
padding-left: Theme.space-3;
|
|
padding-bottom: Theme.space-2;
|
|
Text {
|
|
text: @tr("Quick Actions");
|
|
font-size: Theme.font-body;
|
|
font-weight: Theme.weight-medium;
|
|
color: Theme.text;
|
|
}
|
|
}
|
|
QuickNav {
|
|
icon: Icons.plus;
|
|
text: @tr("Add a Server");
|
|
clicked => { Nav.add-server(); }
|
|
}
|
|
QuickNav {
|
|
icon: Icons.log-in;
|
|
text: @tr("Join a Server");
|
|
clicked => { Nav.join-server(); }
|
|
}
|
|
QuickNav {
|
|
icon: Icons.user-plus;
|
|
text: @tr("Find Friends");
|
|
clicked => {
|
|
Nav.friends-tab = 1;
|
|
Bridge.friends-tab(1);
|
|
Nav.show(Page.friends);
|
|
}
|
|
}
|
|
SidebarArt {
|
|
vertical-stretch: 1;
|
|
}
|
|
}
|
|
|
|
|
|
// A slide arrow of the banner: a dark round button with a light ring.
|
|
component BannerArrow inherits Rectangle {
|
|
in property <image> icon;
|
|
in property <string> label;
|
|
callback clicked();
|
|
width: 28px;
|
|
height: 28px;
|
|
IconButton {
|
|
icon: root.icon;
|
|
label: root.label;
|
|
round: true;
|
|
filled: true;
|
|
size: root.width;
|
|
icon-size: Theme.icon-sm;
|
|
tint: #ffffff;
|
|
clicked => { root.clicked(); }
|
|
}
|
|
Rectangle {
|
|
border-radius: self.width / 2;
|
|
border-width: 1px;
|
|
border-color: #ffffff48;
|
|
}
|
|
}
|
|
|
|
// The banner: Voelin first, then each server; arrows and dots switch.
|
|
component HomeBanner inherits Rectangle {
|
|
in property <bool> compact;
|
|
property <int> slide: 0;
|
|
property <int> count: Bridge.servers.length + 1;
|
|
property <ServerItem> server: Bridge.servers[max(0, root.slide - 1)];
|
|
min-height: compact ? 200px : 212px;
|
|
border-radius: Theme.radius-xl;
|
|
clip: true;
|
|
background: root.slide == 0
|
|
? @linear-gradient(115deg, #0e1d5c 0%, #1c1470 45%, #3a1f86 75%, #0b2a6b 100%)
|
|
: @linear-gradient(115deg, root.server.tint.darker(0.6) 0%, #1c1470 55%, #0b2a6b 100%);
|
|
border-width: 1px;
|
|
border-color: Theme.border-strong;
|
|
accessible-role: AccessibleRole.groupbox;
|
|
accessible-label: root.slide == 0 ? Bridge.app-name : root.server.name;
|
|
// The night landscape, cut at the left on narrow screens (the moon
|
|
// stays); a server's slide takes the server's colour over it.
|
|
Art {
|
|
source: Icons.art-banner;
|
|
cover-width: parent.width;
|
|
cover-height: parent.height;
|
|
align-x: 1;
|
|
}
|
|
if root.slide > 0: Rectangle {
|
|
background: root.server.tint.with-alpha(0.28);
|
|
}
|
|
if root.compact: Rectangle {
|
|
background: @linear-gradient(90deg, #060c2cc0 0%, #060c2c50 55%, transparent 85%);
|
|
}
|
|
// The phone: swipe between the slides.
|
|
if root.compact && root.count > 1: SwipeGestureHandler {
|
|
handle-swipe-left: true;
|
|
handle-swipe-right: true;
|
|
swiped => {
|
|
root.slide = self.current-position.x < self.pressed-position.x
|
|
? mod(root.slide + 1, root.count) : mod(root.slide + root.count - 1, root.count);
|
|
}
|
|
}
|
|
// Words down a slope at the right, as written on the sky.
|
|
if !root.compact && root.slide == 0 && root.width > 640px: Rectangle {
|
|
x: parent.width - 180px;
|
|
y: 24px;
|
|
width: 160px;
|
|
height: 120px;
|
|
for word[i] in [@tr("Talk."), @tr("Watch."), @tr("Share."), @tr("Together.")]: Text {
|
|
x: i * 14px;
|
|
y: i * 26px;
|
|
text: word;
|
|
color: #e4e9ffd8;
|
|
font-size: Theme.font-xl;
|
|
font-italic: true;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
padding: Theme.space-5;
|
|
padding-left: root.compact ? Theme.space-5 : 44px;
|
|
spacing: Theme.space-3;
|
|
alignment: center;
|
|
if root.slide == 0: HorizontalLayout {
|
|
spacing: Theme.space-4;
|
|
alignment: start;
|
|
Image {
|
|
width: root.compact ? 40px : 54px;
|
|
height: self.width;
|
|
source: Icons.logo;
|
|
}
|
|
Text {
|
|
text: Bridge.app-name;
|
|
color: #ffffff;
|
|
font-size: (root.compact ? 30px : 44px) * Theme.font-scale;
|
|
font-weight: Theme.weight-bold;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
if root.slide > 0: HorizontalLayout {
|
|
spacing: Theme.space-4;
|
|
alignment: start;
|
|
Avatar {
|
|
size: root.compact ? 44px : 56px;
|
|
square: true;
|
|
initials: root.server.initials;
|
|
image: root.server.icon;
|
|
tint: root.server.tint;
|
|
label: root.server.name;
|
|
status: root.server.status == "connected" ? Status.online : root.server.status == "observing" ? Status.info : root.server.status == "connecting" ? Status.idle : Status.none;
|
|
}
|
|
Text {
|
|
text: root.server.name;
|
|
color: #ffffff;
|
|
font-size: (root.compact ? 26px : 36px) * Theme.font-scale;
|
|
font-weight: Theme.weight-bold;
|
|
vertical-alignment: center;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
Text {
|
|
text: root.slide == 0 ? @tr("Voice, chat and streams\non TeamSpeak servers.")
|
|
: root.server.flavor != "" ? root.server.flavor : @tr("Not reached yet");
|
|
color: #ffffff;
|
|
font-size: root.compact ? Theme.font-lg : Theme.font-2xl;
|
|
font-weight: Theme.weight-medium;
|
|
wrap: word-wrap;
|
|
}
|
|
Text {
|
|
text: root.slide == 0 ? @tr("Talk. Watch. Share. Or look in without joining.") : root.server.detail;
|
|
color: #c9d4ff;
|
|
wrap: word-wrap;
|
|
}
|
|
HorizontalLayout {
|
|
alignment: start;
|
|
spacing: Theme.space-3;
|
|
padding-top: Theme.space-2;
|
|
if root.slide == 0: Button {
|
|
kind: ButtonKind.primary;
|
|
icon: Icons.arrow-right;
|
|
text: @tr("Add a Server");
|
|
clicked => { Nav.add-server(); }
|
|
}
|
|
if root.slide > 0 && root.server.status != "connected": Button {
|
|
kind: ButtonKind.primary;
|
|
icon: Icons.log-in;
|
|
text: root.server.status == "connecting" ? @tr("Connecting…") : @tr("Connect");
|
|
enabled: root.server.status != "connecting";
|
|
clicked => { Bridge.connect-server(root.server.id); }
|
|
}
|
|
if root.slide > 0: Button {
|
|
icon: Icons.arrow-right;
|
|
text: @tr("Open");
|
|
clicked => { Nav.select-server(root.server.id); }
|
|
}
|
|
}
|
|
}
|
|
// Round buttons in the bottom corners, a little above the dots. The
|
|
// phone has the dots only.
|
|
if root.count > 1 && !root.compact: BannerArrow {
|
|
x: Theme.space-3;
|
|
y: parent.height - self.height - 12px;
|
|
icon: Icons.chevron-left;
|
|
label: @tr("Previous");
|
|
clicked => { root.slide = mod(root.slide + root.count - 1, root.count); }
|
|
}
|
|
if root.count > 1 && !root.compact: BannerArrow {
|
|
x: parent.width - self.width - Theme.space-3;
|
|
y: parent.height - self.height - 12px;
|
|
icon: Icons.chevron-right;
|
|
label: @tr("Next");
|
|
clicked => { root.slide = mod(root.slide + 1, root.count); }
|
|
}
|
|
if root.count > 1: HorizontalLayout {
|
|
y: parent.height - (root.compact ? 22px : 17px);
|
|
height: 10px;
|
|
alignment: center;
|
|
spacing: Theme.space-3;
|
|
for i in root.count: Rectangle {
|
|
width: 8px;
|
|
height: 8px;
|
|
border-radius: 4px;
|
|
background: i == root.slide ? #ffffff : #ffffff50;
|
|
TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
clicked => { root.slide = i; }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// A friend in the "Friends Online" row.
|
|
component FriendBubble inherits Rectangle {
|
|
in property <ContactItem> friend;
|
|
// The phone: smaller, the name only.
|
|
in property <bool> compact;
|
|
width: compact ? 62px : 82px;
|
|
height: compact ? 80px : 118px;
|
|
accessible-role: AccessibleRole.button;
|
|
accessible-label: friend.name;
|
|
accessible-description: friend.status;
|
|
accessible-action-default => { Bridge.select-contact(friend.uid); Nav.show(Page.friends); }
|
|
touch := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
clicked => {
|
|
Bridge.select-contact(root.friend.uid);
|
|
Nav.show(Page.friends);
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
spacing: Theme.space-1;
|
|
alignment: start;
|
|
HorizontalLayout {
|
|
alignment: center;
|
|
Avatar {
|
|
size: root.compact ? 50px : 60px;
|
|
initials: root.friend.initials;
|
|
tint: root.friend.tint;
|
|
image: root.friend.avatar;
|
|
label: root.friend.name;
|
|
status: root.friend.away ? Status.idle : Status.online;
|
|
}
|
|
}
|
|
Rectangle {
|
|
height: Theme.space-2;
|
|
}
|
|
Text {
|
|
text: root.friend.name;
|
|
color: Theme.text;
|
|
font-size: Theme.font-sm;
|
|
font-weight: Theme.weight-semibold;
|
|
horizontal-alignment: center;
|
|
overflow: elide;
|
|
}
|
|
// Two lines at most.
|
|
if !root.compact: Rectangle {
|
|
height: 27px * Theme.font-scale;
|
|
clip: true;
|
|
Text {
|
|
y: 0;
|
|
width: parent.width;
|
|
text: root.friend.status;
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-xs;
|
|
horizontal-alignment: center;
|
|
wrap: word-wrap;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// A live stream on one of our servers: the picture fills the card, the
|
|
// title, the streamer and where it is over its darker lower part.
|
|
component LiveCard inherits Rectangle {
|
|
in property <LiveItem> room;
|
|
// The phone: smaller, two in view.
|
|
in property <bool> compact;
|
|
width: compact ? 200px : 256px;
|
|
height: compact ? 150px : 170px;
|
|
border-radius: Theme.radius-lg;
|
|
clip: true;
|
|
background: Theme.surface-2;
|
|
accessible-role: AccessibleRole.button;
|
|
accessible-label: room.title;
|
|
accessible-description: room.streamer;
|
|
accessible-action-default => { Bridge.watch-live(room.session, room.id); }
|
|
touch := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
clicked => { Bridge.watch-live(root.room.session, root.room.id); }
|
|
}
|
|
// A painted scene in the server's colour.
|
|
Art {
|
|
source: Icons.art-scenes[mod(root.room.session + root.room.streamer.character-count, 3)];
|
|
cover-width: parent.width;
|
|
cover-height: parent.height;
|
|
align-y: 0.3;
|
|
}
|
|
Rectangle {
|
|
background: root.room.backdrop.with-alpha(0.2);
|
|
}
|
|
Rectangle {
|
|
y: parent.height * 0.3;
|
|
height: parent.height * 0.7;
|
|
background: @linear-gradient(180deg, transparent 0%, #060a18b0 45%, #060a18f0 100%);
|
|
}
|
|
HorizontalLayout {
|
|
x: Theme.space-3;
|
|
y: Theme.space-3;
|
|
height: 22px;
|
|
spacing: Theme.space-2;
|
|
LiveBadge {
|
|
large: true;
|
|
height: 22px;
|
|
}
|
|
if root.room.viewers > 0: Rectangle {
|
|
width: views.preferred-width + 14px;
|
|
border-radius: Theme.radius-xs;
|
|
background: #060a18a0;
|
|
views := HorizontalLayout {
|
|
padding-left: 7px;
|
|
spacing: Theme.space-2;
|
|
Icon {
|
|
source: Icons.eye;
|
|
size: 13px;
|
|
tint: #ffffff;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
Text {
|
|
text: root.room.viewers;
|
|
color: #ffffff;
|
|
font-size: Theme.font-xs;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: end;
|
|
padding: Theme.space-3;
|
|
spacing: Theme.space-2;
|
|
Text {
|
|
text: root.room.title;
|
|
color: #ffffff;
|
|
font-size: Theme.font-md;
|
|
font-weight: Theme.weight-semibold;
|
|
overflow: elide;
|
|
}
|
|
HorizontalLayout {
|
|
spacing: Theme.space-2;
|
|
Avatar {
|
|
size: 22px;
|
|
initials: root.room.initials;
|
|
tint: root.room.tint;
|
|
image: root.room.avatar;
|
|
label: root.room.streamer;
|
|
}
|
|
Text {
|
|
text: root.room.streamer;
|
|
color: #8fb4ff;
|
|
font-size: Theme.font-sm;
|
|
font-weight: Theme.weight-medium;
|
|
vertical-alignment: center;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
// Where it is: the server, the channel, what is shared; cut at
|
|
// the card's edge.
|
|
Rectangle {
|
|
height: 22px;
|
|
clip: true;
|
|
HorizontalLayout {
|
|
x: 0;
|
|
width: self.preferred-width;
|
|
spacing: Theme.space-2;
|
|
Chip {
|
|
text: root.room.server;
|
|
tint: #dce4ff;
|
|
fill: #ffffff1c;
|
|
}
|
|
if root.room.channel != "": Chip {
|
|
text: root.room.channel;
|
|
tint: #dce4ff;
|
|
fill: #ffffff1c;
|
|
}
|
|
if root.room.kind != "": Chip {
|
|
text: root.room.kind;
|
|
tint: #dce4ff;
|
|
fill: #ffffff1c;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// The hover ring over the picture.
|
|
Rectangle {
|
|
border-radius: parent.border-radius;
|
|
border-width: 1px;
|
|
border-color: touch.has-hover ? Theme.border-strong : #ffffff14;
|
|
}
|
|
}
|
|
|
|
// A server as a card: its picture, name, who is there, and Join.
|
|
component ServerCard inherits Rectangle {
|
|
in property <ServerItem> server;
|
|
min-width: 180px;
|
|
max-width: 280px;
|
|
horizontal-stretch: 1;
|
|
height: 170px;
|
|
border-radius: Theme.radius-lg;
|
|
clip: true;
|
|
background: Theme.surface-2;
|
|
border-width: 1px;
|
|
border-color: area.has-hover ? Theme.border-strong : Theme.border;
|
|
accessible-role: AccessibleRole.list-item;
|
|
accessible-label: server.name;
|
|
accessible-description: server.detail;
|
|
accessible-action-default => { Nav.select-server(server.id); }
|
|
area := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
clicked => { Nav.select-server(root.server.id); }
|
|
}
|
|
Rectangle {
|
|
y: 0;
|
|
height: 58px;
|
|
clip: true;
|
|
Art {
|
|
source: Icons.art-scenes[mod(root.server.id, 3)];
|
|
cover-width: parent.width;
|
|
cover-height: parent.height;
|
|
align-y: 0.7;
|
|
}
|
|
Rectangle {
|
|
background: root.server.tint.with-alpha(0.22);
|
|
}
|
|
if root.server.live: LiveBadge {
|
|
x: parent.width - self.width - Theme.space-3;
|
|
y: Theme.space-3;
|
|
}
|
|
if root.server.unread > 0: CountBadge {
|
|
x: Theme.space-3;
|
|
y: Theme.space-3;
|
|
count: root.server.unread;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
y: 58px;
|
|
height: parent.height - 58px;
|
|
padding: Theme.space-3;
|
|
padding-top: Theme.space-2;
|
|
spacing: Theme.space-1;
|
|
Text {
|
|
text: root.server.name;
|
|
color: Theme.text;
|
|
font-size: Theme.font-body;
|
|
font-weight: Theme.weight-semibold;
|
|
overflow: elide;
|
|
}
|
|
HorizontalLayout {
|
|
spacing: Theme.space-2;
|
|
Rectangle {
|
|
width: 8px;
|
|
height: 8px;
|
|
y: (parent.height - self.height) / 2;
|
|
border-radius: 4px;
|
|
background: root.server.status == "connected" ? Theme.success : root.server.status == "observing" ? Theme.info : root.server.status == "connecting" ? Theme.warning : Theme.offline;
|
|
}
|
|
Text {
|
|
text: root.server.detail;
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-xs;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
// As tall without chips, so the buttons line up.
|
|
HorizontalLayout {
|
|
height: 26px;
|
|
spacing: Theme.space-2;
|
|
alignment: start;
|
|
padding-top: Theme.space-1;
|
|
if root.server.flavor != "": Chip {
|
|
text: root.server.flavor;
|
|
outlined: true;
|
|
}
|
|
if root.server.gateway: Chip {
|
|
text: @tr("Invisible");
|
|
outlined: true;
|
|
}
|
|
}
|
|
Rectangle {
|
|
vertical-stretch: 1;
|
|
}
|
|
Button {
|
|
small: true;
|
|
kind: root.server.status == "connected" ? ButtonKind.secondary : ButtonKind.primary;
|
|
text: root.server.status == "connected" ? @tr("Open") : root.server.status == "connecting" ? @tr("Connecting…") : @tr("Join");
|
|
enabled: root.server.status != "connecting";
|
|
horizontal-stretch: 1;
|
|
clicked => {
|
|
if root.server.status == "connected" {
|
|
Nav.select-server(root.server.id);
|
|
} else {
|
|
Bridge.connect-server(root.server.id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// A recent chat as a small card.
|
|
component ChatCard inherits Rectangle {
|
|
in property <ConversationItem> chat;
|
|
// The four share the row evenly.
|
|
min-width: 120px;
|
|
preferred-width: 120px;
|
|
horizontal-stretch: 1;
|
|
height: 70px;
|
|
border-radius: Theme.radius-lg;
|
|
background: touch.has-hover ? Theme.surface-3 : Theme.surface-2;
|
|
border-width: 1px;
|
|
border-color: Theme.border;
|
|
accessible-role: AccessibleRole.button;
|
|
accessible-label: chat.title;
|
|
accessible-description: chat.preview;
|
|
accessible-action-default => { Bridge.open-conversation(chat.key); }
|
|
touch := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
clicked => { Bridge.open-conversation(root.chat.key); }
|
|
}
|
|
HorizontalLayout {
|
|
padding: Theme.space-3;
|
|
spacing: Theme.space-3;
|
|
VerticalLayout {
|
|
alignment: center;
|
|
Avatar {
|
|
size: 40px;
|
|
initials: root.chat.initials;
|
|
tint: root.chat.tint;
|
|
image: root.chat.avatar;
|
|
square: root.chat.kind < 2;
|
|
label: root.chat.title;
|
|
status: root.chat.kind == 2 ? (root.chat.online ? Status.online : Status.none) : Status.none;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
Text {
|
|
text: root.chat.title;
|
|
color: Theme.accent-text;
|
|
font-size: Theme.font-sm;
|
|
font-weight: Theme.weight-semibold;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: root.chat.preview;
|
|
color: Theme.text-secondary;
|
|
font-size: Theme.font-xs;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: root.chat.ago;
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-xs;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
if root.chat.unread > 0: VerticalLayout {
|
|
alignment: center;
|
|
CountBadge {
|
|
count: root.chat.unread;
|
|
fill: Theme.accent;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// A recent chat as a row (the phone): name and time, the last message,
|
|
// unread, a chevron.
|
|
component ChatRow inherits Rectangle {
|
|
in property <ConversationItem> chat;
|
|
height: 62px * Theme.font-scale;
|
|
border-radius: Theme.radius-lg;
|
|
background: touch.has-hover ? Theme.surface-3 : Theme.surface-2;
|
|
border-width: 1px;
|
|
border-color: Theme.border;
|
|
accessible-role: AccessibleRole.button;
|
|
accessible-label: chat.title;
|
|
accessible-description: chat.preview;
|
|
accessible-action-default => { Bridge.open-conversation(chat.key); }
|
|
touch := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
clicked => { Bridge.open-conversation(root.chat.key); }
|
|
}
|
|
HorizontalLayout {
|
|
padding-left: Theme.space-3;
|
|
padding-right: Theme.space-3;
|
|
spacing: Theme.space-3;
|
|
VerticalLayout {
|
|
alignment: center;
|
|
Avatar {
|
|
size: 42px;
|
|
initials: root.chat.initials;
|
|
tint: root.chat.tint;
|
|
image: root.chat.avatar;
|
|
square: root.chat.kind < 2;
|
|
label: root.chat.title;
|
|
status: root.chat.kind == 2 && root.chat.online ? Status.online : Status.none;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
spacing: 2px;
|
|
HorizontalLayout {
|
|
spacing: Theme.space-3;
|
|
alignment: start;
|
|
Text {
|
|
text: root.chat.title;
|
|
color: Theme.accent-text;
|
|
font-size: Theme.font-md;
|
|
font-weight: Theme.weight-semibold;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: root.chat.time;
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-xs;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
Text {
|
|
text: root.chat.preview;
|
|
color: Theme.text;
|
|
font-size: Theme.font-sm;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
if root.chat.unread > 0: VerticalLayout {
|
|
alignment: center;
|
|
CountBadge {
|
|
count: root.chat.unread;
|
|
fill: Theme.accent;
|
|
}
|
|
}
|
|
Icon {
|
|
source: Icons.chevron-right;
|
|
size: Theme.icon-sm;
|
|
tint: Theme.text-muted;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
}
|
|
}
|
|
|
|
// A section title with an icon and a "See All" link, as low as its text so
|
|
// the home page fits a window as in the design.
|
|
component Section inherits SectionHeader {
|
|
small: false;
|
|
min-height: 26px;
|
|
}
|
|
|
|
// What a friend does (the right column).
|
|
component ActivityRow inherits Rectangle {
|
|
in property <ContactItem> friend;
|
|
height: 56px;
|
|
border-radius: Theme.radius-md;
|
|
background: touch.has-hover ? Theme.surface-3 : transparent;
|
|
accessible-role: AccessibleRole.list-item;
|
|
accessible-label: friend.name;
|
|
accessible-description: friend.status;
|
|
touch := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
clicked => {
|
|
Bridge.select-contact(root.friend.uid);
|
|
Nav.show(Page.friends);
|
|
}
|
|
}
|
|
HorizontalLayout {
|
|
padding-left: Theme.space-2;
|
|
padding-right: Theme.space-2;
|
|
spacing: Theme.space-3;
|
|
VerticalLayout {
|
|
alignment: center;
|
|
Avatar {
|
|
size: 42px;
|
|
initials: root.friend.initials;
|
|
tint: root.friend.tint;
|
|
image: root.friend.avatar;
|
|
label: root.friend.name;
|
|
status: root.friend.online ? (root.friend.away ? Status.idle : Status.online) : Status.offline;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
Text {
|
|
text: root.friend.name;
|
|
color: Theme.accent-text;
|
|
font-size: Theme.font-md;
|
|
font-weight: Theme.weight-medium;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: root.friend.status;
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
if root.friend.streaming: LiveBadge {
|
|
large: true;
|
|
}
|
|
if !root.friend.streaming: Text {
|
|
text: root.friend.when;
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-xs;
|
|
horizontal-alignment: right;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// The main column of the home page.
|
|
export component HomePage inherits Rectangle {
|
|
// The phone layout: one column with the messages and the activity.
|
|
in property <bool> compact;
|
|
// The column inside its padding; a friend's bubble and the gap after it.
|
|
property <length> row-width: sv.visible-width - 2 * Theme.space-4;
|
|
property <length> friend-gap: 6px;
|
|
property <length> friend-step: 82px + root.friend-gap;
|
|
// The next live stream into view.
|
|
function more-live() {
|
|
live-list.content-x = max(live-list.width - live-list.content-width, live-list.content-x - 268px);
|
|
}
|
|
sv := ScrollView {
|
|
VerticalLayout {
|
|
width: sv.visible-width;
|
|
padding: Theme.space-4;
|
|
spacing: Theme.space-4;
|
|
alignment: start;
|
|
HomeBanner {
|
|
compact: root.compact;
|
|
}
|
|
Section {
|
|
text: @tr("Friends Online");
|
|
icon: Icons.users;
|
|
action: @tr("View All ({})", Bridge.friends-online.length);
|
|
action-clicked => {
|
|
Nav.friends-tab = 0;
|
|
Bridge.friends-tab(0);
|
|
Nav.show(Page.friends);
|
|
}
|
|
}
|
|
if Bridge.friends-online.length == 0: Text {
|
|
text: @tr("No friends online. Add friends from a person's card on a server: they show up here, wherever they are.");
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
wrap: word-wrap;
|
|
}
|
|
if Bridge.friends-online.length > 0: HorizontalLayout {
|
|
spacing: root.friend-gap;
|
|
alignment: start;
|
|
// On the desktop as many whole bubbles as fit (the rest
|
|
// scroll in), Find Friends right after the last one; the
|
|
// phone swipes through them all.
|
|
Flickable {
|
|
width: root.compact ? root.row-width
|
|
: min(Bridge.friends-online.length, max(1, floor((root.row-width - root.friend-step) / root.friend-step))) * root.friend-step - root.friend-gap;
|
|
height: root.compact ? 80px : 118px;
|
|
content-width: max(self.width, friends-row.preferred-width);
|
|
content-height: self.height;
|
|
friends-row := HorizontalLayout {
|
|
spacing: root.compact ? Theme.space-3 : root.friend-gap;
|
|
alignment: start;
|
|
for friend in Bridge.friends-online: FriendBubble {
|
|
friend: friend;
|
|
compact: root.compact;
|
|
}
|
|
}
|
|
}
|
|
if !root.compact: Rectangle {
|
|
width: root.friend-step - root.friend-gap;
|
|
accessible-role: AccessibleRole.button;
|
|
accessible-label: @tr("Find Friends");
|
|
accessible-action-default => { Nav.show(Page.friends); }
|
|
VerticalLayout {
|
|
alignment: start;
|
|
spacing: Theme.space-3;
|
|
HorizontalLayout {
|
|
alignment: center;
|
|
IconButton {
|
|
icon: Icons.plus;
|
|
label: @tr("Find Friends");
|
|
round: true;
|
|
filled: true;
|
|
size: 60px;
|
|
icon-size: Theme.icon-lg;
|
|
clicked => {
|
|
Nav.friends-tab = 1;
|
|
Bridge.friends-tab(1);
|
|
Nav.show(Page.friends);
|
|
}
|
|
}
|
|
}
|
|
Text {
|
|
text: @tr("Find Friends");
|
|
color: Theme.text-secondary;
|
|
font-size: Theme.font-sm;
|
|
horizontal-alignment: center;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if root.compact && Bridge.recent-chats.length > 0: Section {
|
|
text: @tr("Messages");
|
|
icon: Icons.message-square;
|
|
action: @tr("See All");
|
|
action-clicked => { Nav.show(Page.messages); }
|
|
}
|
|
if root.compact: VerticalLayout {
|
|
spacing: Theme.space-2;
|
|
for chat in Bridge.recent-chats: ChatRow {
|
|
chat: chat;
|
|
}
|
|
}
|
|
// The phone: the servers come before the live streams, a row
|
|
// to swipe through.
|
|
if root.compact: Section {
|
|
text: @tr("Your Servers");
|
|
icon: Icons.layout-grid;
|
|
action: @tr("Add a Server");
|
|
action-clicked => { Nav.add-server(); }
|
|
}
|
|
if root.compact && Bridge.servers.length == 0: Text {
|
|
text: @tr("No servers yet. Add one with its address.");
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
wrap: word-wrap;
|
|
}
|
|
if root.compact && Bridge.servers.length > 0: Flickable {
|
|
height: 170px;
|
|
content-width: max(self.width, servers-row.preferred-width);
|
|
content-height: self.height;
|
|
servers-row := HorizontalLayout {
|
|
spacing: Theme.space-3;
|
|
alignment: start;
|
|
for server in Bridge.servers: ServerCard {
|
|
width: 220px;
|
|
server: server;
|
|
}
|
|
}
|
|
}
|
|
Section {
|
|
text: root.compact ? @tr("Live Now") : @tr("Featured Live Rooms");
|
|
icon: Icons.radio;
|
|
action: Bridge.live-rooms.length > 0 ? @tr("See More Live") : "";
|
|
action-clicked => { root.more-live(); }
|
|
}
|
|
if Bridge.live-rooms.length == 0: Text {
|
|
text: @tr("No one is live on your servers right now. Streams of TeamSpeak 6 servers and those a gateway lists show up here.");
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
wrap: word-wrap;
|
|
}
|
|
Rectangle {
|
|
height: Bridge.live-rooms.length == 0 ? 0px : root.compact ? 150px : 170px;
|
|
live-list := Flickable {
|
|
content-width: max(self.width, live-row.preferred-width);
|
|
content-height: self.height;
|
|
live-row := HorizontalLayout {
|
|
spacing: Theme.space-3;
|
|
alignment: start;
|
|
for room in Bridge.live-rooms: LiveCard {
|
|
room: room;
|
|
compact: root.compact;
|
|
}
|
|
}
|
|
}
|
|
// More to the right: a round arrow over the edge.
|
|
if !root.compact && live-list.content-x > live-list.width - live-list.content-width + 1px: BannerArrow {
|
|
width: 34px;
|
|
height: 34px;
|
|
x: parent.width - self.width - Theme.space-2;
|
|
y: (parent.height - self.height) / 2;
|
|
icon: Icons.chevron-right;
|
|
label: @tr("See More Live");
|
|
clicked => { root.more-live(); }
|
|
}
|
|
}
|
|
if !root.compact: Section {
|
|
text: @tr("Your Servers");
|
|
icon: Icons.layout-grid;
|
|
action: @tr("Add a Server");
|
|
action-clicked => { Nav.add-server(); }
|
|
}
|
|
if !root.compact && Bridge.servers.length == 0: Text {
|
|
text: @tr("No servers yet. Add one with its address.");
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
wrap: word-wrap;
|
|
}
|
|
if !root.compact: FlexboxLayout {
|
|
spacing: Theme.space-3;
|
|
alignment: stretch;
|
|
for server in Bridge.servers: ServerCard {
|
|
server: server;
|
|
}
|
|
}
|
|
if !root.compact: Section {
|
|
text: @tr("Recent Chats");
|
|
icon: Icons.messages-square;
|
|
action: @tr("View All");
|
|
action-clicked => { Nav.show(Page.messages); }
|
|
}
|
|
if !root.compact && Bridge.recent-chats.length == 0: Text {
|
|
text: @tr("Chats you had show up here, from every server.");
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
}
|
|
if !root.compact: HorizontalLayout {
|
|
spacing: Theme.space-3;
|
|
for chat in Bridge.recent-chats: ChatCard {
|
|
chat: chat;
|
|
}
|
|
}
|
|
if root.compact: Section {
|
|
text: @tr("Recent Activity");
|
|
icon: Icons.zap;
|
|
action: @tr("See All");
|
|
action-clicked => { Nav.show(Page.friends); }
|
|
}
|
|
if root.compact: VerticalLayout {
|
|
spacing: Theme.space-1;
|
|
for friend in Bridge.friend-activity: ActivityRow {
|
|
friend: friend;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// A quick action of the right column: an icon, a title and what it does.
|
|
component QuickAction inherits Rectangle {
|
|
in property <image> icon;
|
|
in property <string> title;
|
|
in property <string> subtitle;
|
|
callback clicked();
|
|
height: 54px;
|
|
border-radius: Theme.radius-md;
|
|
background: touch.has-hover ? Theme.surface-3 : Theme.surface-2;
|
|
border-width: 1px;
|
|
border-color: Theme.border;
|
|
accessible-role: AccessibleRole.button;
|
|
accessible-label: title;
|
|
accessible-description: subtitle;
|
|
accessible-action-default => { clicked(); }
|
|
touch := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
clicked => { root.clicked(); }
|
|
}
|
|
HorizontalLayout {
|
|
padding-left: Theme.space-3;
|
|
padding-right: Theme.space-3;
|
|
spacing: Theme.space-3;
|
|
Rectangle {
|
|
width: 36px;
|
|
height: 36px;
|
|
y: (parent.height - self.height) / 2;
|
|
border-radius: 18px;
|
|
background: Theme.accent-soft;
|
|
Icon {
|
|
source: root.icon;
|
|
size: Theme.icon-md;
|
|
tint: Theme.accent-text;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
Text {
|
|
text: root.title;
|
|
color: Theme.text;
|
|
font-weight: Theme.weight-medium;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: root.subtitle;
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-xs;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
Icon {
|
|
source: Icons.chevron-right;
|
|
size: Theme.icon-sm;
|
|
tint: Theme.text-muted;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
}
|
|
}
|
|
|
|
// An event, a scheduled stream or server news.
|
|
component HappeningRow inherits Rectangle {
|
|
in property <HappeningItem> item;
|
|
in property <int> index;
|
|
height: 62px;
|
|
border-radius: Theme.radius-md;
|
|
background: touch.has-hover ? Theme.surface-3 : Theme.surface-2;
|
|
border-width: 1px;
|
|
border-color: Theme.border;
|
|
accessible-role: AccessibleRole.button;
|
|
accessible-label: item.title;
|
|
accessible-description: item.subtitle;
|
|
accessible-action-default => { Bridge.open-happening(index); }
|
|
touch := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
clicked => { Bridge.open-happening(root.index); }
|
|
}
|
|
HorizontalLayout {
|
|
padding-left: Theme.space-3;
|
|
padding-right: Theme.space-3;
|
|
spacing: Theme.space-3;
|
|
Rectangle {
|
|
width: 40px;
|
|
height: 40px;
|
|
y: (parent.height - self.height) / 2;
|
|
border-radius: Theme.radius-md;
|
|
background: root.item.kind == "news" ? Theme.surface-4 : root.item.kind == "stream" ? Theme.live-soft : Theme.accent-soft;
|
|
Icon {
|
|
source: root.item.kind == "news" ? Icons.megaphone : root.item.kind == "stream" ? Icons.radio : Icons.calendar-days;
|
|
size: Theme.icon-md;
|
|
tint: root.item.kind == "stream" ? Theme.live : Theme.accent-text;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
Text {
|
|
text: root.item.title;
|
|
color: Theme.text;
|
|
font-size: Theme.font-sm;
|
|
font-weight: Theme.weight-medium;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: root.item.subtitle;
|
|
color: Theme.text-secondary;
|
|
font-size: Theme.font-xs;
|
|
overflow: elide;
|
|
}
|
|
if root.item.when != "": Text {
|
|
text: root.item.when;
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-xs;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
if root.item.live: VerticalLayout {
|
|
alignment: center;
|
|
LiveBadge { }
|
|
}
|
|
Icon {
|
|
source: Icons.chevron-right;
|
|
size: Theme.icon-sm;
|
|
tint: Theme.text-muted;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
}
|
|
}
|
|
|
|
// The right column of the home page.
|
|
export component HomeAside inherits Rectangle {
|
|
sv := ScrollView {
|
|
VerticalLayout {
|
|
width: sv.visible-width;
|
|
padding: Theme.space-4;
|
|
spacing: Theme.space-3;
|
|
alignment: start;
|
|
Section {
|
|
text: @tr("Friend Activity");
|
|
action: @tr("See All");
|
|
action-clicked => { Nav.show(Page.friends); }
|
|
}
|
|
if Bridge.friend-activity.length == 0: Text {
|
|
text: @tr("What your friends do shows up here.");
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
wrap: word-wrap;
|
|
}
|
|
// Close together, as in the design (each row lights up under
|
|
// the pointer).
|
|
VerticalLayout {
|
|
for friend in Bridge.friend-activity: ActivityRow {
|
|
friend: friend;
|
|
}
|
|
}
|
|
Divider { }
|
|
Section {
|
|
text: @tr("Quick Actions");
|
|
}
|
|
QuickAction {
|
|
icon: Icons.user-plus;
|
|
title: @tr("Find Friends");
|
|
subtitle: @tr("Search your contacts");
|
|
clicked => {
|
|
Nav.friends-tab = 1;
|
|
Bridge.friends-tab(1);
|
|
Nav.show(Page.friends);
|
|
}
|
|
}
|
|
QuickAction {
|
|
icon: Icons.log-in;
|
|
title: @tr("Join a Server");
|
|
subtitle: @tr("Enter an address");
|
|
clicked => { Nav.join-server(); }
|
|
}
|
|
QuickAction {
|
|
icon: Icons.bookmark;
|
|
title: @tr("Add a Server");
|
|
subtitle: @tr("Save it for later");
|
|
clicked => { Nav.add-server(); }
|
|
}
|
|
Divider { }
|
|
Section {
|
|
text: @tr("What's Happening");
|
|
}
|
|
if Bridge.happenings.length == 0: Text {
|
|
text: @tr("Events, scheduled streams and news of your servers show up here.");
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
wrap: word-wrap;
|
|
}
|
|
for item[i] in Bridge.happenings: HappeningRow {
|
|
item: item;
|
|
index: i;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Recordings and clips of the Stream Studio.
|
|
export component LibraryPage inherits VerticalLayout {
|
|
// The phone: its top bar has the title.
|
|
in property <bool> compact;
|
|
padding: compact ? Theme.space-4 : Theme.space-6;
|
|
spacing: Theme.space-4;
|
|
HorizontalLayout {
|
|
spacing: Theme.space-4;
|
|
if !root.compact: Icon {
|
|
source: Icons.library;
|
|
size: 30px;
|
|
tint: Theme.accent-text;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
if !root.compact: Text {
|
|
text: @tr("Library");
|
|
font-size: Theme.font-2xl;
|
|
font-weight: Theme.weight-bold;
|
|
color: Theme.text;
|
|
}
|
|
Text {
|
|
text: root.compact ? Bridge.recordings-dir : @tr("Recordings and clips from the Stream Studio, in {}", Bridge.recordings-dir);
|
|
color: Theme.text-secondary;
|
|
font-size: Theme.font-sm;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
Button {
|
|
icon: Icons.folder-open;
|
|
text: @tr("Open Folder");
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Bridge.open-recordings-folder(); }
|
|
}
|
|
}
|
|
if Bridge.recordings.length == 0: Text {
|
|
text: @tr("Nothing recorded yet. Recordings and clips saved in the Stream Studio appear here.");
|
|
color: Theme.text-muted;
|
|
wrap: word-wrap;
|
|
}
|
|
ListView {
|
|
vertical-stretch: 1;
|
|
for item in Bridge.recordings: Rectangle {
|
|
height: 60px;
|
|
border-radius: Theme.radius-md;
|
|
background: row-touch.has-hover ? Theme.surface-3 : transparent;
|
|
accessible-role: AccessibleRole.list-item;
|
|
accessible-label: item.name;
|
|
accessible-description: item.detail;
|
|
accessible-action-default => { Bridge.open-recording(item.path); }
|
|
row-touch := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
double-clicked => { Bridge.open-recording(item.path); }
|
|
}
|
|
HorizontalLayout {
|
|
padding-left: Theme.space-3;
|
|
padding-right: Theme.space-3;
|
|
spacing: Theme.space-4;
|
|
Rectangle {
|
|
width: 44px;
|
|
height: 44px;
|
|
y: (parent.height - self.height) / 2;
|
|
border-radius: Theme.radius-md;
|
|
background: Theme.surface-4;
|
|
Icon {
|
|
source: item.clip ? Icons.clapperboard : Icons.film;
|
|
tint: Theme.accent-text;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
Text {
|
|
text: item.name;
|
|
color: Theme.text;
|
|
font-weight: Theme.weight-medium;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: item.detail;
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
Button {
|
|
small: true;
|
|
icon: Icons.play;
|
|
text: @tr("Play");
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Bridge.open-recording(item.path); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|