diff --git a/crates/voelin-ui-vm/src/bridge.rs b/crates/voelin-ui-vm/src/bridge.rs index ecf4177..f027f46 100644 --- a/crates/voelin-ui-vm/src/bridge.rs +++ b/crates/voelin-ui-vm/src/bridge.rs @@ -6,10 +6,9 @@ //! `MytsBadge` and `MytsForm` (account screens without a data source in this //! build) stay in Slint. //! -//! The fields are not documented one by one: they are those of the Slint -//! structs, whose comments in `bridge.slint` explain them; the comments that -//! are here were carried over with them. -#![allow(missing_docs)] +//! Every field is documented here: the comments of `bridge.slint` were +//! carried over, and the fields that had none were described from the code +//! that fills them. use std::sync::Arc; @@ -19,13 +18,17 @@ 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 { + /// The bookmark's id, which is the session's too. pub id: i32, + /// The server's name. pub name: Arc, + /// The address the bookmark connects to. pub address: Arc, /// "offline", "connecting", "observing" or "connected" pub status: Arc, /// Avatar of a server without an icon. pub initials: Arc, + /// The colour of its avatar. pub tint: Rgb, /// The server's icon, empty without one. pub icon: ImageRef, @@ -44,50 +47,70 @@ pub struct ServerItem { /// A row or form of the bridge (the plain counterpart of the Slint struct `TreeItem`). #[derive(Clone, Debug, Default, PartialEq)] pub struct TreeItem { + /// A channel; else a client. 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, + /// How far the row is indented: its level in the tree. pub depth: i32, + /// The channel's or the client's id on the server. pub id: i32, + /// A channel's name (a spacer's text, without its `[cspacer1]` part) or a client's nickname. pub name: Arc, + /// Our own channel (channels). pub own: bool, + /// The client is speaking. pub talking: bool, + /// The client's microphone is muted. pub muted: bool, + /// The client's speakers are muted. pub sound_off: bool, + /// The client is away. pub away: bool, + /// The client streams. pub streaming: bool, + /// The channel needs a password. pub locked: bool, + /// The channel's contents are hidden. pub collapsed: bool, /// Local playback of this client: muted, or its volume in percent /// (100 = unchanged). pub local_muted: bool, + /// Its local volume in percent; 100 is unchanged. pub local_volume: i32, /// Our own client. pub myself: bool, /// Avatar of a client. pub initials: Arc, + /// The colour of the client's avatar. 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, + /// The channel's limit of clients; -1: none. 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, + /// The second icon, as `icon`. pub icon_2: ImageRef, + /// The third icon, as `icon`. 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, + /// The second badge, as `badge`. pub badge_2: ImageRef, + /// The third badge, as `badge`. 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, + /// How the server sizes the banner: 0 as it is, 1 stretched, 2 scaled keeping the aspect ratio. pub banner_mode: i32, } @@ -95,16 +118,27 @@ pub struct TreeItem { /// channel view (our channel). #[derive(Clone, Debug, Default, PartialEq)] pub struct MemberItem { + /// The client's id on the server. pub id: i32, + /// Its nickname. pub name: Arc, + /// The initials of its avatar. pub initials: Arc, + /// The colour of its avatar. pub tint: Rgb, + /// Its avatar picture, empty without one. pub avatar: ImageRef, + /// It is speaking. pub talking: bool, + /// Its microphone is muted. pub muted: bool, + /// Its speakers are muted. pub sound_off: bool, + /// It is away. pub away: bool, + /// It streams. pub streaming: bool, + /// Our own client. pub myself: bool, /// "Speaking", "Streaming", "Away", ... pub status: Arc, @@ -113,24 +147,31 @@ pub struct MemberItem { /// The section the row is in (a server group, "In Voice", /// "Streaming"), and the group's icon. pub group: Arc, + /// The section's icon, empty where it has none. 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, + /// The number of rows in its section. 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, + /// It is a priority speaker. pub priority: bool, + /// It is a channel commander. pub commander: bool, + /// It is recording the conversation. 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, + /// The second badge. pub badge_2: ImageRef, + /// The third badge. pub badge_3: ImageRef, } @@ -138,8 +179,11 @@ pub struct MemberItem { /// the app does not know; its picture is empty until it is downloaded. #[derive(Clone, Debug, Default, PartialEq)] pub struct BadgeItem { + /// The badge's name. pub name: Arc, + /// What the badge says of its holder. pub description: Arc, + /// The badge's picture, empty until it is downloaded. pub icon: ImageRef, } @@ -147,24 +191,37 @@ pub struct BadgeItem { /// can be done with them. #[derive(Clone, Debug, Default, PartialEq)] pub struct MemberCard { + /// The card is shown. pub open: bool, + /// The client's id on the server. pub id: i32, + /// Its nickname. pub name: Arc, + /// The initials of its avatar. pub initials: Arc, + /// The colour of its avatar. pub tint: Rgb, + /// Its avatar picture, empty without one. pub avatar: ImageRef, + /// What it does: "Speaking", "Streaming", "Away", ... (as `MemberItem::status`). pub status: Arc, + /// The description the client set. pub description: Arc, /// Server groups, one per line. pub groups: Vec>, /// The badges the client shows (at most three, in its order). pub badges: Vec, + /// The country the server reports for it, empty if none. pub country: Arc, + /// Its talk power. pub talk_power: i32, + /// It is one of our friends. pub friend: bool, + /// It is a blocked contact. pub blocked: bool, /// Local playback, in percent. pub volume: f32, + /// Its voice is muted for us (local playback). pub muted: bool, /// The client has a unique id, so contacts and private chats work. pub known: bool, @@ -181,15 +238,19 @@ pub struct ChatTab { pub name: Arc, /// 0 = server chat, 1 = channel chat, 2 = private chat pub kind: i32, + /// A channel chat's channel id; 0 for the others. pub id: i32, + /// How many of its messages are unread. pub unread: i32, /// The channel's topic (channel chats). pub topic: Arc, /// The last message ("Mira: the banner I promised") and its time. pub last: Arc, + /// The time of the last message. pub time: Arc, /// The channel's banner picture behind the chat's header (as TreeItem). pub banner: ImageRef, + /// As `TreeItem::banner_mode`. pub banner_mode: i32, } @@ -198,27 +259,36 @@ pub struct ChatTab { /// characters). #[derive(Clone, Debug, Default, PartialEq)] pub struct TextRun { + /// The characters of the run. pub text: Arc, + /// The Twemoji key if the run is an emoji, else empty. pub emoji: Arc, + /// In bold. pub bold: bool, + /// In italics. pub italic: bool, + /// Underlined. pub underline: bool, + /// Struck through. 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, + /// The author's colour made readable on the light theme (`ink_dark`: the dark one). pub ink_light: Option, /// 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, + /// Its text shows something else than the address it links to. 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 { + /// The pieces of the block, in order. pub runs: Vec, /// 0 = a line, 1 = a quote's line, 2 = a line of code, 3 = a list item, /// 4 = a rule (no runs) @@ -232,7 +302,9 @@ pub struct TextBlock { pub struct ReactionItem { /// The Twemoji key of the first emoji in `text` ("1f389"), for the image. pub key: Arc, + /// The emoji, as text. pub text: Arc, + /// How many reacted with it. pub count: i32, /// We reacted with it. pub me: bool, @@ -241,6 +313,7 @@ pub struct ReactionItem { /// A file linked in a message (`ChatMessage::file_refs`). #[derive(Clone, Debug, Default, PartialEq)] pub struct FileItem { + /// The file's name. pub name: Arc, /// "2.4 MB", or what the transfer is doing. pub detail: Arc, @@ -262,26 +335,35 @@ 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, + /// The author's name. pub author: Arc, /// 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, + /// When it was sent, as shown ("11:42"). pub time: Arc, /// The text in blocks of styled runs; only filled when it has /// formatting or emoji (`rich`). pub blocks: Vec, + /// The blocks are shown, not `text`. 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, + /// The initials of the author's avatar. pub initials: Arc, + /// The colour of the author's avatar. pub tint: Rgb, + /// The author's avatar picture, empty without one. pub avatar: ImageRef, /// From a blocked contact. pub blocked: bool, + /// The message is pinned. pub pinned: bool, + /// The reactions to it. pub reactions: Vec, + /// The files it links to. pub files: Vec, /// The gateway knows this message: it can be pinned, reacted to and /// made into a topic. @@ -300,6 +382,7 @@ pub struct ChatLine { /// A pinned message in the pins drawer. #[derive(Clone, Debug, Default, PartialEq)] pub struct PinItem { + /// The pinned message. pub line: ChatLine, /// "pinned by Nova · 12:04" pub by: Arc, @@ -308,14 +391,19 @@ pub struct PinItem { /// A gateway topic (thread). #[derive(Clone, Debug, Default, PartialEq)] pub struct TopicItem { + /// The topic's id on the gateway. pub id: i32, + /// Its title. pub title: Arc, + /// Who started it. pub creator: Arc, /// "12 messages · by Nova" pub detail: Arc, /// "Last active 3 min ago", and whether that was within the hour. pub activity: Arc, + /// It was active within the hour. pub recent: bool, + /// It is archived. pub archived: bool, } @@ -323,17 +411,24 @@ pub struct TopicItem { /// Connect goes. #[derive(Clone, Debug, Default, PartialEq)] pub struct BookmarkForm { + /// The bookmark's id; -1: a new one. pub id: i32, + /// The name, empty to use the address. pub name: Arc, + /// The server's address. pub address: Arc, + /// The nickname to connect with. pub nickname: Arc, + /// The server's password. pub server_password: Arc, /// The server has voice: no Connect. pub connected: bool, /// From a link, not stored with the server: the channel to join (a /// path, or `/`), its password and a privilege key. pub channel: Arc, + /// The password of the channel to join. pub channel_password: Arc, + /// A privilege key to use on joining. pub token: Arc, } @@ -342,8 +437,11 @@ pub struct BookmarkForm { /// being looked up (it started before we joined, or in another channel). #[derive(Clone, Debug, Default, PartialEq)] pub struct StreamItem { + /// The stream's id; empty while it is looked up. pub id: Arc, + /// The stream's title. pub name: Arc, + /// The streamer's name. pub streamer: Arc, /// The streamer's channel when it is not ours; empty in ours. pub channel: Arc, @@ -352,13 +450,17 @@ pub struct StreamItem { /// 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, + /// The colour of the streamer's avatar. pub tint: Rgb, + /// The streamer's picture, empty without one. pub avatar: ImageRef, /// How many watch it (the gateway's directory; 0 unknown). pub viewers: i32, + /// The stream has sound. pub audio: bool, /// "Screen", "Window", "Camera"; and the announced bitrate ("8 Mbit/s"). pub kind: Arc, + /// The announced bitrate, "8 Mbit/s". pub bitrate: Arc, /// Shown in the viewer. pub watching: bool, @@ -371,9 +473,13 @@ pub struct StreamItem { /// A viewer of our stream. state: "requested", "connecting" or "connected". #[derive(Clone, Debug, Default, PartialEq)] pub struct ViewerItem { + /// The viewer's client id. pub client: i32, + /// The viewer's name. pub name: Arc, + /// "requested", "connecting" or "connected". pub state: Arc, + /// The message of its request to watch. pub message: Arc, /// Their avatar picture, empty without one. pub avatar: ImageRef, @@ -382,14 +488,18 @@ pub struct ViewerItem { /// A capture source for the share dialog. #[derive(Clone, Debug, Default, PartialEq)] pub struct SourceItem { + /// The source's name. pub name: Arc, + /// The line under the name. pub detail: Arc, } /// A row or form of the bridge (the plain counterpart of the Slint struct `ShareForm`). #[derive(Clone, Debug, Default, PartialEq)] pub struct ShareForm { + /// Index into the sources offered (`SourceItem`). pub source: i32, + /// The stream's title. pub name: Arc, /// Index into the frame rate choices (15, 30, 60, 120, 144, 240, 320). pub fps_index: i32, @@ -401,7 +511,9 @@ pub struct ShareForm { /// 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, + /// The stream carries sound too. pub audio: bool, + /// Viewers are let in without being asked. pub auto_accept: bool, } @@ -410,15 +522,19 @@ pub struct ShareForm { pub struct AudioForm { /// 0 = system default, then the devices. pub input_index: i32, + /// As `input_index`, for the output device. pub output_index: i32, /// 0 = push-to-talk, 1 = voice activation, 2 = continuous. pub transmit: i32, /// dBFS. pub vad_threshold: f32, + /// Echo cancellation is on. pub echo_cancellation: bool, + /// Noise suppression is on. pub noise_suppression: bool, /// 0 = low ... 3 = very high. pub noise_level: i32, + /// Automatic gain control is on. pub auto_gain: bool, /// dB. pub input_gain: f32, @@ -431,9 +547,13 @@ pub struct AudioForm { /// Local playback settings of one client. volume in percent. #[derive(Clone, Debug, Default, PartialEq)] pub struct ClientAudio { + /// The client's id on the server. pub id: i32, + /// Its nickname. pub name: Arc, + /// Its playback volume in percent. pub volume: f32, + /// Its playback is muted. pub muted: bool, /// The client streams: the dialog offers to watch it. pub streaming: bool, @@ -444,24 +564,34 @@ pub struct ClientAudio { pub struct AppearanceForm { /// "dark", "light" or "system" pub theme: Arc, + /// The factor the text size is scaled by; 1 is normal. pub font_scale: f32, /// Pixels. pub narrow_breakpoint: f32, + /// Memory for decoded pictures in MB; 0 keeps none. pub image_cache_mb: f32, } /// A contact (friend, blocked or neutral) and where they are now. #[derive(Clone, Debug, Default, PartialEq)] pub struct ContactItem { + /// The contact's unique id. pub uid: Arc, + /// The contact's name. pub name: Arc, + /// The initials of its avatar. pub initials: Arc, + /// The colour of its avatar. pub tint: Rgb, + /// Its avatar picture, empty without one. pub avatar: ImageRef, /// "friend", "blocked" or "neutral" pub relation: Arc, + /// A session sees them. pub online: bool, + /// They are away. pub away: bool, + /// They stream. pub streaming: bool, /// What they do: "In Chill Zone", "Streaming", "Away: brb", "Offline". pub status: Arc, @@ -470,9 +600,11 @@ pub struct ContactItem { pub place: Arc, /// "12m ago": online since (this run), else when last seen. pub when: Arc, + /// Our note about them. pub note: Arc, /// Local playback in percent. pub volume: f32, + /// Their voice is muted for us. pub muted: bool, /// "Contact since 14 Jan 2022". pub since: Arc, @@ -480,6 +612,7 @@ pub struct ContactItem { pub spots: Vec>, /// A voice connection sees them: they can be messaged, poked, joined. pub reachable: bool, + /// They are the contact the friends page shows in full. pub selected: bool, } @@ -488,13 +621,21 @@ pub struct ContactItem { pub struct LiveItem { /// The session (bookmark id) and the stream (directory or stream id). pub session: i32, + /// The stream's id in the directory or on the voice connection. pub id: Arc, + /// The stream's title. pub title: Arc, + /// The streamer's name. pub streamer: Arc, + /// The initials of the streamer's avatar. pub initials: Arc, + /// The colour of the streamer's avatar. pub tint: Rgb, + /// The streamer's picture, empty without one. pub avatar: ImageRef, + /// The server's name. pub server: Arc, + /// The channel's name. pub channel: Arc, /// 0: unknown. pub viewers: i32, @@ -513,6 +654,7 @@ pub struct ConversationItem { pub key: i32, /// 0 server chat, 1 channel chat, 2 private chat, 3 offline message. pub kind: i32, + /// The chat's title: the channel's or the person's name, or the server's. pub title: Arc, /// The server's name. pub server: Arc, @@ -522,27 +664,40 @@ pub struct ConversationItem { pub time: Arc, /// "10m ago". pub ago: Arc, + /// How many of its messages are unread. pub unread: i32, + /// The initials of its avatar. pub initials: Arc, + /// The colour of its avatar. pub tint: Rgb, + /// Its picture, empty without one. pub avatar: ImageRef, + /// The other person is online (private chats). pub online: bool, + /// It is the conversation that is open. pub selected: bool, } /// A notification of the bell. #[derive(Clone, Debug, Default, PartialEq)] pub struct NoticeItem { + /// What the rows call the notice. pub key: i32, /// "mention", "poke", "message", "event", "friend" pub kind: Arc, + /// The headline. pub title: Arc, + /// The line under it. pub body: Arc, /// "3 min ago" pub time: Arc, + /// It was not opened or marked read. pub unread: bool, + /// The initials of the avatar it shows. pub initials: Arc, + /// The colour of that avatar. pub tint: Rgb, + /// The avatar picture it shows, empty without one. pub avatar: ImageRef, } @@ -551,10 +706,15 @@ pub struct NoticeItem { pub struct SearchItem { /// "server", "channel", "person", "contact", "setting" pub kind: Arc, + /// What the result is called. pub title: Arc, + /// The line under it. pub subtitle: Arc, + /// The initials of its avatar. pub initials: Arc, + /// The colour of its avatar. pub tint: Rgb, + /// Its picture, empty without one. pub avatar: ImageRef, /// The first result of a group names it ("Servers", "People", ...). pub header: Arc, @@ -565,12 +725,17 @@ pub struct SearchItem { pub struct HappeningItem { /// "event", "stream", "news" pub kind: Arc, + /// The event's or stream's title, or the news' headline. pub title: Arc, + /// The line under it, with the server's name. pub subtitle: Arc, /// "Sat 26 Apr · 19:00" pub when: Arc, + /// The session (bookmark id) it is on. pub session: i32, + /// The event's id on the gateway; 0: news. pub id: i32, + /// Its stream is live. pub live: bool, } @@ -579,28 +744,39 @@ pub struct HappeningItem { pub struct ResumeItem { /// There is one: its server is still a bookmark at the same address. pub shown: bool, + /// The server's bookmark id. pub server_id: i32, + /// The server's name. pub server: Arc, + /// The initials of its avatar. pub initials: Arc, + /// The colour of its avatar. pub tint: Rgb, + /// The server's icon, empty without one. pub icon: ImageRef, /// The channel's name as the tree shows it. pub channel: Arc, /// Voice is connected there: the button shows the server; else it /// connects into the channel. pub open: bool, + /// The server is connecting now. pub connecting: bool, } /// A scheduled event of a server's gateway. #[derive(Clone, Debug, Default, PartialEq)] pub struct EventItem { + /// The event's id on the gateway. pub id: i32, + /// The event's title. pub title: Arc, + /// Its description. pub description: Arc, /// The date block: "SAT", "26", "APR". pub weekday: Arc, + /// The day of the month, in the date block. pub day: Arc, + /// The month, abbreviated, in the date block. pub month: Arc, /// "Sat 26 Apr, 19:00 – 21:00" pub when: Arc, @@ -608,12 +784,17 @@ pub struct EventItem { pub place: Arc, /// A scheduled stream: "Exploring the Lands Between · Elden Ring". pub stream: Arc, + /// Its stream is live. pub live: bool, + /// How many go. pub going: i32, + /// How many may go. pub maybe: i32, + /// How many do not go. pub not_going: i32, /// "going", "maybe", "not_going" or "". pub rsvp: Arc, + /// Who made it. pub creator: Arc, /// We may edit and delete it (ours, or we moderate). pub editable: bool, @@ -621,6 +802,7 @@ pub struct EventItem { pub soon: Arc, /// "Nova (going)", ...; filled once the event was opened. pub attendees: Vec>, + /// Its details are open. pub expanded: bool, } @@ -629,7 +811,9 @@ pub struct EventItem { pub struct EventForm { /// -1: a new event. pub id: i32, + /// The event's title. pub title: Arc, + /// Its description. pub description: Arc, /// "2026-10-04 19:00", local time. pub start: Arc, @@ -637,8 +821,11 @@ pub struct EventForm { pub end: Arc, /// Index into `event-channels` (0: server-wide). pub channel: i32, + /// It is a scheduled stream. pub stream: bool, + /// The scheduled stream's title. pub stream_title: Arc, + /// The game or category it shows. pub game: Arc, } @@ -647,26 +834,40 @@ pub struct EventForm { pub struct OfflineForm { /// The peer's unique id and name. pub uid: Arc, + /// The recipient's name. pub to: Arc, + /// The message's subject. pub subject: Arc, + /// The message's text. pub text: Arc, } /// The open direct message: who, and what can be done. #[derive(Clone, Debug, Default, PartialEq)] pub struct DmPeer { + /// A conversation is open. pub open: bool, + /// The peer's unique id. pub uid: Arc, + /// The peer's name. pub name: Arc, + /// The initials of their avatar. pub initials: Arc, + /// The colour of their avatar. pub tint: Rgb, + /// Their avatar picture, empty without one. pub avatar: ImageRef, + /// They are online on one of our servers. pub online: bool, /// "Online · Nightfall Guild · Chill Zone", "Offline · last seen 2 h ago". pub status: Arc, + /// The description they set. pub description: Arc, + /// Their server groups. pub groups: Vec>, + /// Our note about them. pub note: Arc, + /// "Contact since 14 Jan 2022"; empty for no contact. pub since: Arc, /// Where they are now, or where they were last seen. pub servers: Vec>, @@ -674,11 +875,17 @@ pub struct DmPeer { /// 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, + /// How many pictures there are besides the ones in `media`. pub media_more: i32, + /// The other files linked in the conversation. pub files: Vec, + /// They are a friend. pub friend: bool, + /// They are blocked. pub blocked: bool, + /// Their local volume in percent. pub volume: f32, + /// Their voice is muted for us. pub muted: bool, /// Messages can be sent now (a voice connection that sees them). pub can_send: bool, @@ -692,19 +899,26 @@ pub struct DmPeer { pub stored: bool, /// An offline message is shown instead of the conversation. pub mail: bool, + /// The open offline message's subject. pub mail_subject: Arc, + /// Its text, empty until the server has sent it. pub mail_text: Arc, + /// When it was sent. pub mail_time: Arc, } /// An identity (Profiles page); never its key. #[derive(Clone, Debug, Default, PartialEq)] pub struct IdentityItem { + /// The identity's id in the store. pub id: i32, + /// The identity's name. pub name: Arc, /// Unique ids on TeamSpeak 3 and TeamSpeak 6 servers. pub uid: Arc, + /// Its unique id on TeamSpeak 6 servers. pub uid6: Arc, + /// The security level of its key. pub level: i32, /// The store's default: servers see us as this one unless a bookmark /// names another. @@ -713,6 +927,7 @@ pub struct IdentityItem { pub origin: Arc, /// Raising its level: the level aimed at and the best one reached (0: no). pub improving: i32, + /// The best level reached so far while it is raised. pub reached: i32, /// The bookmarks that use it. pub used_by: Arc, @@ -721,19 +936,26 @@ pub struct IdentityItem { /// An identity found in another client's files (import). #[derive(Clone, Debug, Default, PartialEq)] pub struct FoundIdentity { + /// The identity's name. pub name: Arc, + /// Its unique id. pub uid: Arc, + /// The security level of its key. pub level: i32, + /// The other client's file it was found in. pub source: Arc, /// Already in our identities. pub known: bool, + /// It is chosen for the import. pub picked: bool, } /// A bookmark and the identity it connects with (Profiles page). #[derive(Clone, Debug, Default, PartialEq)] pub struct BookmarkIdentity { + /// The bookmark's id. pub id: i32, + /// The bookmark's name. pub name: Arc, /// Index into `identity-names` (0: the default identity). pub identity: i32, @@ -752,7 +974,9 @@ pub struct VideoForm { pub fps: Arc, /// auto, vp8, vp9, h264, av1. pub codec: i32, + /// Hardware video encoders are used where there are some. pub hardware: bool, + /// The camera picture is mirrored. pub mirror: bool, /// everyone, friends, channel, nobody. pub permissions: i32, @@ -773,7 +997,9 @@ pub struct LayerItem { pub fps: Arc, /// kbit/s. pub bitrate: Arc, + /// kbit/s a viewer needs for the layer. pub min_bitrate: Arc, + /// kbit/s the layer may use at most, not below `bitrate`; empty: no limit. pub max_bitrate: Arc, } @@ -782,34 +1008,47 @@ pub struct LayerItem { pub struct AudioSourceItem { /// "desktop", "app", "window", "microphone", "synthetic" pub kind: Arc, + /// The source's name. pub name: Arc, + /// The line under the name. pub detail: Arc, /// Percent. pub gain: f32, + /// It is muted in the mix. pub muted: bool, } /// Stream defaults (Streaming page). #[derive(Clone, Debug, Default, PartialEq)] pub struct StreamingForm { + /// Frames per second as typed (`stream.fps`). pub fps: Arc, + /// kbit/s as typed (`stream.bitrate_kbps`); "Auto" or empty: from the size and frame rate. pub bitrate: Arc, /// auto, vp8, vp9, h264, av1. pub codec: i32, /// auto, portal, wlroots, x11. pub capture: i32, + /// Seconds the replay buffer keeps, as typed; 0: off. pub replay_seconds: Arc, + /// MiB of the replay buffer kept in memory, as typed. pub replay_memory: Arc, + /// The folder of recordings and clips; empty: the default. pub recording_dir: Arc, } /// Notification kinds: 0 off, 1 in the app, 2 also on the desktop. #[derive(Clone, Debug, Default, PartialEq)] pub struct NotifyForm { + /// How a mention notifies: 0 off, 1 in the app, 2 also on the desktop. pub mentions: i32, + /// How a poke notifies, as `mentions`. pub pokes: i32, + /// How a private message notifies, as `mentions`. pub messages: i32, + /// How an event that starts soon notifies, as `mentions`. pub events: i32, + /// How a friend coming online notifies, as `mentions`. pub friends: i32, } @@ -820,52 +1059,74 @@ pub struct PrivacyForm { pub block_mode: i32, /// everyone, friends, nobody. pub messages: i32, + /// Who may poke us, as `messages`. pub pokes: i32, } /// A server's gateway (Integrations page). #[derive(Clone, Debug, Default, PartialEq)] pub struct GatewayItem { + /// The session (bookmark id) whose gateway it is. pub session: i32, + /// The server's name. pub server: Arc, + /// The gateway's address. pub url: Arc, /// "connected", "connecting", "off" pub status: Arc, + /// The features it offers. pub features: Vec>, + /// We may administer it. pub admin: bool, } /// A gateway configuration key (gateway administration). #[derive(Clone, Debug, Default, PartialEq)] pub struct ConfigItem { + /// The dotted key, "history.retention_days". pub key: Arc, /// JSON. pub value: Arc, + /// Where the value comes from: "set at runtime", "command line", "environment", "file" or + /// "default". pub source: Arc, + /// What the key is for. pub description: Arc, + /// The type of the value: `bool`, `int`, `string`, `int_list`, `string_list` or `rule`. pub kind: Arc, + /// It is read at start only and cannot be set at runtime. pub bootstrap: bool, } /// A gateway permission rule. #[derive(Clone, Debug, Default, PartialEq)] pub struct PermItem { + /// What the rule allows. pub action: Arc, /// "Everyone", "Server groups 6, 7", "Default: server admins". pub rule: Arc, + /// Where the rule comes from, as `ConfigItem::source`. pub source: Arc, + /// Everyone is allowed. pub everyone: bool, + /// The server groups allowed, as a list. pub server_groups: Arc, + /// The channel groups allowed, as a list. pub channel_groups: Arc, } /// A video encoder backend (Integrations page). #[derive(Clone, Debug, Default, PartialEq)] pub struct EncoderItem { + /// The encoder backend's name. pub name: Arc, + /// The API it uses. pub api: Arc, + /// The codec it encodes. pub codec: Arc, + /// It encodes in hardware. pub hardware: bool, + /// It works on this machine. pub ok: bool, /// Why it does not work, or "used first". pub status: Arc, @@ -874,7 +1135,9 @@ pub struct EncoderItem { /// Any registered setting (Advanced page). #[derive(Clone, Debug, Default, PartialEq)] pub struct SettingItem { + /// The setting's key. pub key: Arc, + /// What the setting is for. pub doc: Arc, /// JSON. pub value: Arc, @@ -885,55 +1148,80 @@ pub struct SettingItem { /// A recording or clip of the Stream Studio (Library). #[derive(Clone, Debug, Default, PartialEq)] pub struct RecordingItem { + /// The file's name. pub name: Arc, /// "12.3 MB · 3 Oct 18:04". pub detail: Arc, + /// A clip saved from the replay buffer; else a recording. pub clip: bool, + /// Where the file is. pub path: Arc, } /// Encoders, chat history, cache and logs (Advanced page); numbers as typed. #[derive(Clone, Debug, Default, PartialEq)] pub struct AdvancedForm { + /// `stream.encoder_backend`: auto, software or an encoder's name. pub encoder: Arc, + /// `stream.hardware_acceleration`: hardware encoders where available. pub hardware: bool, /// `stream.decoder_backend`, `stream.hardware_decoding`. pub decoder: Arc, + /// `stream.hardware_decoding`: hardware decoders where available. pub hardware_decoding: bool, + /// `chat.store_history`: keep the chat history on this device. pub store_history: bool, + /// `chat.history_page`: messages per page; 0: all at once. pub history_page: Arc, + /// `chat.dedupe_tolerance_ms`: how far apart two copies of a message may be and count as one. pub dedupe_ms: Arc, + /// `chat.retention_days`: delete stored messages older than this; 0: keep all. pub retention_days: Arc, + /// `cache.max_mb`: the picture cache's size in MiB; 0: no limit. pub cache_mb: Arc, + /// `cache.fetch_images`: download pictures of servers and chats. pub fetch_images: bool, + /// `files.progress_interval_ms`: how often a transfer reports; 0: continuously. pub progress_ms: Arc, /// `ui.image_preview_kb`. pub preview_kb: Arc, + /// A text on where the logs go and how to get more of them. pub logs: Arc, + /// The folder crash reports are kept in; empty if there is none. pub crash_dir: Arc, } /// A row or form of the bridge (the plain counterpart of the Slint struct `AccountForm`). #[derive(Clone, Debug, Default, PartialEq)] pub struct AccountForm { + /// The nickname the current server's bookmark connects with. pub nickname: Arc, + /// The name of the identity the server sees us as. pub identity: Arc, + /// Its unique id on TeamSpeak 3 servers. pub uid: Arc, + /// Its unique id on TeamSpeak 6 servers. pub uid6: Arc, + /// The security level of its key. pub level: i32, + /// The name of the current server. pub server: Arc, } /// One emoji of the picker. `text` is what picking it inserts. #[derive(Clone, Debug, Default, PartialEq)] pub struct EmojiCell { + /// The Twemoji key, "1f600". pub key: Arc, + /// The emoji's name. pub name: Arc, + /// What picking it inserts. pub text: Arc, } /// A row or form of the bridge (the plain counterpart of the Slint struct `EmojiRow`). #[derive(Clone, Debug, Default, PartialEq)] pub struct EmojiRow { + /// The emoji of the row. pub cells: Vec, } diff --git a/crates/voelin-ui-vm/src/lib.rs b/crates/voelin-ui-vm/src/lib.rs index 4068ae6..7f58439 100644 --- a/crates/voelin-ui-vm/src/lib.rs +++ b/crates/voelin-ui-vm/src/lib.rs @@ -3,11 +3,8 @@ //! Neither Slint nor GPUI is a dependency; each front end converts these //! types (docs/ui.md, "Two crates"). -// Every public item is documented, except the fields of the two mirror -// modules (`bridge`, `studio_bridge`): their 400 or so fields are those of -// the Slint structs and are explained by the comments in `bridge.slint` and -// `studio-bridge.slint`, which stay the one place to read them until the -// Slint front end goes. +// Every public item is documented, the 559 fields of the two mirror modules +// (`bridge`, `studio_bridge`) included. #![warn(missing_docs)] pub mod avatar; diff --git a/crates/voelin-ui-vm/src/studio_bridge.rs b/crates/voelin-ui-vm/src/studio_bridge.rs index 016bf5e..8acef1e 100644 --- a/crates/voelin-ui-vm/src/studio_bridge.rs +++ b/crates/voelin-ui-vm/src/studio_bridge.rs @@ -1,8 +1,6 @@ //! The Stream Studio's structs: the plain counterparts of //! `crates/voelin-ui/ui/studio-bridge.slint`, as [`crate::bridge`] has those of -//! `bridge.slint`. As there, the fields are not documented one by one: see the -//! comments in `studio-bridge.slint`. -#![allow(missing_docs)] +//! `bridge.slint`. As there, every field is documented. use std::sync::Arc; @@ -11,7 +9,9 @@ use crate::image::ImageRef; /// A scene of the studio. #[derive(Clone, Debug, Default, PartialEq)] pub struct StudioScene { + /// The scene's id. pub id: i32, + /// The scene's name. pub name: Arc, /// Its sources, front first: "Screen + Camera + Text". pub detail: Arc, @@ -24,11 +24,15 @@ pub struct StudioScene { /// A source of the live scene, front first. #[derive(Clone, Debug, Default, PartialEq)] pub struct StudioSource { + /// The source's id in its scene. pub id: i32, + /// The source's name. pub name: Arc, /// screen, window, portal, camera, image, text, colour, pattern pub kind: Arc, + /// It is shown in the output. pub visible: bool, + /// It cannot be moved, resized or cropped. pub locked: bool, /// keep, blur, image, colour pub background: Arc, @@ -38,18 +42,22 @@ pub struct StudioSource { pub info: Arc, /// At the front or the back (cannot move further). pub front: bool, + /// At the back; it cannot move further. pub back: bool, } /// An audio source of the stream (`stream.audio_sources`). #[derive(Clone, Debug, Default, PartialEq)] pub struct StudioAudio { + /// The source's name. pub name: Arc, /// "Elgato Wave:3", the application... pub detail: Arc, /// microphone, desktop, app, window, tone pub kind: Arc, + /// Its gain in dB. pub gain_db: f32, + /// It is muted in the mix. pub muted: bool, /// The meter in dBFS, after the gain. pub level: f32, @@ -62,6 +70,7 @@ pub struct StudioAudio { pub struct StudioLayer { /// "1280x720"; empty: `scale` of the output. pub size: Arc, + /// The factor on the output's size when `size` is empty. pub scale: Arc, /// Frame-rate cap; empty: the output's. pub fps: Arc, @@ -74,7 +83,9 @@ pub struct StudioLayer { /// A viewer of the studio's stream. #[derive(Clone, Debug, Default, PartialEq)] pub struct StudioViewer { + /// The viewer's client id. pub client: i32, + /// The viewer's name. pub name: Arc, /// requested, connecting, connected pub state: Arc, @@ -83,7 +94,9 @@ pub struct StudioViewer { /// An entry of a picker (screens, windows, cameras, audio sources). #[derive(Clone, Debug, Default, PartialEq)] pub struct StudioPick { + /// The entry's name. pub name: Arc, + /// The line under the name. pub detail: Arc, /// For the icon: monitor, window, portal, camera, microphone, desktop, app, tone pub kind: Arc, @@ -102,48 +115,70 @@ pub struct StudioStatus { pub destination: Arc, /// 0: not live, 1: poor, 2: fair, 3: good, 4: excellent. pub quality: i32, + /// The words for `quality`. pub quality_text: Arc, /// "1080p • 60 FPS • 8,250 kbps" pub format: Arc, /// The numbers behind it, for the info button. pub details: Arc, + /// The stream is live. pub live: bool, /// Going live: waiting for the server. pub starting: bool, /// "00:12:34" pub elapsed: Arc, + /// How many watch the stream. pub viewers: i32, + /// How many viewers the stream has, those who only asked included. pub participants: i32, + /// Go Live is possible. pub can_go_live: bool, /// Why Go Live is off, or what goes wrong. pub hint: Arc, + /// A recording runs. pub recording: bool, + /// How long the recording runs: "00:12:34". pub recorded: Arc, /// The replay buffer's window (0: off) and what it holds now. pub replay_seconds: i32, + /// What the replay buffer holds now: "30 s". pub replay_held: Arc, + /// The output's width in pixels. pub output_width: i32, + /// The output's height in pixels. pub output_height: i32, + /// The output's frame rate. pub fps: i32, + /// The studio is in a window of its own. pub detached: bool, /// A window of its own is possible (not on Android). pub can_detach: bool, /// The live scene shows a screen, a camera, a window (the phone's cards). pub screen_shown: bool, + /// The live scene shows a camera. pub camera_shown: bool, + /// The live scene shows a window. pub window_shown: bool, } /// The stream settings panel (`studio.stream`, `stream.bitrate_kbps`). #[derive(Clone, Debug, Default, PartialEq)] pub struct StudioForm { + /// Index into the destinations offered (channels to stream to); -1: none. pub destination: i32, + /// The stream's title. pub title: Arc, + /// Game or category: it follows the title in the stream's name. pub game: Arc, + /// Sent to the channel's chat when the stream goes live. pub message: Arc, + /// The viewers are an overlay in the live scene. pub show_viewers: bool, + /// The stream chat's last lines are an overlay. pub show_chat: bool, + /// The title and the game are an overlay. pub show_now_playing: bool, + /// The stream carries the mixer's sources; off: none. pub audio: bool, /// kbit/s of the stream without layers, as typed. pub bitrate: Arc, @@ -153,45 +188,69 @@ pub struct StudioForm { /// sources: `id` -1). Numbers as typed. #[derive(Clone, Debug, Default, PartialEq)] pub struct StudioSourceForm { + /// The source's id; -1: a new one. pub id: i32, + /// The source's name. pub name: Arc, + /// screen, window, portal, camera, image, text, colour or pattern. pub kind: Arc, + /// The left edge in output pixels. pub x: Arc, + /// The top edge in output pixels. pub y: Arc, /// Empty: the source's own size times `scale`. pub width: Arc, + /// As `width`, for the height. pub height: Arc, + /// The factor on the source's own size, where `width` or `height` is empty. pub scale: Arc, /// contain, cover, stretch pub fit: Arc, + /// Pixels cut off the source's left edge. pub crop_left: Arc, + /// Pixels cut off its top edge. pub crop_top: Arc, + /// Pixels cut off its right edge. pub crop_right: Arc, + /// Pixels cut off its bottom edge. pub crop_bottom: Arc, /// Percent. pub opacity: f32, + /// It cannot be moved, resized or cropped. pub locked: bool, + /// It is shown in the output. pub visible: bool, /// keep, blur, image, colour pub background: Arc, /// Blur radius in percent of the picture's height. pub blur: Arc, + /// The picture behind the source, for the background `image`. pub background_path: Arc, + /// The colour behind the source, for the background `colour`. pub background_colour: Arc, /// Text, colour ("#rrggbb" or "#rrggbbaa") and image sources. pub text: Arc, + /// The text's size in pixels. pub text_size: Arc, + /// The text's or the colour source's colour. pub colour: Arc, + /// The image source's file. pub path: Arc, + /// The camera picture is mirrored. pub mirror: bool, } /// The studio settings dialog (`studio.*` keys and the preview). #[derive(Clone, Debug, Default, PartialEq)] pub struct StudioSettingsForm { + /// Seconds the replay buffer keeps; 0: off. pub replay_seconds: Arc, + /// MiB of the replay buffer kept in memory. pub replay_memory: Arc, + /// The folder of recordings and clips; empty: the default. pub recording_dir: Arc, + /// The preview's width in pixels. pub preview_width: Arc, + /// The preview's frame rate. pub preview_fps: Arc, } diff --git a/docs/ui.md b/docs/ui.md index 0d0b77f..e5432b7 100644 --- a/docs/ui.md +++ b/docs/ui.md @@ -124,10 +124,11 @@ this file is `voelin_ui_vm::chat`. The boundary: structs with the field names of the Slint structs in `bridge.slint` and `studio-bridge.slint`; `MytsBadge` and `MytsForm`, which have no data source in this build, stay Slint-only. The crate warns about undocumented public - items (`#![warn(missing_docs)]`) and has none, but the two mirror modules - carry `#![allow(missing_docs)]`: their 349 fields (288 in `bridge.rs`, 61 in - `studio_bridge.rs`) are not documented one by one, the comments in the - `.slint` files are the place to read them until the Slint front end goes. + items (`#![warn(missing_docs)]`) and has none, the mirror modules' 559 + fields (460 in `bridge.rs`, 99 in `studio_bridge.rs`) included: 210 carry + the comments of the `.slint` files, and the other 349 (288 in `bridge.rs`, + 61 in `studio_bridge.rs`), which had none there, were described from the + code that fills them. No module is exempt from the lint. - **Lists.** `list::diff(old, new)` gives `Changes`: updates, removals and insertions by index, in the order to apply them. `bind/rows.rs` applies them to a `VecModel` and converts only the changed rows; a GPUI view