From 95d86af627f7a62b0e8da0532b57dd0bd769fcf3 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 7 Oct 2026 10:15:59 +0000 Subject: [PATCH] ui: one dialog to add a server, with Save and Connect Join a Server and Add a Server were the same dialog with other buttons, and Join saved the server in Slint and then connected the one shown: when saving failed, that was the server shown before. The dialog now has Cancel, Save and Connect (also Enter in the address or password field). Connect goes through Bridge.save-and-connect, which connects only the server it saved (vm::servers::connect_to); it is hidden while the server has voice, and Save is the main button then. On a phone Delete shows only its icon, so the four buttons fit. BookmarkForm carries a channel, its password and a privilege key for the links to come: the dialog shows "Joins " and "This link grants a server group", Connect connects into that channel, and connect_voice_to passes the key on. Nav.join-server is gone; the dev switch join opens the same dialog as bookmark. "Add server" reads "Add a server" everywhere. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ --- CHANGELOG.md | 3 + crates/voelin-ui/src/bind/servers.rs | 3 +- crates/voelin-ui/src/dev.rs | 12 +- crates/voelin-ui/src/servers.rs | 48 +++++--- crates/voelin-ui/src/vm/servers.rs | 122 ++++++++++++++++++++- crates/voelin-ui/ui/app.slint | 1 - crates/voelin-ui/ui/bridge.slint | 13 +++ crates/voelin-ui/ui/nav.slint | 12 +- crates/voelin-ui/ui/screens/channels.slint | 2 +- crates/voelin-ui/ui/screens/dialogs.slint | 99 +++++++++++++---- crates/voelin-ui/ui/screens/home.slint | 4 +- crates/voelin-ui/ui/screens/mobile.slint | 2 +- crates/voelin-ui/ui/shells/desktop.slint | 2 +- docs/ui.md | 22 +++- 14 files changed, 275 insertions(+), 70 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 647622a..06bbdd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -72,6 +72,9 @@ User-visible changes of the apps and the `tsgw` gateway. The format follows - Older chat messages load when scrolling up, above the messages on screen, which stay in place; the Older messages button remains for a chat that fits on the screen. +- One dialog adds a server, with Save and Connect (Enter connects); Home's + Join a Server opens it too. Connect connects only a server it saved (Join + connected the server shown before when saving failed). ### Fixed diff --git a/crates/voelin-ui/src/bind/servers.rs b/crates/voelin-ui/src/bind/servers.rs index 1096031..54e9558 100644 --- a/crates/voelin-ui/src/bind/servers.rs +++ b/crates/voelin-ui/src/bind/servers.rs @@ -47,8 +47,9 @@ pub(super) fn wire(ui: &MainWindow) { }); bridge.on_edit_bookmark(|id| with_app(|app| app.bookmark_form(id as i64)).unwrap_or_default()); bridge.on_save_bookmark(|form| { - with_app(|app| app.save_bookmark(form)); + with_app(|app| app.save_bookmark(&form)); }); + bridge.on_save_and_connect(|form| with_app(|app| app.save_and_connect(&form)).unwrap_or(false)); bridge.on_delete_bookmark(|id| { with_app(|app| app.delete_bookmark(id as i64)); }); diff --git a/crates/voelin-ui/src/dev.rs b/crates/voelin-ui/src/dev.rs index 76453a7..8d01b5c 100644 --- a/crates/voelin-ui/src/dev.rs +++ b/crates/voelin-ui/src/dev.rs @@ -14,7 +14,7 @@ //! - `VOELIN_OPEN=[,...]`: open screens on start: `home`, //! `server` (`server:chat`: its server chat), `settings[:
]` //! (voice, keybinds, streaming, privacy, appearance, or 0-4), `about`, -//! `share`, `bookmark` (add a server; +//! `share`, `bookmark` (add a server, also `join`; //! `bookmark:edit` the current one, Advanced open), //! `emoji` (the picker), `client` (the volume dialog of the first other //! client once connected), `panel` / `no-panel` (the members panel), @@ -38,9 +38,9 @@ //! `tab:` (phone layout); `friends[:]`, //! `messages[:]` (a private chat), `inbox` (offline messages), //! `library`, `events`, `event-form`, `search[:]`, -//! `notifications` (the bell), `join` (join by address), `offline` (an -//! offline message), `picture` (a chat picture opened large), `camera` -//! (the settings' camera preview); settings sections also `account`, +//! `notifications` (the bell), `offline` (an offline message), `picture` +//! (a chat picture opened large), `camera` (the settings' camera +//! preview); settings sections also `account`, //! `profiles` (also `identities`), `devices`, `notifications`, //! `integrations`, `advanced` (5-10); //! `studio[:]`: the Stream Studio (with `VOELIN_DEMO_UI` a demo @@ -245,7 +245,8 @@ pub(crate) fn start(ui: &MainWindow, switches: &Switches) -> Running { nav.invoke_edit_server(id as i32); } } - "bookmark" => nav.invoke_add_server(), + // `join`: the same dialog (Join a server was one of its own). + "bookmark" | "join" => nav.invoke_add_server(), "emoji" => nav.set_emoji_open(true), "panel" => nav.set_right_panel_open(true), "no-panel" => nav.set_right_panel_open(false), @@ -327,7 +328,6 @@ pub(crate) fn start(ui: &MainWindow, switches: &Switches) -> Running { "event-form" => nav.invoke_create_event(), "search" => nav.invoke_open_search(arg.into()), "notifications" => nav.set_notifications_open(true), - "join" => nav.invoke_join_server(), "offline" => nav.invoke_write_offline("demo-ari".into(), "Ari".into()), "picture" => { let picture = demo_picture(1280, 720, 16); diff --git a/crates/voelin-ui/src/servers.rs b/crates/voelin-ui/src/servers.rs index 95175cb..11fc3a8 100644 --- a/crates/voelin-ui/src/servers.rs +++ b/crates/voelin-ui/src/servers.rs @@ -1,7 +1,7 @@ //! Servers: bookmarks, connecting and observing, the rail, the sidebar's //! server card and the channel tree. -use slint::{ComponentHandle, SharedString}; +use slint::ComponentHandle; use tracing::{info, warn}; use voelin_core::identity::LaunchImport; use voelin_core::{Command, JoinFailure, ObserveState, Source, VoiceOptions, VoiceState}; @@ -86,15 +86,17 @@ impl App { pub(crate) fn connect_voice(&mut self) { let channel = self.current.and_then(|id| self.bookmark(id)).and_then(|b| b.default_channel.clone()); - self.connect_voice_to(channel, None); + self.connect_voice_to(channel, None, None); } /// Connect the current server with voice, into `channel` (a path, or - /// `/`, with its password) if given; whether it was asked for. + /// `/`, with its password) if given, with a privilege key if given; + /// whether it was asked for. pub(crate) fn connect_voice_to( &mut self, channel: Option, channel_password: Option, + token: Option, ) -> bool { let Some(b) = self.current.and_then(|id| self.bookmark(id)).cloned() else { return false }; if self.demo_ui { @@ -114,6 +116,7 @@ impl App { options.server_password = self.secrets.get(&b.server_password_key()).ok().flatten(); options.channel = channel; options.channel_password = channel_password; + options.token = token; options.audio = true; options.stream_peer = self.video.peer_config(options.stream_peer); self.engine @@ -269,22 +272,16 @@ impl App { ..Default::default() }; }; - let secret = |key: String| -> SharedString { - self.secrets.get(&key).ok().flatten().unwrap_or_default().into() - }; - BookmarkForm { - id: b.id as i32, - // Named by its address: empty, so a new address names it again. - name: if b.name == b.address { SharedString::new() } else { b.name.clone().into() }, - address: b.address.clone().into(), - nickname: b.nickname.clone().into(), - server_password: secret(b.server_password_key()), - } + let password = self.secrets.get(&b.server_password_key()).ok().flatten(); + let state = self.sessions.get(&b.id).map(|view| &view.state); + vm::servers::form(b, state, password.as_deref().unwrap_or_default()) } - pub(crate) fn save_bookmark(&mut self, form: BookmarkForm) { + /// Save the server dialog's server, and show it; its id, none when it + /// could not be saved (the toast says why). + pub(crate) fn save_bookmark(&mut self, form: &BookmarkForm) -> Option { let old = self.bookmark(form.id as i64).cloned(); - let mut bookmark = bookmark_from_form(old.as_ref(), &form, || self.default_nickname()); + let mut bookmark = bookmark_from_form(old.as_ref(), form, || self.default_nickname()); let result = if bookmark.id < 0 { self.store.add_bookmark(&bookmark).map(|id| bookmark.id = id) } else { @@ -292,7 +289,7 @@ impl App { }; if let Err(e) = result { self.set_status(format!("Could not save: {e}")); - return; + return None; } let key = bookmark.server_password_key(); let result = if form.server_password.is_empty() { @@ -317,6 +314,21 @@ impl App { } self.bookmarks = self.store.bookmarks().unwrap_or_default(); self.select_server(bookmark.id); + Some(bookmark.id) + } + + /// The server dialog's Connect: save the server, then connect it with + /// voice, into the channel of the link that filled the form if one did + /// ([`vm::servers::connect_to`]). Only once saved: connecting what is + /// shown after a failed save would connect the server shown before. + /// Whether it was saved. + pub(crate) fn save_and_connect(&mut self, form: &BookmarkForm) -> bool { + let saved = self.save_bookmark(form); + let Some(to) = vm::servers::connect_to(form, saved.and_then(|id| self.bookmark(id))) else { + return false; + }; + self.connect_voice_to(to.channel, to.channel_password, to.token); + true } pub(crate) fn delete_bookmark(&mut self, id: i64) { @@ -589,7 +601,7 @@ impl App { } // By id: by its name the server finds only a top-level channel (a // subchannel's name connects into the default channel). - if self.connect_voice_to(Some(format!("/{channel}")), password) + if self.connect_voice_to(Some(format!("/{channel}")), password, None) && let Some(view) = self.sessions.get_mut(&session) { view.join_after_connect = Some(channel); diff --git a/crates/voelin-ui/src/vm/servers.rs b/crates/voelin-ui/src/vm/servers.rs index 903e852..fd08fac 100644 --- a/crates/voelin-ui/src/vm/servers.rs +++ b/crates/voelin-ui/src/vm/servers.rs @@ -1,10 +1,11 @@ -//! The server rail, and joining a channel. +//! The server rail, the server dialog, and joining a channel. +use slint::SharedString; use voelin_core::{ObserveState, SessionState, VoiceState}; use voelin_model::{ChannelId, ChannelInfo}; use voelin_store::Bookmark; -use crate::app::ServerItem; +use crate::app::{BookmarkForm, ServerItem}; use crate::vm::avatar; /// Restore a known server icon before any session exists. A missing/evicted @@ -54,6 +55,54 @@ pub fn item( } } +/// The server dialog's form for `bookmark`, with its stored password: +/// `connected` while `state` has voice, which hides Connect. A server still +/// named by its address shows no name, so a new address names it again. +pub fn form( + bookmark: &Bookmark, + state: Option<&SessionState>, + server_password: &str, +) -> BookmarkForm { + BookmarkForm { + id: bookmark.id as i32, + name: if bookmark.name == bookmark.address { + SharedString::new() + } else { + bookmark.name.clone().into() + }, + address: bookmark.address.clone().into(), + nickname: bookmark.nickname.clone().into(), + server_password: server_password.into(), + connected: state.is_some_and(|s| s.voice == VoiceState::Connected), + ..Default::default() + } +} + +/// Where the server dialog's Connect goes ([`connect_to`]). +#[derive(Clone, Debug, Default, PartialEq, Eq)] +pub struct ConnectTo { + /// A channel path, or `/`. + pub channel: Option, + pub channel_password: Option, + /// A privilege key. + pub token: Option, +} + +/// What the server dialog's Connect connects with, once the form was saved +/// as `saved` (none: saving failed, and nothing connects): the form's +/// channel (a link's) with its password, else the server's default +/// channel; and the link's privilege key. +pub fn connect_to(form: &BookmarkForm, saved: Option<&Bookmark>) -> Option { + let saved = saved?; + let given = |text: &SharedString| Some(text.to_string()).filter(|t| !t.is_empty()); + let channel = given(&form.channel); + Some(ConnectTo { + channel_password: channel.as_ref().and_then(|_| given(&form.channel_password)), + channel: channel.or_else(|| saved.default_channel.clone()), + token: given(&form.token), + }) +} + /// A `ts3server://` link that joins the channel at `path` (its names from /// the top) on the server at `address` (`host`, `host:port` or /// `[v6]:port`), as TeamSpeak clients open them. @@ -179,6 +228,75 @@ mod tests { std::fs::remove_dir_all(dir).unwrap(); } + #[test] + fn connect_shows_only_without_voice() { + let b = Bookmark { + id: 3, + name: "ts.example.test".into(), + address: "ts.example.test".into(), + nickname: "Nova".into(), + ..Default::default() + }; + let mut state = SessionState::default(); + let f = form(&b, None, "pw"); + assert_eq!((f.id, f.name.as_str(), f.address.as_str()), (3, "", "ts.example.test")); + assert_eq!((f.nickname.as_str(), f.server_password.as_str()), ("Nova", "pw")); + assert!(!f.connected); + for (voice, connected) in [ + (VoiceState::Disconnected, false), + // Connect again with another address. + (VoiceState::Connecting, false), + (VoiceState::Connected, true), + ] { + state.voice = voice; + assert_eq!(form(&b, Some(&state), "").connected, connected, "{voice:?}"); + } + // Observing is not voice. + state.voice = VoiceState::Disconnected; + state.observe = ObserveState::Observing; + assert!(!form(&b, Some(&state), "").connected); + let named = Bookmark { name: "Nightfall".into(), ..b }; + assert_eq!(form(&named, None, "").name.as_str(), "Nightfall"); + } + + #[test] + fn connect_only_what_was_saved() { + let saved = Bookmark { id: 3, default_channel: Some("Lobby".into()), ..Default::default() }; + let plain = BookmarkForm { address: "ts.example.test".into(), ..Default::default() }; + // Saving failed: nothing connects (not the server shown before). + assert_eq!(connect_to(&plain, None), None); + assert_eq!( + connect_to(&plain, Some(&saved)), + Some(ConnectTo { channel: Some("Lobby".into()), ..Default::default() }) + ); + // A link's channel, its password and privilege key. + let link = BookmarkForm { + channel: "Gaming/Raid Night".into(), + channel_password: "raid".into(), + token: "key".into(), + ..plain.clone() + }; + assert_eq!(connect_to(&link, None), None); + assert_eq!( + connect_to(&link, Some(&saved)), + Some(ConnectTo { + channel: Some("Gaming/Raid Night".into()), + channel_password: Some("raid".into()), + token: Some("key".into()), + }) + ); + // A password goes only with the link's channel. + let token = BookmarkForm { channel_password: "raid".into(), token: "key".into(), ..plain }; + assert_eq!( + connect_to(&token, Some(&saved)), + Some(ConnectTo { + channel: Some("Lobby".into()), + channel_password: None, + token: Some("key".into()), + }) + ); + } + #[test] fn invite_links() { assert_eq!( diff --git a/crates/voelin-ui/ui/app.slint b/crates/voelin-ui/ui/app.slint index 70d51ef..71e5db4 100644 --- a/crates/voelin-ui/ui/app.slint +++ b/crates/voelin-ui/ui/app.slint @@ -394,7 +394,6 @@ export component MainWindow inherits Window { if !Bridge.myts.prompt && (Nav.bookmark-open): BookmarkDialog { form <=> Nav.bookmark-form; - join: Nav.join-open; done => { Nav.bookmark-open = false; } } diff --git a/crates/voelin-ui/ui/bridge.slint b/crates/voelin-ui/ui/bridge.slint index 5f96516..bf75d4d 100644 --- a/crates/voelin-ui/ui/bridge.slint +++ b/crates/voelin-ui/ui/bridge.slint @@ -287,12 +287,21 @@ export struct TopicItem { archived: bool, } +// The server dialog: a bookmark (id -1: a new one) and, from a link, where +// Connect goes. export struct BookmarkForm { id: int, name: string, address: string, nickname: string, server-password: string, + // The server has voice: no Connect. + connected: bool, + // From a link, not stored with the server: the channel to join (a + // path, or /), its password and a privilege key. + channel: string, + channel-password: string, + token: string, } // A stream on the server, ours first: a stream can be watched from any @@ -1058,6 +1067,10 @@ export global Bridge { callback push-to-talk(bool); callback edit-bookmark(int) -> BookmarkForm; callback save-bookmark(BookmarkForm); + // The server dialog's Connect: save, then connect with voice (into the + // form's channel, if any); false when saving failed, and nothing + // connects. + callback save-and-connect(BookmarkForm) -> bool; callback delete-bookmark(int); callback open-share() -> ShareForm; diff --git a/crates/voelin-ui/ui/nav.slint b/crates/voelin-ui/ui/nav.slint index b82c7ab..630b413 100644 --- a/crates/voelin-ui/ui/nav.slint +++ b/crates/voelin-ui/ui/nav.slint @@ -102,8 +102,7 @@ export global Nav { // The bell's panel, the search (Ctrl+K) and its selected result, a // picture opened from the chat, the event and offline message forms, - // the friends page's tab, the direct messages' tab, the add-server - // dialog in "join" mode (connect once saved). + // the friends page's tab, the direct messages' tab. in-out property notifications-open; in-out property search-open; in-out property search-text; @@ -117,7 +116,6 @@ export global Nav { in-out property offline-form; in-out property friends-tab; in-out property dm-tab; - in-out property join-open; // Text for the clipboard, and a counter that changes with every copy: // MainWindow copies it through a hidden text field (`copy` below). @@ -232,12 +230,6 @@ export global Nav { offline-form-open = true; } - public function join-server() { - bookmark-form = Bridge.edit-bookmark(-1); - join-open = true; - bookmark-open = true; - } - // The members panel of the current server. public function show-members() { show(Page.server); @@ -262,13 +254,11 @@ export global Nav { public function add-server() { bookmark-form = Bridge.edit-bookmark(-1); - join-open = false; bookmark-open = true; } public function edit-server(id: int) { bookmark-form = Bridge.edit-bookmark(id); - join-open = false; bookmark-open = true; } diff --git a/crates/voelin-ui/ui/screens/channels.slint b/crates/voelin-ui/ui/screens/channels.slint index c53e189..242dfef 100644 --- a/crates/voelin-ui/ui/screens/channels.slint +++ b/crates/voelin-ui/ui/screens/channels.slint @@ -83,7 +83,7 @@ export component ServerHeader inherits Rectangle { menu := PopupMenu { entries: [ { text: @tr("Edit server"), icon: Icons.pencil, enabled: Bridge.current-server >= 0 }, - { text: @tr("Add server"), icon: Icons.plus, enabled: true, separator: true }, + { text: @tr("Add a server"), icon: Icons.plus, enabled: true, separator: true }, ]; activated(i) => { if i == 0 { diff --git a/crates/voelin-ui/ui/screens/dialogs.slint b/crates/voelin-ui/ui/screens/dialogs.slint index ac07342..3521d95 100644 --- a/crates/voelin-ui/ui/screens/dialogs.slint +++ b/crates/voelin-ui/ui/screens/dialogs.slint @@ -17,24 +17,53 @@ component Footer inherits HorizontalLayout { } // Add or edit a server: its address and, if it has one, its password; the -// rest under Advanced (name, nickname, gateway, ServerQuery), which Voelin -// fills in itself when left empty. +// rest under Advanced (name, nickname), which Voelin fills in itself when +// left empty. Save keeps it; Connect keeps it and connects, into the channel +// of the link that opened the dialog if one did. export component BookmarkDialog inherits Modal { in-out property form; - // Join by address: connect once saved. - in property join; callback done(); // The fields beyond address and password: shown when editing. property advanced: form.id >= 0; - title: join ? @tr("Join a server") : form.id < 0 ? @tr("Add server") : @tr("Edit server"); + title: form.id < 0 ? @tr("Add a server") : @tr("Edit server"); // The rest includes the gateway (presence and chat without joining), // found from the address: DNS SRV records, else its well-known URL. subtitle: @tr("Only the address is needed; Voelin finds the rest."); icon: Icons.server; card-width: 560px; - // Fits the address and password (two lines more on a phone). - card-height: advanced ? 500px : Nav.narrow ? 360px : 330px; + // Fits the address and password (two lines more on a phone), and a + // link's channel and privilege key. + card-height: (advanced ? 500px : Nav.narrow ? 360px : 330px) + + (form.channel != "" ? 48px : 0px) + (form.token != "" ? 48px : 0px); dismissed => { done(); } + + function save() { + if form.address != "" { + Bridge.save-bookmark(form); + done(); + } + } + + // Nothing connects unless the server was saved (a failure is told in + // the toast once the dialog is gone). + function connect() { + if form.address != "" { + if Bridge.save-and-connect(form) { + Nav.show(Page.server); + } + done(); + } + } + + // Enter: Connect, or Save while the server has voice. + function submit() { + if form.connected { + save(); + } else { + connect(); + } + } + ScrollView { vertical-stretch: 1; VerticalLayout { @@ -44,11 +73,34 @@ export component BookmarkDialog inherits Modal { Field { label: @tr("Address"); hint: @tr("Host name, IP address or server nickname; a port only if the server needs one."); - TextField { text <=> form.address; placeholder: "ts.example.org"; label: @tr("Address"); icon: Icons.globe; } + TextField { + text <=> form.address; + placeholder: "ts.example.org"; + label: @tr("Address"); + icon: Icons.globe; + accepted => { root.submit(); } + } } Field { label: @tr("Server password (optional)"); - TextField { text <=> form.server-password; input-type: InputType.password; label: @tr("Server password"); icon: Icons.lock; } + TextField { + text <=> form.server-password; + input-type: InputType.password; + label: @tr("Server password"); + icon: Icons.lock; + accepted => { root.submit(); } + } + } + // A link's: where Connect goes, and what it brings. + if form.channel != "": Banner { + icon: Icons.channel; + tone: Theme.info; + text: @tr("Joins {}", form.channel); + } + if form.token != "": Banner { + icon: Icons.key-round; + tone: Theme.info; + text: @tr("This link grants a server group"); } HorizontalLayout { spacing: Theme.space-3; @@ -83,11 +135,16 @@ export component BookmarkDialog inherits Modal { } } } - Footer { + // Not a Footer: its `alignment: end` gives the spacer no width, which + // put Delete right next to Cancel. + HorizontalLayout { + spacing: Theme.space-3; if form.id >= 0: Button { kind: ButtonKind.danger; icon: Icons.trash-2; - text: @tr("Delete"); + // Only the icon on a phone, where four buttons do not fit. + text: Nav.narrow ? "" : @tr("Delete"); + accessible-label: @tr("Delete"); clicked => { Bridge.delete-bookmark(form.id); done(); @@ -98,18 +155,18 @@ export component BookmarkDialog inherits Modal { text: @tr("Cancel"); clicked => { done(); } } + // The main action while the server has voice (no Connect then). Button { - kind: ButtonKind.primary; - text: root.join ? @tr("Join") : form.id < 0 ? @tr("Add") : @tr("Save"); + kind: form.connected ? ButtonKind.primary : ButtonKind.secondary; + text: @tr("Save"); enabled: form.address != ""; - clicked => { - Bridge.save-bookmark(form); - if root.join { - Bridge.connect-voice(); - Nav.show(Page.server); - } - done(); - } + clicked => { root.save(); } + } + if !form.connected: Button { + kind: ButtonKind.primary; + text: @tr("Connect"); + enabled: form.address != ""; + clicked => { root.connect(); } } } } diff --git a/crates/voelin-ui/ui/screens/home.slint b/crates/voelin-ui/ui/screens/home.slint index cbe07dc..e947980 100644 --- a/crates/voelin-ui/ui/screens/home.slint +++ b/crates/voelin-ui/ui/screens/home.slint @@ -168,7 +168,7 @@ export component HomeNav inherits VerticalLayout { QuickNav { icon: Icons.log-in; text: @tr("Join a Server"); - clicked => { Nav.join-server(); } + clicked => { Nav.add-server(); } } QuickNav { icon: Icons.user-plus; @@ -1279,7 +1279,7 @@ export component HomeAside inherits Rectangle { icon: Icons.log-in; title: @tr("Join a Server"); subtitle: @tr("Enter an address"); - clicked => { Nav.join-server(); } + clicked => { Nav.add-server(); } } QuickAction { icon: Icons.bookmark; diff --git a/crates/voelin-ui/ui/screens/mobile.slint b/crates/voelin-ui/ui/screens/mobile.slint index 087e8b4..dedb282 100644 --- a/crates/voelin-ui/ui/screens/mobile.slint +++ b/crates/voelin-ui/ui/screens/mobile.slint @@ -60,7 +60,7 @@ export component MobileServers inherits VerticalLayout { } IconButton { icon: Icons.plus; - label: @tr("Add server"); + label: @tr("Add a server"); round: true; filled: true; size: 46px; diff --git a/crates/voelin-ui/ui/shells/desktop.slint b/crates/voelin-ui/ui/shells/desktop.slint index 1c9cba1..cc38fd6 100644 --- a/crates/voelin-ui/ui/shells/desktop.slint +++ b/crates/voelin-ui/ui/shells/desktop.slint @@ -139,7 +139,7 @@ export component ServerRail inherits Rectangle { padding-top: Theme.space-2; IconButton { icon: Icons.plus; - label: @tr("Add server"); + label: @tr("Add a server"); round: true; filled: true; size: 46px; diff --git a/docs/ui.md b/docs/ui.md index b3d27ae..04e9b41 100644 --- a/docs/ui.md +++ b/docs/ui.md @@ -174,7 +174,7 @@ where a server has it. | Part | `VOELIN_OPEN` | What it shows | Engine data | |---|---|---|---| -| Home | `home` | A banner with Voelin and a slide per server (connect, open); friends online (as many whole bubbles as fit, Find Friends after them); live streams on our servers (any channel, the gateways' directories, clients flagged streaming) with viewers, server, channel and kind; our servers with who is there and Join or Open; the latest chats of every server. At the right what friends do, quick actions (find friends, join by address, add a server) and what is happening (gateway events and scheduled streams, soonest first, then server news). The phone has the messages, servers, live streams and recent activity in one column | `FriendPresence`, `ContactsChanged`, `StreamsChanged`, `Gateway` (stream directory, events), `Presence` (the servers' welcome and host messages), `History::recent_chats` | +| Home | `home` | A banner with Voelin and a slide per server (connect, open); friends online (as many whole bubbles as fit, Find Friends after them); live streams on our servers (any channel, the gateways' directories, clients flagged streaming) with viewers, server, channel and kind; our servers with who is there and Join or Open; the latest chats of every server. At the right what friends do, quick actions (find friends, and join or add a server: both open the add-server dialog) and what is happening (gateway events and scheduled streams, soonest first, then server news). The phone has the messages, servers, live streams and recent activity in one column | `FriendPresence`, `ContactsChanged`, `StreamsChanged`, `Gateway` (stream directory, events), `Presence` (the servers' welcome and host messages), `History::recent_chats` | | Library | `library` | The Stream Studio's recordings and clips (the files in `studio.recording_dir`, newest first) with Play and Open Folder | the folder | | Friends | `friends[:]` | Online, All and Blocked tabs, a search; each contact with where they are (server, channel, away, live), message, poke, join, watch. The selected one at the right: relation, where, a note, our volume and mute for them, friend, block, forget | `ContactsChanged`, `FriendPresence`; `Command::SetContact`, `RemoveContact`, `Poke`, `MoveToChannel` | | Direct messages | `messages[:]`, `inbox`, `offline` | The private chats of every server and of the store (peers by unique id) with the last message and unread counts, All, Unread and Inbox (offline messages); the conversation with the chat's message list, pokes among the messages, pictures and files, a composer, and a clear state when the peer cannot be reached (an offline message instead, where the server keeps them); the peer at the right: relation, note, the servers they are on, shared pictures and files, our volume for them | `ChatHistory` (`ChatTarget::Private` by unique id), `Command::LoadOlderHistory`, `Poke`, offline messages (`ListOfflineMessages`, `GetOfflineMessage`, `SendOfflineMessage`, `DeleteOfflineMessage`, `SetOfflineMessageRead`) | @@ -182,7 +182,7 @@ where a server has it. | Search | `search[:]` | Ctrl+K: servers, channels of every server, people (on the servers and the contacts) and the settings pages; arrows choose, Enter opens | the sessions, contacts, bookmarks | | Events | `events`, `event-form` | Above the channel tree (gateway `events`): a server's events with date, time, channel, scheduled stream, Going, Maybe and Not going with counts, who answered, reminders, Watch while live; create, edit and delete. Members (above the tree too) opens the members panel | `Gateway` events; `GatewayRequest::Events`, `CreateEvent`, `UpdateEvent`, `DeleteEvent`, `Rsvp` | | Pictures in chat | `picture` | A linked png, jpg, gif or webp up to `ui.image_preview_kb` is downloaded into memory, decoded once into the image cache and shown as a card in the message; a click opens it larger. A picture on the web a message shows (`[img]`) comes into the engine's picture cache like banners, up to the same size and only with `cache.fetch_images`; until then, or without it, the message shows its address as a link | `Command::DownloadChatFile` with `DownloadTo::Memory`, `Transfer`; `Command::FetchPicture`, `PictureReady` | -| Join by address | `join` | The add-server dialog that connects once saved | `Command::ConnectVoice` | +| Join by address | `join` (the same as `bookmark`) | The add-server dialog (Adding a server, below): Connect saves the server, then connects | `Command::ConnectVoice` | Settings sections (`settings:
`): @@ -305,9 +305,20 @@ There are no gateway or ServerQuery fields: the gateway is looked up from the address (DNS SRV records, else the gateway's `/.well-known/tsgw`) when the server is saved, selected or connected ([gateway-admin.md](gateway-admin.md#letting-voelin-find-the-gateway)), one -found is stored, and a new address looks again. `bookmark` and +found is stored, and a new address looks again. `bookmark` (or `join`) and `bookmark:edit` open it (below). +Its footer has Delete at the left (when editing; only the icon on a phone), +then Cancel, Save and Connect. Save keeps the server. Connect, also Enter in +the address or password field, keeps it, connects it with voice and shows it +(`Bridge.save-and-connect`, `App::save_and_connect`): nothing connects when +saving failed. While the server has voice, Connect is hidden and Save is the +main button. Home's Join a Server and Add a Server both open this dialog. The +form also carries a channel, its password and a privilege key for TeamSpeak +links, which are not stored with the server: with a channel the dialog shows +"Joins " and Connect connects into it; with a key it shows "This +link grants a server group". + Selecting a server observes it invisibly through its gateway (or a query login an older version stored), so its channels, members and chats show without joining; there is no Observe button. Without a gateway, observing @@ -440,8 +451,9 @@ Environment variables (see `src/dev.rs`): (the server page, above), `tab:` (phone layout); `friends[:]`, `messages[:]`, `inbox`, `offline`, `library`, `events`, `event-form`, `search[:]`, `notifications`, - `join`, `picture`, `camera` (the settings' camera preview, the test - pattern) and the settings sections `account`, `profiles`, `devices`, + `join` (the same as `bookmark`), `picture`, `camera` (the settings' + camera preview, the test pattern) and the settings sections `account`, + `profiles`, `devices`, `notifications`, `integrations`, `advanced` (above). With sample data, `watch` plays the local test pattern in the sample stream's place. `studio[:window|live|record|source|audio|camera|scene|settings]` opens the Stream Studio (above) in that state; with its window open a