//! The Slint side of the transitions of `voelin-ui-vm`: what they ask of //! the front end while they run ([`SlintHost`]) and doing what their //! [`Update`] says ([`App::perform`]). The state changes are in the view //! model crate; this is where the engine, the store and the window are //! touched for them. use slint::ComponentHandle; use tracing::{debug, warn}; use voelin_core::Event; use voelin_core::settings::{AUDIO, CACHE_FETCH_IMAGES, Settings}; use voelin_store::{ChatRead, ChatTarget as StoredTarget, Store}; use crate::app::{App, AppState, Bridge, MainWindow, Nav, Page}; use crate::settings::{CLIENT_PLAYBACK, UI_IMAGE_PREVIEW_KB}; use crate::social::Social; use crate::studio::StudioState; use crate::vm::host::{Cx, Host, PasswordPrompt, Persist, Refresh, Update}; use crate::vm::servers::sequence::Backing; /// What the transitions ask while they run: the window, the store and the /// settings, borrowed from the app besides its state. pub(crate) struct SlintHost<'a> { pub demo_ui: bool, pub watching: bool, /// The private chat the messages page has open: session and peer. pub dm: Option<(i64, String)>, pub ui: &'a slint::Weak, pub store: &'a Store, pub prefs: &'a Settings, pub studio: &'a StudioState, } impl Host for SlintHost<'_> { fn demo_ui(&self) -> bool { self.demo_ui } fn chat_shown(&self) -> bool { self.ui.upgrade().is_some_and(|ui| ui.global::