cargo-about only sees crates, so the Inter font (OFL-1.1), the Lucide icons (ISC, with the MIT notice of the icons from Feather) and the Twemoji graphics (CC-BY 4.0) come from about-assets.md, which scripts/notices.sh appends to its output; --check compares the whole file as before. The About page credits them above the notices. Also from the screenshots: a disabled primary button keeps its label readable, badges size to their text, buttons and fields keep their height in rows, the chat header shows the channel name without "#", and the toast sits above the composer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
529 lines
19 KiB
Plaintext
529 lines
19 KiB
Plaintext
// Dialogs: add/edit a server, share the screen, a client's volume, About.
|
|
|
|
import { Theme } from "../theme.slint";
|
|
import { Icons } from "../icons.slint";
|
|
import { Bridge, BookmarkForm, ShareForm } from "../bridge.slint";
|
|
import { Nav } from "../nav.slint";
|
|
import { Icon, Button, ButtonKind, IconButton, TextField, Field, Select, Toggle, ToggleRow, Slider, Modal, Card, Chip, Banner, Avatar, Status, ListView, ScrollView } from "../components/index.slint";
|
|
import { AboutSlint } from "std-widgets.slint";
|
|
|
|
// Buttons at the bottom right of a dialog.
|
|
component Footer inherits HorizontalLayout {
|
|
alignment: end;
|
|
spacing: Theme.space-3;
|
|
}
|
|
|
|
export component BookmarkDialog inherits Modal {
|
|
in-out property <BookmarkForm> form;
|
|
callback done();
|
|
title: form.id < 0 ? @tr("Add server") : @tr("Edit server");
|
|
subtitle: @tr("TeamSpeak 3 or 6 server address and your nickname there.");
|
|
icon: Icons.server;
|
|
card-width: 560px;
|
|
card-height: 640px;
|
|
dismissed => { done(); }
|
|
ScrollView {
|
|
vertical-stretch: 1;
|
|
VerticalLayout {
|
|
spacing: Theme.space-4;
|
|
padding-right: Theme.space-3;
|
|
Field {
|
|
label: @tr("Name");
|
|
TextField { text <=> form.name; placeholder: @tr("My server"); label: @tr("Name"); }
|
|
}
|
|
Field {
|
|
label: @tr("Address");
|
|
TextField { text <=> form.address; placeholder: "ts.example.org:9987"; label: @tr("Address"); icon: Icons.globe; }
|
|
}
|
|
HorizontalLayout {
|
|
spacing: Theme.space-4;
|
|
Field {
|
|
label: @tr("Nickname");
|
|
TextField { text <=> form.nickname; label: @tr("Nickname"); icon: Icons.user; }
|
|
}
|
|
Field {
|
|
label: @tr("Server password");
|
|
TextField { text <=> form.server-password; input-type: InputType.password; label: @tr("Server password"); icon: Icons.lock; }
|
|
}
|
|
}
|
|
Text {
|
|
text: @tr("Invisible presence and chat without joining (optional)");
|
|
font-weight: Theme.weight-semibold;
|
|
color: Theme.text;
|
|
wrap: word-wrap;
|
|
}
|
|
Field {
|
|
label: @tr("Gateway URL");
|
|
TextField { text <=> form.gateway-url; placeholder: "wss://gw.example.org/v1"; label: @tr("Gateway URL"); }
|
|
}
|
|
HorizontalLayout {
|
|
spacing: Theme.space-4;
|
|
Field {
|
|
label: @tr("Query transport");
|
|
Select {
|
|
model: ["none", "ssh", "raw", "http"];
|
|
current-value <=> form.query-transport;
|
|
current-index: form.query-transport == "ssh" ? 1 : form.query-transport == "raw" ? 2 : form.query-transport == "http" ? 3 : 0;
|
|
label: @tr("Query transport");
|
|
}
|
|
}
|
|
Field {
|
|
label: @tr("Query address");
|
|
TextField { text <=> form.query-addr; placeholder: "ts.example.org:10022"; label: @tr("Query address"); }
|
|
}
|
|
}
|
|
HorizontalLayout {
|
|
spacing: Theme.space-4;
|
|
Field {
|
|
label: @tr("Query login");
|
|
TextField { text <=> form.query-user; label: @tr("Query login"); }
|
|
}
|
|
Field {
|
|
label: @tr("Query password");
|
|
TextField { text <=> form.query-password; input-type: InputType.password; label: @tr("Query password"); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Footer {
|
|
if form.id >= 0: Button {
|
|
kind: ButtonKind.danger;
|
|
icon: Icons.trash-2;
|
|
text: @tr("Delete");
|
|
clicked => {
|
|
Bridge.delete-bookmark(form.id);
|
|
done();
|
|
}
|
|
}
|
|
Rectangle { horizontal-stretch: 1; }
|
|
Button {
|
|
text: @tr("Cancel");
|
|
clicked => { done(); }
|
|
}
|
|
Button {
|
|
kind: ButtonKind.primary;
|
|
text: @tr("Save");
|
|
enabled: form.address != "" && form.nickname != "";
|
|
clicked => {
|
|
Bridge.save-bookmark(form);
|
|
done();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// A capture source as a selectable card.
|
|
component SourceCard inherits Rectangle {
|
|
in property <string> name;
|
|
in property <string> detail;
|
|
in property <bool> selected;
|
|
callback clicked();
|
|
height: 52px;
|
|
border-radius: Theme.radius-md;
|
|
background: selected ? Theme.accent-soft : touch.has-hover ? Theme.surface-3 : Theme.surface-2;
|
|
border-width: 1px;
|
|
border-color: selected ? Theme.accent : Theme.border;
|
|
accessible-role: AccessibleRole.list-item;
|
|
accessible-label: name;
|
|
accessible-description: detail;
|
|
accessible-item-selectable: true;
|
|
accessible-item-selected: selected;
|
|
accessible-action-default => { clicked(); }
|
|
touch := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
clicked => { root.clicked(); }
|
|
}
|
|
HorizontalLayout {
|
|
padding-left: Theme.space-4;
|
|
padding-right: Theme.space-4;
|
|
spacing: Theme.space-3;
|
|
Icon {
|
|
source: Icons.monitor;
|
|
tint: root.selected ? Theme.accent-text : Theme.icon;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
Text {
|
|
text: root.name;
|
|
color: Theme.text;
|
|
font-weight: Theme.weight-medium;
|
|
overflow: elide;
|
|
}
|
|
if root.detail != "": Text {
|
|
text: root.detail;
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-xs;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
Rectangle {
|
|
width: 18px;
|
|
height: 18px;
|
|
y: (parent.height - self.height) / 2;
|
|
border-radius: 9px;
|
|
border-width: 2px;
|
|
border-color: root.selected ? Theme.accent : Theme.border-strong;
|
|
if root.selected: Rectangle {
|
|
width: 8px;
|
|
height: 8px;
|
|
border-radius: 4px;
|
|
background: Theme.accent;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
export component ShareDialog inherits Modal {
|
|
in-out property <ShareForm> form;
|
|
callback done();
|
|
property <bool> live: Bridge.share-state == "live" || Bridge.share-state == "starting";
|
|
title: Bridge.share-state == "live" ? @tr("You are sharing your screen") : Bridge.share-state == "starting" ? @tr("Starting…") : @tr("Share screen");
|
|
subtitle: live ? Bridge.share-status : @tr("Stream to the people in your channel.");
|
|
icon: Icons.radio;
|
|
card-width: 600px;
|
|
card-height: 660px;
|
|
dismissed => { done(); }
|
|
|
|
if live: VerticalLayout {
|
|
spacing: Theme.space-4;
|
|
vertical-stretch: 1;
|
|
Text {
|
|
text: @tr("Viewers");
|
|
font-weight: Theme.weight-semibold;
|
|
color: Theme.text;
|
|
}
|
|
if Bridge.share-viewers.length == 0: Text {
|
|
text: @tr("Nobody is watching yet. Viewers in your channel can join from their streams list.");
|
|
color: Theme.text-muted;
|
|
wrap: word-wrap;
|
|
}
|
|
ListView {
|
|
vertical-stretch: 1;
|
|
accessible-label: @tr("Viewers");
|
|
for viewer in Bridge.share-viewers: HorizontalLayout {
|
|
padding-top: Theme.space-2;
|
|
padding-bottom: Theme.space-2;
|
|
spacing: Theme.space-3;
|
|
VerticalLayout {
|
|
alignment: center;
|
|
Avatar {
|
|
size: 32px;
|
|
initials: "";
|
|
status: viewer.state == "connected" ? Status.online : viewer.state == "requested" ? Status.idle : Status.offline;
|
|
Icon {
|
|
source: Icons.user;
|
|
size: 16px;
|
|
tint: #ffffff;
|
|
}
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
horizontal-stretch: 1;
|
|
alignment: center;
|
|
Text {
|
|
text: viewer.name;
|
|
color: Theme.text;
|
|
font-weight: Theme.weight-semibold;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: viewer.state == "requested" ? (viewer.message == "" ? @tr("asks to watch") : @tr("asks to watch: {}", viewer.message)) : viewer.state == "connecting" ? @tr("connecting") : @tr("watching");
|
|
font-size: Theme.font-sm;
|
|
color: viewer.state == "requested" ? Theme.warning : viewer.state == "connected" ? Theme.success : Theme.text-muted;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
if viewer.state == "requested": Button {
|
|
small: true;
|
|
kind: ButtonKind.primary;
|
|
text: @tr("Accept");
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Bridge.respond-viewer(viewer.client, true); }
|
|
}
|
|
if viewer.state == "requested": Button {
|
|
small: true;
|
|
text: @tr("Deny");
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Bridge.respond-viewer(viewer.client, false); }
|
|
}
|
|
if viewer.state != "requested": Button {
|
|
small: true;
|
|
text: @tr("Remove");
|
|
accessible-label: @tr("Remove {}", viewer.name);
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Bridge.kick-viewer(viewer.client); }
|
|
}
|
|
}
|
|
}
|
|
Footer {
|
|
Button {
|
|
text: @tr("Close");
|
|
clicked => { done(); }
|
|
}
|
|
Button {
|
|
kind: ButtonKind.danger;
|
|
icon: Icons.square;
|
|
text: @tr("Stop sharing");
|
|
clicked => { Bridge.stop-share(); }
|
|
}
|
|
}
|
|
}
|
|
if !live: VerticalLayout {
|
|
spacing: Theme.space-4;
|
|
vertical-stretch: 1;
|
|
Text {
|
|
text: @tr("What to share");
|
|
font-weight: Theme.weight-semibold;
|
|
color: Theme.text;
|
|
}
|
|
ListView {
|
|
vertical-stretch: 1;
|
|
min-height: 120px;
|
|
accessible-label: @tr("What to share");
|
|
for source[i] in Bridge.share-sources: VerticalLayout {
|
|
padding-bottom: Theme.space-2;
|
|
SourceCard {
|
|
name: source.name;
|
|
detail: source.detail;
|
|
selected: form.source == i;
|
|
clicked => { form.source = i; }
|
|
}
|
|
}
|
|
}
|
|
Field {
|
|
label: @tr("Stream name");
|
|
TextField { text <=> form.name; label: @tr("Stream name"); }
|
|
}
|
|
HorizontalLayout {
|
|
spacing: Theme.space-4;
|
|
Field {
|
|
label: @tr("Frame rate");
|
|
HorizontalLayout {
|
|
spacing: Theme.space-2;
|
|
Select {
|
|
model: [@tr("15 fps"), @tr("30 fps"), @tr("60 fps")];
|
|
current-index <=> form.fps-index;
|
|
label: @tr("Frame rate");
|
|
selected => { form.fps = [15, 30, 60][self.current-index]; }
|
|
}
|
|
TextField {
|
|
text <=> form.fps;
|
|
input-type: number;
|
|
placeholder: @tr("fps");
|
|
label: @tr("Frames per second");
|
|
width: 80px;
|
|
horizontal-stretch: 0;
|
|
}
|
|
}
|
|
}
|
|
Field {
|
|
label: @tr("Quality");
|
|
HorizontalLayout {
|
|
spacing: Theme.space-2;
|
|
Select {
|
|
model: [@tr("Low (2.5 Mbit/s)"), @tr("Standard (4.6 Mbit/s)"), @tr("High (8 Mbit/s)"), @tr("Best (10 Mbit/s)")];
|
|
current-index <=> form.bitrate-index;
|
|
label: @tr("Quality");
|
|
selected => { form.bitrate = [2500, 4608, 8000, 10000][self.current-index]; }
|
|
}
|
|
TextField {
|
|
text <=> form.bitrate;
|
|
input-type: number;
|
|
placeholder: @tr("kbit/s");
|
|
label: @tr("Bitrate in kbit/s");
|
|
width: 80px;
|
|
horizontal-stretch: 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
ToggleRow {
|
|
text: @tr("Share system audio");
|
|
icon: Icons.volume-2;
|
|
checked <=> form.audio;
|
|
}
|
|
ToggleRow {
|
|
text: @tr("Let everyone in the channel watch without asking");
|
|
icon: Icons.users;
|
|
checked <=> form.auto-accept;
|
|
}
|
|
if Bridge.share-error != "": Banner {
|
|
text: Bridge.share-error;
|
|
tone: Theme.danger;
|
|
icon: Icons.circle-alert;
|
|
}
|
|
Footer {
|
|
Button {
|
|
text: @tr("Cancel");
|
|
clicked => { done(); }
|
|
}
|
|
Button {
|
|
kind: ButtonKind.primary;
|
|
icon: Icons.radio;
|
|
text: Bridge.share-busy ? @tr("Starting…") : @tr("Start sharing");
|
|
enabled: !Bridge.share-busy && Bridge.streams-available && Bridge.share-sources.length > 0;
|
|
clicked => { Bridge.start-share(form); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Local volume and mute of one client.
|
|
export component ClientAudioDialog inherits Modal {
|
|
callback done();
|
|
title: Bridge.client-audio.name;
|
|
subtitle: @tr("Only changes what you hear.");
|
|
icon: Icons.volume-2;
|
|
card-width: 420px;
|
|
card-height: 300px;
|
|
dismissed => { done(); }
|
|
HorizontalLayout {
|
|
spacing: Theme.space-3;
|
|
Text {
|
|
text: @tr("Volume");
|
|
color: Theme.text;
|
|
vertical-alignment: center;
|
|
}
|
|
Slider {
|
|
y: (parent.height - self.height) / 2;
|
|
minimum: 0;
|
|
maximum: 400;
|
|
step: 5;
|
|
value: Bridge.client-audio.volume;
|
|
enabled: !Bridge.client-audio.muted;
|
|
label: @tr("Volume of {}", Bridge.client-audio.name);
|
|
changed(v) => {
|
|
Bridge.client-audio.volume = round(v / 5) * 5;
|
|
Bridge.client-audio-changed(Bridge.client-audio);
|
|
}
|
|
}
|
|
Text {
|
|
text: @tr("{}%", round(Bridge.client-audio.volume));
|
|
width: 48px;
|
|
color: Theme.text-secondary;
|
|
vertical-alignment: center;
|
|
horizontal-alignment: right;
|
|
}
|
|
}
|
|
ToggleRow {
|
|
text: @tr("Mute for me");
|
|
icon: Icons.volume-x;
|
|
checked: Bridge.client-audio.muted;
|
|
toggled(on) => {
|
|
Bridge.client-audio.muted = on;
|
|
Bridge.client-audio-changed(Bridge.client-audio);
|
|
}
|
|
}
|
|
Rectangle { vertical-stretch: 1; }
|
|
Footer {
|
|
Button {
|
|
text: @tr("Reset");
|
|
icon: Icons.refresh-cw;
|
|
clicked => {
|
|
Bridge.client-audio.volume = 100;
|
|
Bridge.client-audio.muted = false;
|
|
Bridge.client-audio-changed(Bridge.client-audio);
|
|
}
|
|
}
|
|
Button {
|
|
kind: ButtonKind.primary;
|
|
text: @tr("Close");
|
|
clicked => { done(); }
|
|
}
|
|
}
|
|
}
|
|
|
|
// Bundled assets that need crediting where the app shows its notices.
|
|
export component Credits inherits VerticalLayout {
|
|
spacing: Theme.space-2;
|
|
Text {
|
|
text: @tr("Fonts, icons and emoji");
|
|
font-weight: Theme.weight-semibold;
|
|
color: Theme.text;
|
|
}
|
|
Text {
|
|
text: "Inter — Copyright (c) 2016 The Inter Project Authors, SIL Open Font License 1.1.";
|
|
color: Theme.text-secondary;
|
|
font-size: Theme.font-sm;
|
|
wrap: word-wrap;
|
|
}
|
|
Text {
|
|
text: "Lucide icons — Copyright (c) Lucide Icons and Contributors, ISC License; icons from Feather Copyright (c) 2013-present Cole Bemis, MIT License.";
|
|
color: Theme.text-secondary;
|
|
font-size: Theme.font-sm;
|
|
wrap: word-wrap;
|
|
}
|
|
Text {
|
|
text: "Twemoji graphics by Twitter, Inc and other contributors, licensed under CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/).";
|
|
color: Theme.text-secondary;
|
|
font-size: Theme.font-sm;
|
|
wrap: word-wrap;
|
|
}
|
|
}
|
|
|
|
export component AboutDialog inherits Modal {
|
|
callback done();
|
|
title: Bridge.app-name + " " + Bridge.app-version;
|
|
subtitle: @tr("Unofficial TeamSpeak 3/6 compatible client. Not affiliated with TeamSpeak Systems GmbH.");
|
|
icon: Icons.logo;
|
|
tint-icon: false;
|
|
card-width: 760px;
|
|
card-height: 720px;
|
|
dismissed => { done(); }
|
|
HorizontalLayout {
|
|
spacing: Theme.space-5;
|
|
Rectangle {
|
|
width: 200px;
|
|
height: 110px;
|
|
border-radius: Theme.radius-md;
|
|
// AboutSlint is required by Slint's royalty-free license; it is
|
|
// drawn for a light background.
|
|
background: #ffffff;
|
|
AboutSlint {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
}
|
|
Credits {
|
|
horizontal-stretch: 1;
|
|
}
|
|
}
|
|
if Bridge.h264-enabled: Text {
|
|
text: Bridge.h264-attribution;
|
|
color: Theme.text-secondary;
|
|
wrap: word-wrap;
|
|
}
|
|
Text {
|
|
text: @tr("Third-party notices");
|
|
font-weight: Theme.weight-semibold;
|
|
color: Theme.text;
|
|
}
|
|
Rectangle {
|
|
vertical-stretch: 1;
|
|
background: Theme.surface-2;
|
|
border-radius: Theme.radius-md;
|
|
border-width: 1px;
|
|
border-color: Theme.border;
|
|
ListView {
|
|
accessible-label: @tr("Third-party notices");
|
|
for line in Bridge.notices: Text {
|
|
x: 10px;
|
|
width: parent.width - 20px;
|
|
text: line;
|
|
font-size: Theme.font-xs;
|
|
color: Theme.text-secondary;
|
|
wrap: word-wrap;
|
|
}
|
|
}
|
|
}
|
|
Footer {
|
|
Button {
|
|
kind: ButtonKind.primary;
|
|
text: @tr("Close");
|
|
clicked => { done(); }
|
|
}
|
|
}
|
|
}
|