Files
VoelinClient/crates/voelin-ui/ui/bridge.slint
T
selikhovandClaude Opus 5.5 a61d0af370 voelin-ui: pick and mix the quick share's sound as the studio does
The "Share screen" dialog had one switch for sound, "Share system audio",
which shared whatever stream.audio_sources held: changing what the
stream carries (an application, the microphone, desktop audio without
Voelin) or how loud meant the Stream Studio or the settings, and a
running share never followed.

The dialog now shows the studio's audio mixer while the switch is on
(off still means no audio at all): the studio's MixerRow for each source
(meter, gain, mute, the menu) and Add, which opens the studio's
PickDialog over the dialog to switch several sources on and off. They
read the main window's StudioBridge, filled without starting the studio
(App::mixer_show). Starting a share hands the sources with their gain
and mute to the capture (CaptureRequest::audio_sources); the stream
announces sound only when there is some. While it runs, the dialog
shows the same rows with the share mixer's meters, about 15 times a
second (the share keeps the timer), and every change of
stream.audio_sources, from the dialog or anywhere else (the settings
change event), goes to the running capture at once through
Capture::follow_audio, which reconfigures the streamer. A share started
without sound has no audio track, so the dialog says so instead.

The studio's rows and meters follow whichever streamer goes out: a quick
share's while one runs, else the studio's encoder. The picker's
application list is let go once neither the dialog nor the studio needs
it. With sample data, VOELIN_OPEN=share:live shares the test pattern
with the sample studio's sources, live at once with sample viewers, and
Stop ends it, as the studio's demo does. On a phone the frame-rate and
bitrate fields of the dialog no longer run past its edge.

Tests: capture_request carries the picked sources with gain and mute,
and nothing with the switch off or no sources; a running capture on the
test pattern follows changed sources, keeps a silent track when all are
removed, and one started without sound stays so. Headless screenshots
of the dialog before and during a share, 1440x900 and 390x844.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 22:45:17 +03:00

561 lines
17 KiB
Plaintext

// The data Rust gives the UI and the callbacks it handles. Models are
// VecModels that Rust updates row by row (src/vm/), so screens can bind to
// them freely.
export struct ServerItem {
id: int,
name: string,
address: string,
// "offline", "connecting", "observing" or "connected"
status: string,
// Avatar of a server without an icon.
initials: string,
tint: color,
// Unread messages in its chats.
unread: int,
// Someone streams in our channel there.
live: bool,
}
export struct TreeItem {
is-channel: bool,
depth: int,
id: int,
name: string,
own: bool,
talking: bool,
muted: bool,
sound-off: bool,
away: bool,
streaming: bool,
locked: bool,
collapsed: bool,
// Local playback of this client: muted, or its volume in percent
// (100 = unchanged).
local-muted: bool,
local-volume: int,
// Our own client.
myself: bool,
// Avatar of a client.
initials: string,
tint: color,
// The client's avatar picture, empty without one.
avatar: image,
// Channels: clients inside, and the limit (-1: none).
members: int,
max-members: int,
}
// A client for the members panel (everyone on the server) and the voice
// channel view (our channel).
export struct MemberItem {
id: int,
name: string,
initials: string,
tint: color,
avatar: image,
talking: bool,
muted: bool,
sound-off: bool,
away: bool,
streaming: bool,
myself: bool,
// "Speaking", "Streaming", "Away", ...
status: string,
// The away message, empty without one.
away-message: string,
// The section the row is in (a server group, "In Voice",
// "Streaming"), and the group's icon.
group: string,
group-icon: image,
// The first row of its section draws the heading, with the number of
// rows in the section.
first-in-group: bool,
group-count: int,
// Badges: a crown for the server's admin groups.
admin: bool,
// A moderator group's name, shown as a role next to the name.
role: string,
priority: bool,
commander: bool,
recording: bool,
// `client_talk_power`; shown when the channel needs it.
talk-power: int,
}
// The member card over a member row: everything about one client and what
// can be done with them.
export struct MemberCard {
open: bool,
id: int,
name: string,
initials: string,
tint: color,
avatar: image,
status: string,
description: string,
// Server groups, one per line.
groups: [string],
country: string,
talk-power: int,
friend: bool,
blocked: bool,
// Local playback, in percent.
volume: float,
muted: bool,
// The client has a unique id, so contacts and private chats work.
known: bool,
}
export struct ChatTab {
// "#Lobby", "@alice", "Server"
title: string,
// The name alone ("Lobby").
name: string,
// 0 = server chat, 1 = channel chat, 2 = private chat
kind: int,
id: int,
unread: int,
// The channel's topic (channel chats).
topic: string,
// The last message ("Mira: the banner I promised") and its time.
last: string,
time: string,
}
// A piece of a chat line: text, or an emoji shown as an image (`emoji` is
// its Twemoji key, e.g. "1f600"; `text` then holds the characters).
export struct TextRun {
text: string,
emoji: string,
}
// One emoji under a message, with how many put it there.
export struct ReactionItem {
// The Twemoji key of the first emoji in `text` ("1f389"), for the image.
key: string,
text: string,
count: int,
// We reacted with it.
me: bool,
}
// A file linked in a message (`ChatMessage::file_refs`).
export struct FileItem {
name: string,
// "2.4 MB", or what the transfer is doing.
detail: string,
// Index of the link in the message (what `download-file` takes).
index: int,
// "", "running", "done", "failed"
state: string,
// 0 … 1 while it downloads.
progress: float,
// A picture, so the icon differs.
picture: bool,
}
export struct ChatLine {
// A handle for this message in its chat, stable while the chat is open
// (the engine's ids do not fit a Slint int).
key: int,
author: string,
text: string,
time: string,
relayed: bool,
// The text split into runs; only filled when it has emoji (`rich`).
runs: [TextRun],
rich: bool,
// Only one to three emoji: shown large.
jumbo: bool,
// Same author as the line before, shortly after: no header.
continued: bool,
initials: string,
tint: color,
avatar: image,
// From a blocked contact.
blocked: bool,
pinned: bool,
reactions: [ReactionItem],
files: [FileItem],
// The gateway knows this message: it can be pinned, reacted to and
// made into a topic.
remote: bool,
// The topic it belongs to, "" outside a topic.
topic: string,
// Highlighted after jumping to it from the pins.
marked: bool,
}
// A pinned message in the pins drawer.
export struct PinItem {
line: ChatLine,
// "pinned by Nova · 12:04"
by: string,
}
// A gateway topic (thread).
export struct TopicItem {
id: int,
title: string,
creator: string,
// "12 messages · by Nova"
detail: string,
// "Last active 3 min ago", and whether that was within the hour.
activity: string,
recent: bool,
archived: bool,
}
export struct BookmarkForm {
id: int,
name: string,
address: string,
nickname: string,
server-password: string,
gateway-url: string,
query-transport: string,
query-addr: string,
query-user: string,
query-password: string,
}
// A stream on the server, ours first: a stream can be watched from any
// channel. An empty id: a client that streams, but whose stream is still
// being looked up (it started before we joined, or in another channel).
export struct StreamItem {
id: string,
name: string,
streamer: string,
// The streamer's channel when it is not ours; empty in ours.
channel: string,
// The streamer's client id (their avatar in the members).
streamer-id: int,
// How many watch it (the gateway's directory; 0 unknown).
viewers: int,
audio: bool,
// "Screen", "Window", "Camera"; and the announced bitrate ("8 Mbit/s").
kind: string,
bitrate: string,
// Shown in the viewer.
watching: bool,
// Our own stream.
own: bool,
}
// A viewer of our stream. state: "requested", "connecting" or "connected".
export struct ViewerItem {
client: int,
name: string,
state: string,
message: string,
}
// A capture source for the share dialog.
export struct SourceItem {
name: string,
detail: string,
}
export struct ShareForm {
source: int,
name: string,
// Index into the frame rate choices (15, 30, 60).
fps-index: int,
// Frames per second as typed; a choice fills it in. Any number above 0.
fps: string,
// Index into the bitrate choices (2.5, 4.6, 8, 10 Mbit/s).
bitrate-index: int,
// Video bitrate in kbit/s as typed; a choice fills it in.
bitrate: string,
audio: bool,
auto-accept: bool,
}
export struct AudioForm {
// 0 = system default, then the devices.
input-index: int,
output-index: int,
// 0 = push-to-talk, 1 = voice activation, 2 = continuous.
transmit: int,
// dBFS.
vad-threshold: float,
echo-cancellation: bool,
noise-suppression: bool,
// 0 = low ... 3 = very high.
noise-level: int,
auto-gain: bool,
// dB.
input-gain: float,
// Percent.
output-volume: float,
// Milliseconds.
playback-buffer: float,
}
// Local playback settings of one client. volume in percent.
export struct ClientAudio {
id: int,
name: string,
volume: float,
muted: bool,
}
// The appearance settings (`ui.*` keys).
export struct AppearanceForm {
// "dark", "light" or "system"
theme: string,
font-scale: float,
// Pixels.
narrow-breakpoint: float,
image-cache-mb: float,
}
export global Bridge {
in property <[ServerItem]> servers;
in-out property <int> current-server: -1;
in property <[TreeItem]> tree;
// Clients in our channel.
in property <[MemberItem]> members;
// Everyone on the server, in sections, for the members panel.
in property <[MemberItem]> server-members;
// How many people are on the server (not counting query clients).
in property <int> member-total;
in property <[ChatTab]> tabs;
in-out property <int> current-tab: 0;
in property <[ChatLine]> messages;
// Older messages can still be loaded in the current chat.
in property <bool> more-history;
in property <bool> loading-history;
// The current chat holds only what this device saw (no gateway sync).
in property <bool> local-history;
// Features of the session's gateway: hide what is missing.
in property <bool> has-pins;
in property <bool> has-reactions;
in property <bool> has-topics;
// The pins drawer.
in property <[PinItem]> pins;
in property <bool> pins-loading;
// The topics drawer, and the open topic.
in property <[TopicItem]> topics;
in property <bool> topics-loading;
in-out property <int> current-topic: -1;
in property <string> topic-title;
in property <[ChatLine]> topic-messages;
// The member card over the members panel.
in-out property <MemberCard> member-card;
// Jumping to a pinned message: its row in `messages`, and a counter
// that changes with every jump.
in property <int> jump-index: -1;
in property <int> jump-requests;
in property <string> status-text;
// Unread messages in all chats of the current server.
in property <int> unread-total;
in property <string> server-title: @tr("No server selected");
// "12 online · 8 channels"
in property <string> server-stats;
// Our nickname on the current server, and the channel we are in.
in property <string> nickname;
in property <string> own-channel;
// Its topic, and how many people it takes (-1: no limit).
in property <string> own-channel-topic;
in property <int> own-channel-limit: -1;
in property <bool> voice-connected;
in property <bool> voice-connecting;
in property <bool> observing;
in property <bool> can-observe;
in property <bool> input-muted;
in property <bool> output-muted;
in property <bool> transmitting;
in property <string> presence-source;
// Streams (TeamSpeak 6 while connected with voice).
in property <bool> streams-available;
in property <[StreamItem]> streams;
// Our stream: "", "starting", "live" or "ended".
in property <string> share-state;
in property <string> share-status;
in property <[ViewerItem]> share-viewers;
in property <int> share-requests;
in property <[SourceItem]> share-sources;
in property <string> share-error;
in property <bool> share-busy;
// Our share carries sound: its audio mixer can change it.
in property <bool> share-audio;
// Whether capture and encoding are built in.
in property <bool> can-share: true;
// The stream shown in the viewer.
in property <bool> viewer-open;
in property <image> viewer-frame;
in property <bool> viewer-has-frame;
in property <string> viewer-title;
// Who streams it (their client id: -1 unknown).
in property <string> viewer-streamer;
// The voice channel the watched stream is in.
in property <string> viewer-channel;
in property <int> viewer-streamer-id: -1;
// Shown instead of (or over) the picture: waiting, ended, errors.
in property <string> viewer-status;
in property <string> viewer-info;
in property <bool> viewer-ended;
in-out property <float> viewer-volume: 100;
in property <bool> viewer-fullscreen;
// The viewer fills the window without the shell ("pop out").
in-out property <bool> viewer-popped;
// "12:34" since the stream was joined.
in property <string> viewer-elapsed;
in property <int> viewer-count;
// Simulcast layers the streamer offers, "Auto" first.
in property <[string]> viewer-qualities;
in-out property <int> viewer-quality: 0;
// What "Auto" picked ("720p · 2.4 Mbit/s").
in property <string> viewer-quality-detail;
// The streamer is in an admin group (the crown beside their name).
in property <bool> viewer-streamer-admin;
// Settings.
in property <[string]> input-devices;
in property <[string]> output-devices;
in-out property <AudioForm> audio;
// Microphone level in dBFS and whether voice is sent.
in property <float> input-level: -100;
in property <bool> input-sending;
in property <bool> mic-test;
in-out property <bool> global-ptt;
in-out property <string> ptt-key;
in property <string> ptt-status;
in-out property <bool> h264-enabled;
in property <bool> h264-loaded;
in property <bool> h264-busy;
in property <string> h264-status;
in property <string> h264-attribution;
in-out property <AppearanceForm> appearance;
// "3.2 of 64 MB"
in property <string> image-cache-usage;
// The product name (voelin_platform::APP_NAME, not translated) and version.
in property <string> app-name: "Voelin";
in property <string> app-version;
in-out property <ClientAudio> client-audio;
// Opt-in local crash reports, and a notice about reports on disk.
in-out property <bool> crash-reports;
in property <string> crash-notice;
// Third-party notices, one entry per line, for the About page.
in property <[string]> notices;
callback select-server(int);
// The search field of the top bar: filters the channel tree.
callback search(string);
callback connect-voice();
callback disconnect-voice();
callback toggle-observe();
callback join-channel(int);
callback open-channel-chat(int);
callback toggle-collapse(int);
callback select-tab(int);
callback close-tab(int);
callback send-message(string);
// The page before the oldest shown message.
callback load-older();
// A message of the current chat, by its `key`.
callback react(int, string);
callback pin(int, bool);
callback download-file(int, int);
// Attach a file to the current channel chat (opens a file chooser).
callback attach-file();
// Pins drawer.
callback open-pins();
callback jump-to-pin(int);
// Topics drawer: load them, open one (-1 closes), post into the open
// one, start one from a message (by its `key`).
callback open-topics();
callback open-topic(int);
callback send-topic-message(string);
callback create-topic(int, string);
// The member card: open it for a client (-1 closes it).
callback open-member(int);
callback member-action(string);
callback member-volume(float);
callback set-input-muted(bool);
callback set-output-muted(bool);
callback push-to-talk(bool);
callback edit-bookmark(int) -> BookmarkForm;
callback save-bookmark(BookmarkForm);
callback delete-bookmark(int);
callback open-share() -> ShareForm;
callback start-share(ShareForm);
callback stop-share();
callback respond-viewer(int, bool);
callback kick-viewer(int);
callback watch-stream(string);
callback show-viewer();
callback hide-viewer();
callback leave-stream();
callback set-stream-volume(float);
callback toggle-fullscreen();
// A simulcast layer of the watched stream (0: Auto).
callback set-stream-quality(int);
callback open-settings();
callback close-settings();
callback audio-changed(AudioForm);
callback toggle-mic-test();
callback apply-ptt(bool, string);
callback set-h264(bool);
callback download-h264();
callback appearance-changed(AppearanceForm);
// The members panel was dragged to another width (pixels).
callback panel-resized(float);
// The voice channel view was opened or closed.
callback show-voice-view(bool);
// The members panel's search field.
callback search-members(string);
// The topics drawer's search field.
callback search-topics(string);
callback open-client(int) -> bool;
callback client-audio-changed(ClientAudio);
callback set-crash-reports(bool);
callback open-crash-folder();
callback delete-crash-reports();
callback dismiss-crash-notice();
callback open-about();
// A link to our voice channel (`ts3server://`) to hand to others; the
// caller copies it.
callback invite() -> string;
}
// Decoded images by key, from Rust's image cache (src/images.rs): each is
// decoded once and kept while the cache (setting `ui.image_cache_mb`) has
// room.
export global Images {
// A Twemoji by key ("1f600", "1f468-200d-1f4bb"); empty if unknown.
pure callback emoji(string) -> image;
// The characters of a Twemoji key, to react with or to insert.
pure callback emoji-text(string) -> string;
}
// One emoji of the picker. `text` is what picking it inserts.
export struct EmojiCell {
key: string,
name: string,
text: string,
}
export struct EmojiRow {
cells: [EmojiCell],
}
// The emoji picker's data (src/bind/emoji.rs).
export global Emoji {
// The shown category as rows of `columns` cells.
in property <[EmojiRow]> rows;
// The category shown (see EmojiPicker), -1 while searching.
in-out property <int> category: 0;
in property <int> columns: 8;
// Filled once the picker is first opened.
callback load();
callback show-category(int);
callback search(string);
}