Files
VoelinClient/crates/voelin-ui/src/bind/servers.rs
T
Claude c854053090 voelin-ui: design system, shells and view models for the new design
The single 1700-line app.slint becomes a design system and screens that
later waves can compose:

- theme.slint: colour, radius, spacing and type tokens (dark and light,
  a runtime font scale); icons.slint: Lucide icons as tintable images.
- components/: Button, IconButton, TextField, SearchBox, Select, Toggle,
  Slider, SegmentedTabs, Avatar, badges, Card, Meter, NavItem, ListItem,
  PopupMenu, Tooltip, Modal, Toast, ResizeHandle, Spinner, RichText and
  the EmojiPicker.
- shells/: the desktop frame (server rail, top bar, sidebar with the user
  card) and the phone frame with a bottom navigation, switched at a
  breakpoint from the settings.
- screens/: today's screens re-skinned (channels, chat, streams panel and
  viewer, settings page, home, dialogs, phone pages); all callbacks and
  properties keep their behaviour. Navigation state is the Nav global.

On the Rust side app.rs keeps setup and event glue; servers.rs, chat.rs,
settings_page.rs and appearance.rs hold the logic, vm/ the pure view
models, bind/ the callbacks, dev.rs the development switches. Models are
created once and updated row by row (vm::list::sync); each chat tab owns
its lines model, so a message appends one row. Emoji come from the
bundled Twemoji archive through a size-bounded image cache, split into
runs that wrap with the text. New settings ui.theme, ui.font_scale,
ui.narrow_breakpoint and ui.image_cache_mb apply live.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-28 02:22:25 +00:00

59 lines
1.8 KiB
Rust

//! The rail, the server card, the channel tree and the voice controls.
use slint::ComponentHandle;
use voelin_core::Command;
use voelin_model::ChannelId;
use crate::app::{Bridge, MainWindow, with_app};
pub(super) fn wire(ui: &MainWindow) {
let bridge = ui.global::<Bridge>();
bridge.on_select_server(|id| {
with_app(|app| app.select_server(id as i64));
});
bridge.on_search(|text| {
with_app(|app| app.search(text.to_string()));
});
bridge.on_connect_voice(|| {
with_app(|app| app.connect_voice());
});
bridge.on_disconnect_voice(|| {
with_app(|app| app.command(|session| Command::DisconnectVoice { session }));
});
bridge.on_toggle_observe(|| {
with_app(|app| app.toggle_observe());
});
bridge.on_join_channel(|cid| {
with_app(|app| {
app.command(|session| Command::MoveToChannel {
session,
channel: cid as ChannelId,
password: None,
})
});
});
bridge.on_toggle_collapse(|cid| {
with_app(|app| app.toggle_collapse(cid as ChannelId));
});
bridge.on_set_input_muted(|muted| {
with_app(|app| app.command(|session| Command::SetInputMuted { session, muted }));
});
bridge.on_set_output_muted(|muted| {
with_app(|app| app.command(|session| Command::SetOutputMuted { session, muted }));
});
bridge.on_push_to_talk(|on| {
with_app(|app| app.command(|session| Command::SetTransmitting { session, on }));
});
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));
});
bridge.on_delete_bookmark(|id| {
with_app(|app| app.delete_bookmark(id as i64));
});
bridge.on_open_client(|id| with_app(|app| app.open_client(id as u16)).unwrap_or(false));
bridge.on_client_audio_changed(|form| {
with_app(|app| app.client_playback_changed(&form));
});
}