Files
VoelinClient/crates/voelin-ui-vm/src/bridge.rs
T
faumarayandClaude Sonnet 5.5 4dc8272c64 Add voelin-ui-vm: toolkit-free view-model types and the Slint adapter
New crate voelin-ui-vm with no UI toolkit in its tree: ImageRef
(Arc<ImageSource>: File, Rgba, Svg, Memory, None, with size()), Rgb for
colours, list::diff(old, new) -> Changes (updates, removals and
insertions by index) and the bridge structs as plain Clone + PartialEq
values (the 51 of bridge.slint without the account's two, and the 10 of
studio-bridge.slint). Strings are Arc<str>, lists Vec.

voelin-ui keeps the temporary seam: From impls between every bridge
struct and its Slint twin (bind/convert), and bind/rows.rs, which applies
Changes to a VecModel and converts only the rows that changed. The
viewer's quality list is the first model on it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-20 08:53:13 +03:00

935 lines
27 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//! The bridge structs: the rows and forms the screens show, as plain
//! values. They mirror the Slint structs of `crates/voelin-ui/ui/bridge.slint`
//! field by field (strings are shared `Arc<str>`, pictures [`ImageRef`],
//! colours [`Rgb`], lists `Vec`); the Slint crate converts them
//! (`bind/convert.rs`), the GPUI client will render them as they are.
//! `MytsBadge` and `MytsForm` (account screens without a data source in this
//! build) stay in Slint.
use std::sync::Arc;
use crate::color::Rgb;
use crate::image::ImageRef;
/// A row or form of the bridge (the plain counterpart of the Slint struct `ServerItem`).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ServerItem {
pub id: i32,
pub name: Arc<str>,
pub address: Arc<str>,
/// "offline", "connecting", "observing" or "connected"
pub status: Arc<str>,
/// Avatar of a server without an icon.
pub initials: Arc<str>,
pub tint: Rgb,
/// The server's icon, empty without one.
pub icon: ImageRef,
/// Unread messages in its chats.
pub unread: i32,
/// Someone streams in our channel there.
pub live: bool,
/// "9 online · 7 channels" while its presence is known, else the address.
pub detail: Arc<str>,
/// "TeamSpeak 6", "TeamSpeak 3", "" before it was reached.
pub product: Arc<str>,
/// Gateway or query credentials: presence without joining.
pub gateway: bool,
}
/// A row or form of the bridge (the plain counterpart of the Slint struct `TreeItem`).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct TreeItem {
pub is_channel: bool,
/// A TeamSpeak spacer channel, its name without the `[cspacer1]` part:
/// 0 none, 1 left, 2 centred, 3 right, 4 a line (the name repeats its
/// pattern across the row).
pub spacer: i32,
pub depth: i32,
pub id: i32,
pub name: Arc<str>,
pub own: bool,
pub talking: bool,
pub muted: bool,
pub sound_off: bool,
pub away: bool,
pub streaming: bool,
pub locked: bool,
pub collapsed: bool,
/// Local playback of this client: muted, or its volume in percent
/// (100 = unchanged).
pub local_muted: bool,
pub local_volume: i32,
/// Our own client.
pub myself: bool,
/// Avatar of a client.
pub initials: Arc<str>,
pub tint: Rgb,
/// The client's avatar picture, empty without one.
pub avatar: ImageRef,
/// Channels: clients inside, and the limit (-1: none).
pub members: i32,
pub max_members: i32,
/// Leading channel icon or trailing client icons, empty where absent: a channel's
/// icon; a client's server group icons, its channel group's and its own,
/// in that order (the first three).
pub icon: ImageRef,
pub icon_2: ImageRef,
pub icon_3: ImageRef,
/// A client's badges (myTeamSpeak), the first three in its order, empty
/// where absent; shown after the name.
pub badge: ImageRef,
pub badge_2: ImageRef,
pub badge_3: ImageRef,
/// A channel's banner picture (TeamSpeak 6), drawn behind the row;
/// Wire sizing metadata; compact decorative backgrounds always cover.
pub banner: ImageRef,
pub banner_mode: i32,
}
/// A client for the members panel (everyone on the server) and the voice
/// channel view (our channel).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct MemberItem {
pub id: i32,
pub name: Arc<str>,
pub initials: Arc<str>,
pub tint: Rgb,
pub avatar: ImageRef,
pub talking: bool,
pub muted: bool,
pub sound_off: bool,
pub away: bool,
pub streaming: bool,
pub myself: bool,
/// "Speaking", "Streaming", "Away", ...
pub status: Arc<str>,
/// The away message, empty without one.
pub away_message: Arc<str>,
/// The section the row is in (a server group, "In Voice",
/// "Streaming"), and the group's icon.
pub group: Arc<str>,
pub group_icon: ImageRef,
/// The first row of its section draws the heading, with the number of
/// rows in the section.
pub first_in_group: bool,
pub group_count: i32,
/// Badges: a crown for the server's admin groups.
pub admin: bool,
/// A moderator group's name, shown as a role next to the name.
pub role: Arc<str>,
pub priority: bool,
pub commander: bool,
pub recording: bool,
/// Its channel needs more talk power than it has (and it is no
/// talker): it cannot speak.
pub cannot_talk: bool,
/// myTeamSpeak badges, as in `TreeItem`.
pub badge: ImageRef,
pub badge_2: ImageRef,
pub badge_3: ImageRef,
}
/// A myTeamSpeak badge on the member card: "Badge" and its GUID for one
/// the app does not know; its picture is empty until it is downloaded.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct BadgeItem {
pub name: Arc<str>,
pub description: Arc<str>,
pub icon: ImageRef,
}
/// The member card over a member row: everything about one client and what
/// can be done with them.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct MemberCard {
pub open: bool,
pub id: i32,
pub name: Arc<str>,
pub initials: Arc<str>,
pub tint: Rgb,
pub avatar: ImageRef,
pub status: Arc<str>,
pub description: Arc<str>,
/// Server groups, one per line.
pub groups: Vec<Arc<str>>,
/// The badges the client shows (at most three, in its order).
pub badges: Vec<BadgeItem>,
pub country: Arc<str>,
pub talk_power: i32,
pub friend: bool,
pub blocked: bool,
/// Local playback, in percent.
pub volume: f32,
pub muted: bool,
/// The client has a unique id, so contacts and private chats work.
pub known: bool,
/// The client streams: the card offers to watch it.
pub streaming: bool,
}
/// A row or form of the bridge (the plain counterpart of the Slint struct `ChatTab`).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ChatTab {
/// "Lobby", "@alice", "Server"
pub title: Arc<str>,
/// The name alone ("Lobby").
pub name: Arc<str>,
/// 0 = server chat, 1 = channel chat, 2 = private chat
pub kind: i32,
pub id: i32,
pub unread: i32,
/// The channel's topic (channel chats).
pub topic: Arc<str>,
/// The last message ("Mira: the banner I promised") and its time.
pub last: Arc<str>,
pub time: Arc<str>,
/// The channel's banner picture behind the chat's header (as TreeItem).
pub banner: ImageRef,
pub banner_mode: i32,
}
/// A piece of a chat line: a word in its style, or an emoji shown as an
/// image (`emoji` is its Twemoji key, e.g. "1f600"; `text` then holds the
/// characters).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct TextRun {
pub text: Arc<str>,
pub emoji: Arc<str>,
pub bold: bool,
pub italic: bool,
pub underline: bool,
pub strike: bool,
/// Code: on a background.
pub code: bool,
/// The author's colour, made readable on each theme; transparent: the
/// text's own.
pub ink_dark: Option<Rgb>,
pub ink_light: Option<Rgb>,
/// Where it links to ("": nowhere), and whether its text shows something
/// else (a page's name, another address): asked about before it opens.
pub link: Arc<str>,
pub masked: bool,
}
/// A block of a chat line (`vm::bbcode`): its runs, and what it is.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct TextBlock {
pub runs: Vec<TextRun>,
/// 0 = a line, 1 = a quote's line, 2 = a line of code, 3 = a list item,
/// 4 = a rule (no runs)
pub kind: i32,
/// Who a quote quotes, on its first line.
pub caption: Arc<str>,
}
/// One emoji under a message, with how many put it there.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ReactionItem {
/// The Twemoji key of the first emoji in `text` ("1f389"), for the image.
pub key: Arc<str>,
pub text: Arc<str>,
pub count: i32,
/// We reacted with it.
pub me: bool,
}
/// A file linked in a message (`ChatMessage::file_refs`).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct FileItem {
pub name: Arc<str>,
/// "2.4 MB", or what the transfer is doing.
pub detail: Arc<str>,
/// Index of the link in the message (what `download-file` takes).
pub index: i32,
/// "", "running", "done", "failed"
pub state: Arc<str>,
/// 0 … 1 while it downloads.
pub progress: f32,
/// A picture, so the icon differs.
pub picture: bool,
/// The picture itself, once downloaded: shown inline instead of the card.
pub preview: ImageRef,
}
/// A row or form of the bridge (the plain counterpart of the Slint struct `ChatLine`).
#[derive(Clone, Debug, Default, PartialEq)]
pub 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).
pub key: i32,
pub author: Arc<str>,
/// The text without formatting, a line per block (shown as it is when
/// the message has neither formatting nor emoji, and read out).
pub text: Arc<str>,
pub time: Arc<str>,
/// The text in blocks of styled runs; only filled when it has
/// formatting or emoji (`rich`).
pub blocks: Vec<TextBlock>,
pub rich: bool,
/// Only one to three emoji: shown large.
pub jumbo: bool,
/// Same author as the line before, shortly after: no header.
pub continued: bool,
pub initials: Arc<str>,
pub tint: Rgb,
pub avatar: ImageRef,
/// From a blocked contact.
pub blocked: bool,
pub pinned: bool,
pub reactions: Vec<ReactionItem>,
pub files: Vec<FileItem>,
/// The gateway knows this message: it can be pinned, reacted to and
/// made into a topic.
pub remote: bool,
/// The topic it belongs to, "" outside a topic.
pub topic: Arc<str>,
/// Highlighted after jumping to it from the pins.
pub marked: bool,
/// The first web address it links to, "" if none.
pub link: Arc<str>,
/// The first new message: the "New" divider is above it (never
/// `continued`).
pub unread_start: bool,
}
/// A pinned message in the pins drawer.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct PinItem {
pub line: ChatLine,
/// "pinned by Nova · 12:04"
pub by: Arc<str>,
}
/// A gateway topic (thread).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct TopicItem {
pub id: i32,
pub title: Arc<str>,
pub creator: Arc<str>,
/// "12 messages · by Nova"
pub detail: Arc<str>,
/// "Last active 3 min ago", and whether that was within the hour.
pub activity: Arc<str>,
pub recent: bool,
pub archived: bool,
}
/// The server dialog: a bookmark (id -1: a new one) and, from a link, where
/// Connect goes.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct BookmarkForm {
pub id: i32,
pub name: Arc<str>,
pub address: Arc<str>,
pub nickname: Arc<str>,
pub server_password: Arc<str>,
/// The server has voice: no Connect.
pub connected: bool,
/// From a link, not stored with the server: the channel to join (a
/// path, or /<id>), its password and a privilege key.
pub channel: Arc<str>,
pub channel_password: Arc<str>,
pub token: Arc<str>,
}
/// 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).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct StreamItem {
pub id: Arc<str>,
pub name: Arc<str>,
pub streamer: Arc<str>,
/// The streamer's channel when it is not ours; empty in ours.
pub channel: Arc<str>,
/// The streamer's client id (their avatar in the members).
pub streamer_id: i32,
/// The streamer's avatar, as the members show it: their picture, or
/// their initials on their colour (also the card's picture's colour).
pub initials: Arc<str>,
pub tint: Rgb,
pub avatar: ImageRef,
/// How many watch it (the gateway's directory; 0 unknown).
pub viewers: i32,
pub audio: bool,
/// "Screen", "Window", "Camera"; and the announced bitrate ("8 Mbit/s").
pub kind: Arc<str>,
pub bitrate: Arc<str>,
/// Shown in the viewer.
pub watching: bool,
/// Our own stream.
pub own: bool,
/// Ours from the Stream Studio: its preview is the card's picture.
pub studio: bool,
}
/// A viewer of our stream. state: "requested", "connecting" or "connected".
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ViewerItem {
pub client: i32,
pub name: Arc<str>,
pub state: Arc<str>,
pub message: Arc<str>,
/// Their avatar picture, empty without one.
pub avatar: ImageRef,
}
/// A capture source for the share dialog.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct SourceItem {
pub name: Arc<str>,
pub detail: Arc<str>,
}
/// A row or form of the bridge (the plain counterpart of the Slint struct `ShareForm`).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ShareForm {
pub source: i32,
pub name: Arc<str>,
/// Index into the frame rate choices (15, 30, 60, 120, 144, 240, 320).
pub fps_index: i32,
/// Frames per second as typed; a choice fills it in. Any number above 0.
pub fps: Arc<str>,
/// Index into the bitrate choices (Auto, 2.5, 4.6, 8, 10, 20, 40, 60
/// Mbit/s).
pub bitrate_index: i32,
/// Video bitrate in kbit/s as typed; a choice fills it in. Empty with
/// Auto: from the size and frame rate shared, up to 60 Mbit/s.
pub bitrate: Arc<str>,
pub audio: bool,
pub auto_accept: bool,
}
/// A row or form of the bridge (the plain counterpart of the Slint struct `AudioForm`).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AudioForm {
/// 0 = system default, then the devices.
pub input_index: i32,
pub output_index: i32,
/// 0 = push-to-talk, 1 = voice activation, 2 = continuous.
pub transmit: i32,
/// dBFS.
pub vad_threshold: f32,
pub echo_cancellation: bool,
pub noise_suppression: bool,
/// 0 = low ... 3 = very high.
pub noise_level: i32,
pub auto_gain: bool,
/// dB.
pub input_gain: f32,
/// Percent.
pub output_volume: f32,
/// Milliseconds.
pub playback_buffer: f32,
}
/// Local playback settings of one client. volume in percent.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ClientAudio {
pub id: i32,
pub name: Arc<str>,
pub volume: f32,
pub muted: bool,
/// The client streams: the dialog offers to watch it.
pub streaming: bool,
}
/// The appearance settings (`ui.*` keys).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AppearanceForm {
/// "dark", "light" or "system"
pub theme: Arc<str>,
pub font_scale: f32,
/// Pixels.
pub narrow_breakpoint: f32,
pub image_cache_mb: f32,
}
/// A contact (friend, blocked or neutral) and where they are now.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ContactItem {
pub uid: Arc<str>,
pub name: Arc<str>,
pub initials: Arc<str>,
pub tint: Rgb,
pub avatar: ImageRef,
/// "friend", "blocked" or "neutral"
pub relation: Arc<str>,
pub online: bool,
pub away: bool,
pub streaming: bool,
/// What they do: "In Chill Zone", "Streaming", "Away: brb", "Offline".
pub status: Arc<str>,
/// Where: the server of the first session that sees them, or "Last seen
/// 2 h ago on Nightfall Guild".
pub place: Arc<str>,
/// "12m ago": online since (this run), else when last seen.
pub when: Arc<str>,
pub note: Arc<str>,
/// Local playback in percent.
pub volume: f32,
pub muted: bool,
/// "Contact since 14 Jan 2022".
pub since: Arc<str>,
/// Every session that sees them: "Nightfall Guild · Chill Zone".
pub spots: Vec<Arc<str>>,
/// A voice connection sees them: they can be messaged, poked, joined.
pub reachable: bool,
pub selected: bool,
}
/// A live stream on one of our servers (home page).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct LiveItem {
/// The session (bookmark id) and the stream (directory or stream id).
pub session: i32,
pub id: Arc<str>,
pub title: Arc<str>,
pub streamer: Arc<str>,
pub initials: Arc<str>,
pub tint: Rgb,
pub avatar: ImageRef,
pub server: Arc<str>,
pub channel: Arc<str>,
/// 0: unknown.
pub viewers: i32,
/// "Screen", "Camera", ...
pub kind: Arc<str>,
/// The server's colour, for the card's picture.
pub backdrop: Rgb,
/// In our voice channel: it can be watched at once.
pub watchable: bool,
}
/// A chat in the recent chats and in the direct messages list.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ConversationItem {
/// Index in Rust's list (what `open-conversation` takes).
pub key: i32,
/// 0 server chat, 1 channel chat, 2 private chat, 3 offline message.
pub kind: i32,
pub title: Arc<str>,
/// The server's name.
pub server: Arc<str>,
/// "You: That works!", "Sent a file".
pub preview: Arc<str>,
/// "11:42", "Yesterday", "Mon", "12 Mar".
pub time: Arc<str>,
/// "10m ago".
pub ago: Arc<str>,
pub unread: i32,
pub initials: Arc<str>,
pub tint: Rgb,
pub avatar: ImageRef,
pub online: bool,
pub selected: bool,
}
/// A notification of the bell.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct NoticeItem {
pub key: i32,
/// "mention", "poke", "message", "event", "friend"
pub kind: Arc<str>,
pub title: Arc<str>,
pub body: Arc<str>,
/// "3 min ago"
pub time: Arc<str>,
pub unread: bool,
pub initials: Arc<str>,
pub tint: Rgb,
pub avatar: ImageRef,
}
/// A result of the search (Ctrl+K).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct SearchItem {
/// "server", "channel", "person", "contact", "setting"
pub kind: Arc<str>,
pub title: Arc<str>,
pub subtitle: Arc<str>,
pub initials: Arc<str>,
pub tint: Rgb,
pub avatar: ImageRef,
/// The first result of a group names it ("Servers", "People", ...).
pub header: Arc<str>,
}
/// Something on our servers: an event, a scheduled stream or server news.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct HappeningItem {
/// "event", "stream", "news"
pub kind: Arc<str>,
pub title: Arc<str>,
pub subtitle: Arc<str>,
/// "Sat 26 Apr · 19:00"
pub when: Arc<str>,
pub session: i32,
pub id: i32,
pub live: bool,
}
/// Home's "Continue where you left off": the voice channel we were in last.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ResumeItem {
/// There is one: its server is still a bookmark at the same address.
pub shown: bool,
pub server_id: i32,
pub server: Arc<str>,
pub initials: Arc<str>,
pub tint: Rgb,
pub icon: ImageRef,
/// The channel's name as the tree shows it.
pub channel: Arc<str>,
/// Voice is connected there: the button shows the server; else it
/// connects into the channel.
pub open: bool,
pub connecting: bool,
}
/// A scheduled event of a server's gateway.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct EventItem {
pub id: i32,
pub title: Arc<str>,
pub description: Arc<str>,
/// The date block: "SAT", "26", "APR".
pub weekday: Arc<str>,
pub day: Arc<str>,
pub month: Arc<str>,
/// "Sat 26 Apr, 19:00 – 21:00"
pub when: Arc<str>,
/// "Raid Night" or "Server-wide".
pub place: Arc<str>,
/// A scheduled stream: "Exploring the Lands Between · Elden Ring".
pub stream: Arc<str>,
pub live: bool,
pub going: i32,
pub maybe: i32,
pub not_going: i32,
/// "going", "maybe", "not_going" or "".
pub rsvp: Arc<str>,
pub creator: Arc<str>,
/// We may edit and delete it (ours, or we moderate).
pub editable: bool,
/// "Starts in 15 min", "Started 5 min ago", "".
pub soon: Arc<str>,
/// "Nova (going)", ...; filled once the event was opened.
pub attendees: Vec<Arc<str>>,
pub expanded: bool,
}
/// The event form (create or edit).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct EventForm {
/// -1: a new event.
pub id: i32,
pub title: Arc<str>,
pub description: Arc<str>,
/// "2026-10-04 19:00", local time.
pub start: Arc<str>,
/// Empty: no end.
pub end: Arc<str>,
/// Index into `event-channels` (0: server-wide).
pub channel: i32,
pub stream: bool,
pub stream_title: Arc<str>,
pub game: Arc<str>,
}
/// An offline message to write (mail the server keeps).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct OfflineForm {
/// The peer's unique id and name.
pub uid: Arc<str>,
pub to: Arc<str>,
pub subject: Arc<str>,
pub text: Arc<str>,
}
/// The open direct message: who, and what can be done.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct DmPeer {
pub open: bool,
pub uid: Arc<str>,
pub name: Arc<str>,
pub initials: Arc<str>,
pub tint: Rgb,
pub avatar: ImageRef,
pub online: bool,
/// "Online · Nightfall Guild · Chill Zone", "Offline · last seen 2 h ago".
pub status: Arc<str>,
pub description: Arc<str>,
pub groups: Vec<Arc<str>>,
pub note: Arc<str>,
pub since: Arc<str>,
/// Where they are now, or where they were last seen.
pub servers: Vec<Arc<str>>,
/// Pictures linked in the conversation that are downloaded, newest
/// first (at most six; `media-more` counts the others), and the other
/// files: name, "2.4 MB · Today at 11:36", picture.
pub media: Vec<ImageRef>,
pub media_more: i32,
pub files: Vec<FileItem>,
pub friend: bool,
pub blocked: bool,
pub volume: f32,
pub muted: bool,
/// Messages can be sent now (a voice connection that sees them).
pub can_send: bool,
/// Why not: "Kairo is offline.", "Connect to Nightfall Guild to send."
pub notice: Arc<str>,
/// The server keeps offline messages: offer one.
pub offline: bool,
/// Connect with voice to the server of this conversation.
pub can_connect: bool,
/// The messages come from the store, without a session: read-only.
pub stored: bool,
/// An offline message is shown instead of the conversation.
pub mail: bool,
pub mail_subject: Arc<str>,
pub mail_text: Arc<str>,
pub mail_time: Arc<str>,
}
/// An identity (Profiles page); never its key.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct IdentityItem {
pub id: i32,
pub name: Arc<str>,
/// Unique ids on TeamSpeak 3 and TeamSpeak 6 servers.
pub uid: Arc<str>,
pub uid6: Arc<str>,
pub level: i32,
/// The store's default: servers see us as this one unless a bookmark
/// names another.
pub default: bool,
/// Where it came from: "Made in Voelin", "Imported", "Chosen by you".
pub origin: Arc<str>,
/// Raising its level: the level aimed at and the best one reached (0: no).
pub improving: i32,
pub reached: i32,
/// The bookmarks that use it.
pub used_by: Arc<str>,
}
/// An identity found in another client's files (import).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct FoundIdentity {
pub name: Arc<str>,
pub uid: Arc<str>,
pub level: i32,
pub source: Arc<str>,
/// Already in our identities.
pub known: bool,
pub picked: bool,
}
/// A bookmark and the identity it connects with (Profiles page).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct BookmarkIdentity {
pub id: i32,
pub name: Arc<str>,
/// Index into `identity-names` (0: the default identity).
pub identity: i32,
}
/// Camera, video and stream quality (Voice & Video page).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct VideoForm {
/// Index into `cameras`.
pub camera: i32,
/// 0 none, 1 blur.
pub background: i32,
/// "auto", "1280x720", ...
pub resolution: Arc<str>,
/// `stream.fps` as typed.
pub fps: Arc<str>,
/// auto, vp8, vp9, h264, av1.
pub codec: i32,
pub hardware: bool,
pub mirror: bool,
/// everyone, friends, channel, nobody.
pub permissions: i32,
/// 0 auto, 1 720p, 2 1080p, 3 1440p, -1 other layers.
pub quality: i32,
/// kbit/s.
pub bitrate: f32,
/// The camera preview runs.
pub preview: bool,
}
/// A simulcast layer of our stream (Streaming page); numbers as typed.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct LayerItem {
/// "1920x1080", or a scale like "0.5".
pub size: Arc<str>,
/// Frames per second; "" no cap.
pub fps: Arc<str>,
/// kbit/s.
pub bitrate: Arc<str>,
pub min_bitrate: Arc<str>,
pub max_bitrate: Arc<str>,
}
/// An audio source mixed into our stream.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AudioSourceItem {
/// "desktop", "app", "window", "microphone", "synthetic"
pub kind: Arc<str>,
pub name: Arc<str>,
pub detail: Arc<str>,
/// Percent.
pub gain: f32,
pub muted: bool,
}
/// Stream defaults (Streaming page).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct StreamingForm {
pub fps: Arc<str>,
pub bitrate: Arc<str>,
/// auto, vp8, vp9, h264, av1.
pub codec: i32,
/// auto, portal, wlroots, x11.
pub capture: i32,
pub replay_seconds: Arc<str>,
pub replay_memory: Arc<str>,
pub recording_dir: Arc<str>,
}
/// Notification kinds: 0 off, 1 in the app, 2 also on the desktop.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct NotifyForm {
pub mentions: i32,
pub pokes: i32,
pub messages: i32,
pub events: i32,
pub friends: i32,
}
/// Privacy & Safety.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct PrivacyForm {
/// 0 hide, 1 show flagged.
pub block_mode: i32,
/// everyone, friends, nobody.
pub messages: i32,
pub pokes: i32,
}
/// A server's gateway (Integrations page).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct GatewayItem {
pub session: i32,
pub server: Arc<str>,
pub url: Arc<str>,
/// "connected", "connecting", "off"
pub status: Arc<str>,
pub features: Vec<Arc<str>>,
pub admin: bool,
}
/// A gateway configuration key (gateway administration).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ConfigItem {
pub key: Arc<str>,
/// JSON.
pub value: Arc<str>,
pub source: Arc<str>,
pub description: Arc<str>,
pub kind: Arc<str>,
pub bootstrap: bool,
}
/// A gateway permission rule.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct PermItem {
pub action: Arc<str>,
/// "Everyone", "Server groups 6, 7", "Default: server admins".
pub rule: Arc<str>,
pub source: Arc<str>,
pub everyone: bool,
pub server_groups: Arc<str>,
pub channel_groups: Arc<str>,
}
/// A video encoder backend (Integrations page).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct EncoderItem {
pub name: Arc<str>,
pub api: Arc<str>,
pub codec: Arc<str>,
pub hardware: bool,
pub ok: bool,
/// Why it does not work, or "used first".
pub status: Arc<str>,
}
/// Any registered setting (Advanced page).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct SettingItem {
pub key: Arc<str>,
pub doc: Arc<str>,
/// JSON.
pub value: Arc<str>,
/// "set here", "command line", "config file", "default".
pub source: Arc<str>,
}
/// A recording or clip of the Stream Studio (Library).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct RecordingItem {
pub name: Arc<str>,
/// "12.3 MB · 3 Oct 18:04".
pub detail: Arc<str>,
pub clip: bool,
pub path: Arc<str>,
}
/// Encoders, chat history, cache and logs (Advanced page); numbers as typed.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AdvancedForm {
pub encoder: Arc<str>,
pub hardware: bool,
/// `stream.decoder_backend`, `stream.hardware_decoding`.
pub decoder: Arc<str>,
pub hardware_decoding: bool,
pub store_history: bool,
pub history_page: Arc<str>,
pub dedupe_ms: Arc<str>,
pub retention_days: Arc<str>,
pub cache_mb: Arc<str>,
pub fetch_images: bool,
pub progress_ms: Arc<str>,
/// `ui.image_preview_kb`.
pub preview_kb: Arc<str>,
pub logs: Arc<str>,
pub crash_dir: Arc<str>,
}
/// A row or form of the bridge (the plain counterpart of the Slint struct `AccountForm`).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AccountForm {
pub nickname: Arc<str>,
pub identity: Arc<str>,
pub uid: Arc<str>,
pub uid6: Arc<str>,
pub level: i32,
pub server: Arc<str>,
}
/// One emoji of the picker. `text` is what picking it inserts.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct EmojiCell {
pub key: Arc<str>,
pub name: Arc<str>,
pub text: Arc<str>,
}
/// A row or form of the bridge (the plain counterpart of the Slint struct `EmojiRow`).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct EmojiRow {
pub cells: Vec<EmojiCell>,
}