diff --git a/CHANGELOG.md b/CHANGELOG.md index d2c4a80..a0735c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,11 +69,13 @@ User-visible changes of the apps and the `tsgw` gateway. The format follows ### Changed -- The view models, the app's state and the decisions of the settings pages and - of the Stream Studio moved out of `voelin-ui` into a new crate, - `voelin-ui-vm`, which depends on no UI toolkit (a second front end can use - it); `voelin-ui` converts its plain rows into Slint's and keeps the window, - the Bridge writes and the engine's tasks. The chat formatting reader and the +- The view models, the app's state, the state change of every engine event and + the decisions of the settings pages, the Stream Studio, the streams, the chat, + the servers, the audio settings page, the friends and the development + switches moved out of `voelin-ui` into a new crate, `voelin-ui-vm`, which + depends on no UI toolkit (a second front end can use it); `voelin-ui` + converts its plain rows into Slint's and keeps the window, the Bridge writes + and the engine's tasks. The chat formatting reader and the Twemoji archive moved with them. Nothing changes on screen. See docs/ui.md, "Two crates". - The identity store keeps identities of more than one kind (TeamSpeak, a Voelin diff --git a/docs/ui.md b/docs/ui.md index 5279f28..650d7da 100644 --- a/docs/ui.md +++ b/docs/ui.md @@ -123,7 +123,11 @@ this file is `voelin_ui_vm::chat`. The boundary: `bridge.rs`, 10 in `studio_bridge.rs`) are plain `Clone + PartialEq + Debug` 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. + 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. - **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 @@ -174,46 +178,69 @@ no display); the Slint crate's tests are what needs the window types. ### Controllers still to split +Plan section 6 step 2 (the toolkit-free `voelin-ui-vm` crate) is done: the +view models, the state, the state transition of every engine event and the +decisions of every area controller that interleaved them with Bridge writes +are in `voelin-ui-vm`, and the Slint crate keeps the writes. What is left +for step 3 (the GPUI front end) is the list at the end of this section. + The measure is the number of `.set_` calls in the file (`grep -c '\.set_'`): every setter counts, those of the Bridge, `Nav`, the window, models and the engine, and the status line's `self.set_status(…)`, which writes the Bridge's -status text too. In the seven largest files (230 calls) 150 are direct -`bridge.set_…` writes and 37 go through the status line, so Bridge writes -are about four fifths of those files and direct ones about two thirds; the -rest are `Nav`, window and engine setters (in `dev.rs` mostly those). The -numbers are those of the files as they stand. Each controller is a slice of -the same shape as `settings_pages` and `studio`: move the decisions into -`voelin-ui-vm/src//logic.rs`, keep the writes in -`voelin-ui/src//bind.rs`. +status text too. In the seven largest files before this round's splits +(230 calls: `streams.rs`, `chat.rs`, `app.rs`, `servers.rs`, `settings_page.rs`, +`social.rs` and `dev.rs`) 150 are direct writes to the Bridge (140 written as +`bridge.set_…`, ten as `ui.global::().set_…` or a chained setter) and +37 go through the status line, so Bridge writes are about four fifths of those +files and direct ones about two thirds; the rest are `Nav`, window and engine +setters (in `dev.rs` mostly those). Each controller was a slice of the same +shape as `settings_pages` and `studio`: the decisions moved into +`voelin-ui-vm/src//logic.rs`, the writes stayed in +`voelin-ui/src//bind.rs`. The `.set_` calls of each file before and +after, every number counted with that command: + +| Area | Before | After | +|---|---|---| +| Stream Studio | `studio.rs` 64 (62 once the view models had moved) | `studio/bind.rs` 58 | +| Settings pages | `settings_pages.rs` 52 | `settings_pages/bind.rs` 51 | +| Streams | `streams.rs` 45 | `streams/bind.rs` 38 | +| Chat | `chat.rs` 38 | `chat/bind.rs` 31 | +| Servers | `servers.rs` 37 | `servers/bind.rs` 31 | +| Audio settings page | `settings_page.rs` 26 | `settings_page/bind.rs` 26 | +| Friends, the bell, search | `social.rs` 23 | `social/bind.rs` 5 and `social/mod.rs` 15 (the models handed to the Bridge once) | +| Development switches | `dev.rs` 23 | `dev/bind.rs` 21 | +| Event dispatch and setup | `app.rs` 38 | `app.rs` 31 and `host.rs` 8 (carrying out an `Update`) | + +The Bridge and model writes stay where the toolkit is, and what each write +says now comes from `logic.rs`, which has tests of its own. + +Why the studio went before `streams.rs`: it had the most calls, and it is +self-contained. It has its own state (`StudioState`), windows and bridge +(`studio-bridge.slint`), so its decisions moved without touching the event +dispatch of `app.rs`. `streams.rs`, `chat.rs` and the rest of the list were +driven by that dispatch (the watch, share and history events), so they +followed it: the state transition of every engine event came first +(`events::apply`), then the controllers that show the result, `streams` first +as the one whose events were still the front end's. + +Still to split before or while the GPUI front end is written (the files as they +stand): | File | `.set_` calls | What it mixes | |---|---|---| -| `app.rs` | 31 | setup, the status line, the toolbar and tree refreshes (the event dispatch is `vm::events::apply`) | +| `app.rs` | 31 | setup, the status line, the toolbar and tree refreshes, `setting_changed` (which setting touches what); the event dispatch itself is `vm::events::handle` and `events::apply` | | `images.rs` | 13 | the decoded-picture cache | | `messages.rs` | 12 | direct messages | | `appearance.rs` | 11 | theme, font scale and breakpoints | | `popout.rs` | 8 | the viewer's own window | | `members.rs`, `links.rs`, `inbox.rs`, `home.rs`, `events.rs` | 6, 5, 5, 5, 4 | small; split with their neighbours | -Before the work on `voelin-ui-vm` began, `studio.rs` had 64 `.set_` calls -and `settings_pages.rs` 52 (the two with the most, then `streams.rs` with 45; -62 was `studio.rs` once the view models had moved, two setters having -gone with them). Their `bind.rs` files still show 58 and 51 (and -`streams/bind.rs`, split from the 45 of `streams.rs`, 38, and -`chat/bind.rs`, from the 38 of `chat.rs`, 31, and `servers/bind.rs`, from -the 32 of `servers.rs`, 31, and `settings_page/bind.rs`, from the 26 of -`settings_page.rs`, 26): the Bridge and -model writes stay where the toolkit is, and what each write says now comes -from `logic.rs`, which has tests of its own. - -Why the studio went before `streams.rs`: it had the most calls, and it is -self-contained. It has its own state (`StudioState`), windows and bridge -(`studio-bridge.slint`), so its decisions moved without touching the event -dispatch of `app.rs`. `streams.rs`, `chat.rs` and the rest of the list are -driven by that dispatch (the watch, share and history events), so they -followed it: the state transition of every engine event came first -(`events::apply`), then the controllers that show the result, `streams` first -as the one whose events were still the front end's. +The gate that accepted `voelin-ui-vm` asked for the `app.rs`/`events.rs` split +before the GPUI client. The dispatch is what moved (the `app.rs` part: +`handle` and `apply` in the crate, `host.rs` here); `events.rs` of +`voelin-ui` is no dispatch but the controller of the gateway's events page +(the event form, RSVP, the channels an event can be in), and it is not split. +Neither is the rest of `app.rs` named above: they are the next slices. ## Theme tokens