voelin-ui-vm: the server sequences both front ends ran twice are one
The GPUI shell repeated the Slint crate's connect, observe, gateway lookup, save and remove of a server, its default nickname, its FallbackSecrets and its settings opening and key registration. They now live once and both front ends call them: - voelin_ui_vm::servers::sequence: connect_voice(_to), observe, discover_gateway, gateway_found, select_server, save_bookmark, save_and_connect, delete_bookmark, bookmark_form and default_nickname, as transitions over the state, the Cx and a Backing (the store, the secrets, the identity a connection uses). The commands, the status line and what to keep go out through the Update as for every other transition; a new field, Update::discover, asks the front end to look a gateway up (the thread hop stays with each front end: Later in GPUI, later() in Slint). stream_peer is the one input a front end gives (Slint's codecs; GPUI passes none). - voelin_ui_vm::settings::open_settings and register_keys; a front end adds its own key (ui.window, studio.ui) through a function it passes, so Slint's settings page still lists what it listed. - voelin_store::FallbackSecrets (feature keyring) and Store::identity_for. - voelin-ui: the methods of servers/bind.rs, open_settings and default_secrets call them, so their call sites are unchanged; host.rs gets transition_with and the discover arm of perform. voelin-gpui: AppState's methods and the Backend call them. What cannot move is named in docs/ui.md. voelin-ui-vm now depends on tracing (the sequences log as the copies did): one line of Cargo.lock, THIRD_PARTY_NOTICES.md unchanged (scripts/notices.sh --check clean), cargo deny check clean. The sequences have ten tests over a fake front end (commands, status, store, secrets, gateways), open_settings and Store::identity_for one each; the GPUI and Slint suites pass unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
01bf128c58
commit
a77ccc0415
15 files changed
+1148
-578
No files matched your search
+49
-5
@@ -38,7 +38,10 @@ crates/voelin-ui-vm/ view models and state, no UI toolkit
|
||||
viewer's rows and texts
|
||||
servers/logic.rs which server is shown and how it is observed, joining a channel;
|
||||
the rail, the server card and the channel tree as plain data
|
||||
settings.rs the UI's settings keys, the audio form
|
||||
servers/sequence.rs what both front ends do for a server over the store, the secrets
|
||||
and the engine (connect, observe, the gateway lookup, save and
|
||||
remove a bookmark), as transitions over a `Backing`
|
||||
settings.rs the UI's settings keys, the audio form, `open_settings`
|
||||
settings_pages/logic.rs, studio/logic.rs
|
||||
the decisions of the settings pages and of the Stream Studio
|
||||
dev/logic.rs the sample data of `VOELIN_DEMO_UI` as plain values and events
|
||||
@@ -87,8 +90,9 @@ crates/voelin-ui/ the Slint front end
|
||||
the Slint side of each area (previews.rs: pictures in chat;
|
||||
popout.rs: the stream's own window)
|
||||
chat/ mod.rs, bind.rs: the chat view's Bridge writes and models
|
||||
servers/ mod.rs, bind.rs: connecting and observing (store, secrets, engine),
|
||||
the rail, the server card and the tree on the Bridge
|
||||
servers/ mod.rs, bind.rs: connecting and observing (the callbacks of
|
||||
`servers/sequence.rs`, the gateway lookup's thread hop), the rail,
|
||||
the server card and the tree on the Bridge
|
||||
social/ mod.rs (the models), bind.rs: contacts, the bell and the search on
|
||||
the Bridge, the desktop toasts, the navigation after a move
|
||||
settings_page/ mod.rs, bind.rs: the audio devices, the hotkey, the codec download,
|
||||
@@ -981,6 +985,7 @@ crates/voelin-gpui/
|
||||
app.rs AppState, the root Entity: the voelin-ui-vm state and Social, the
|
||||
backend, the three loops (events in batches, a quiet tick, Later)
|
||||
and the callbacks of the Slint `bind/servers.rs` that the shell has
|
||||
(over `voelin_ui_vm::servers::sequence`, which Slint calls too)
|
||||
view.rs MainView, the window's root view: the shell or the swatch, the
|
||||
handlers of the actions, the server form, the title, the window's place
|
||||
shell/ the desktop shell (below): rail.rs, sidebar.rs, topbar.rs,
|
||||
@@ -1193,8 +1198,10 @@ minimum size is 640 by 480.
|
||||
The eleven callbacks of `bind/servers.rs` that the shell has are GPUI actions
|
||||
(`shell/actions.rs`); a click dispatches one with `Window::dispatch_action`,
|
||||
`MainView` handles it, and the handler asks the root state for what the Slint
|
||||
callback did, through `voelin-ui-vm`'s `servers::logic` and the engine's
|
||||
commands:
|
||||
callback did, through `voelin-ui-vm`'s `servers::logic` and
|
||||
`servers::sequence`, the one sequence over the store, the secrets and the
|
||||
engine's commands that the Slint front end runs too ([Shared with the Slint
|
||||
front end](#shared-with-the-slint-front-end)):
|
||||
|
||||
| Slint callback | Action | What it does |
|
||||
|---|---|---|
|
||||
@@ -1216,6 +1223,43 @@ voice page), and `copied`, which the Slint toast of a copy needs and `Invite`
|
||||
does for itself. `AddServer`, `CancelServerForm`, `OpenSearch` and
|
||||
`OpenSettings` are the shell's own.
|
||||
|
||||
#### Shared with the Slint front end
|
||||
|
||||
What the Slint crate's `servers/bind.rs` and `app.rs` did and this front end
|
||||
repeated lives in one place and both call it (the Slint methods are thin
|
||||
wrappers, so its call sites are unchanged):
|
||||
|
||||
- **`voelin_ui_vm::servers::sequence`**: `connect_voice_to`, `connect_voice`,
|
||||
`observe`, `discover_gateway`, `gateway_found`, `select_server`,
|
||||
`save_bookmark`, `save_and_connect`, `delete_bookmark`, `bookmark_form` and
|
||||
`default_nickname`. Each is a transition over the state, the `Cx` and a
|
||||
`Backing` (the store, the secrets and the identity a connection is made
|
||||
with), so the engine's commands, the status line, what is to be kept and the
|
||||
gateways to look up (`Update::discover`) go out through the update, and
|
||||
each front end's `perform` and its tests handle them as they handle every
|
||||
other transition's (the GPUI tests see the commands as `take_sent`, and the
|
||||
sample servers' are dropped there). `transition_with` of each front end hands
|
||||
the `Backing` over: the GPUI root state's and the Slint `App`'s own fields.
|
||||
`stream_peer` is the one input a front end gives (the Slint one's
|
||||
`video.peer_config`; this one passes none).
|
||||
- **`voelin_ui_vm::settings::open_settings`** and `register_keys`: the settings
|
||||
service on `client.db` with the UI's keys, `config.toml`, `VOELIN_SETTING_*`
|
||||
and `--set`; each front end registers its own key (`ui.window` here, the
|
||||
Stream Studio's `studio.ui` there) through the function it passes.
|
||||
- **`voelin_store::FallbackSecrets`** (the keyring first, memory where it
|
||||
refuses) and **`Store::identity_for`** (the identity a bookmark names, else
|
||||
the default, else the one made at start).
|
||||
|
||||
Left as copies, because they need the toolkit, the runtime or a front end's own
|
||||
state: the thread hop of the gateway lookup (`look_up_gateway`: each front end
|
||||
runs `sequence::find_gateways` on the engine's runtime and comes back through
|
||||
its own `Later`/`later`), `perform` (what an `Update` does to a window), the
|
||||
status line's toast, the invite's clipboard write, `HostedEngine` (`engine.rs`),
|
||||
the guards of the GPUI shell's save (`save_refused`: the sample servers are not
|
||||
kept, and a server needs an address, which the Slint dialog checks in
|
||||
`dialogs.slint` before it calls), the store at start (`Backend::open` against `run()`: the identity import, the crash
|
||||
reports and `--set` of the Slint one) and the form widgets themselves.
|
||||
|
||||
**The store at start** (`backend.rs`) is `run()` of the Slint front end through
|
||||
`voelin-ui-vm`: the client's database at `<data dir>/client.db` (bookmarks,
|
||||
identities, chat read marks), the settings service on it with the UI's keys
|
||||
|
||||
Reference in new issue
Block a user