Slice 3 of plan section 6 step 3, first part. VoicePage is a cached pane of its own, a sibling of the server page that MainView puts in the main area while the page is asked for (show_voice_view, through voelin-ui-vm's logic) and voice is connected, as the Slint VoiceView is. It shows the channel (name, topic, banner under the surface veil, "N in voice / limit total"), the people of our channel as TreeView::members gives them through the tree model's Voice event (the ring that is green while they talk and blue while they stream, the bars or the microphone and sound marks in the corner, the crown, "Speaking", "Streaming", "Away"; a click opens the card), and the call bar: mute, deafen, Share and the voice settings (both logged until their slices), Leave. The smaller stage, one row of small avatars, is ui.voice_compact and always in a window under 800 pixels tall, which MainView pushes into the pane (a cached pane does not see a resize); VOELIN_OPEN=voice[:compact] asks for it, the sample servers keep nothing. The server page gets a Voice channel button for the way in, and the meter counts the page's renders. Tests on the test platform: the page takes the main area and gives it back, the people and their marks, talking and mute events redraw the page once and the rail, top bar and main area not at all (one model build for three lists), Leave reaches the engine, the call bar's buttons, the stage kept in the settings and forced short, the banner. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
185 lines
6.2 KiB
Rust
185 lines
6.2 KiB
Rust
//! What the user can ask of the shell, as GPUI actions: the callbacks of the
|
|
//! Slint front end's `bind/servers.rs` that the desktop shell has (the first
|
|
//! eleven below), and the shell's own affordances. A click dispatches the
|
|
//! action ([`gpui_kit::Window::dispatch_action`]), the window's root view
|
|
//! ([`crate::view::MainView`]) handles it, and the handler asks the root state
|
|
//! ([`crate::app::AppState`]) for what the callback did in Slint: key bindings
|
|
//! and menus come to the same handlers later.
|
|
//!
|
|
//! The voice page and the call bar add `show_voice_view`, the page's own
|
|
//! buttons (the smaller stage, Leave) and the two affordances of the call bar
|
|
//! whose pages come with later slices (Share, the voice settings), which are
|
|
//! logged.
|
|
//!
|
|
//! The channel tree and the members panel add `join_channel`,
|
|
//! `join_with_password`, `toggle_collapse`, `search_members`, `open_member` and
|
|
//! `open_client` (the last one only logs: the client's volume dialog is a
|
|
//! dialog of its own slice). The callbacks of `bind/servers.rs` that are
|
|
//! still not here belong to the slices after: `client_audio_changed` to the
|
|
//! dialogs, and `copied` (the toast that follows a copy) to whichever copies:
|
|
//! [`Invite`] sets it itself.
|
|
|
|
use gpui_kit::{Action, actions};
|
|
|
|
actions!(
|
|
voelin,
|
|
[
|
|
/// `connect_voice`: connect the server on screen with voice, into its default channel.
|
|
ConnectVoice,
|
|
/// `disconnect_voice`: leave voice on the server on screen.
|
|
DisconnectVoice,
|
|
/// `invite`: copy a link to the voice channel we are in.
|
|
Invite,
|
|
/// `save_bookmark`: save the server form (the form's own Save button).
|
|
SaveServer,
|
|
/// `save_and_connect`: save the server form, then connect.
|
|
SaveAndConnect,
|
|
/// Open the empty server form (the rail's plus button).
|
|
AddServer,
|
|
/// Close the server form without saving.
|
|
CancelServerForm,
|
|
/// The top bar's search box: the search comes with its slice, today it is logged.
|
|
OpenSearch,
|
|
/// The settings buttons: the settings come with their slice, today it is logged.
|
|
OpenSettings,
|
|
/// `join_with_password`: the password prompt's Join, with what it holds.
|
|
SubmitChannelPassword,
|
|
/// Close the password prompt without joining.
|
|
CancelChannelPassword,
|
|
/// The voice page's Leave (`Nav.show-voice(false)` then `disconnect_voice`).
|
|
LeaveVoice,
|
|
/// The voice page's Smaller stage / Larger stage (`ui.voice_compact`).
|
|
ToggleVoiceCompact,
|
|
/// The call bar's Share: the share menu comes with the stream slices, today it is logged.
|
|
OpenShare,
|
|
/// The call bar's voice settings: the settings come with their slice, today it is logged.
|
|
OpenVoiceSettings,
|
|
]
|
|
);
|
|
|
|
/// `show_voice_view`: the voice channel page on (the main area) or off (back to
|
|
/// the server page, where the chat will be).
|
|
#[derive(Clone, Debug, PartialEq, Action)]
|
|
#[action(namespace = voelin, no_json)]
|
|
pub struct ShowVoiceView {
|
|
/// Shown from now on.
|
|
pub on: bool,
|
|
}
|
|
|
|
/// `select_server`: show a server (and observe it).
|
|
#[derive(Clone, Debug, PartialEq, Action)]
|
|
#[action(namespace = voelin, no_json)]
|
|
pub struct SelectServer {
|
|
/// The bookmark's id.
|
|
pub id: i64,
|
|
}
|
|
|
|
/// `edit_bookmark`: open the server form with a saved server.
|
|
#[derive(Clone, Debug, PartialEq, Action)]
|
|
#[action(namespace = voelin, no_json)]
|
|
pub struct EditServer {
|
|
/// The bookmark's id.
|
|
pub id: i64,
|
|
}
|
|
|
|
/// `delete_bookmark`: remove a server.
|
|
#[derive(Clone, Debug, PartialEq, Action)]
|
|
#[action(namespace = voelin, no_json)]
|
|
pub struct DeleteServer {
|
|
/// The bookmark's id.
|
|
pub id: i64,
|
|
}
|
|
|
|
/// `set_input_muted`: mute or unmute our microphone.
|
|
#[derive(Clone, Debug, PartialEq, Action)]
|
|
#[action(namespace = voelin, no_json)]
|
|
pub struct SetInputMuted {
|
|
/// Muted from now on.
|
|
pub muted: bool,
|
|
}
|
|
|
|
/// `set_output_muted`: mute or unmute the sound.
|
|
#[derive(Clone, Debug, PartialEq, Action)]
|
|
#[action(namespace = voelin, no_json)]
|
|
pub struct SetOutputMuted {
|
|
/// Muted from now on.
|
|
pub muted: bool,
|
|
}
|
|
|
|
/// `push_to_talk`: transmit while the hold-to-talk button is held.
|
|
#[derive(Clone, Debug, PartialEq, Action)]
|
|
#[action(namespace = voelin, no_json)]
|
|
pub struct PushToTalk {
|
|
/// Transmitting from now on.
|
|
pub on: bool,
|
|
}
|
|
|
|
/// `join_channel`: join a channel of the server on screen (a double-click on
|
|
/// its row, the context menu's Join).
|
|
#[derive(Clone, Debug, PartialEq, Action)]
|
|
#[action(namespace = voelin, no_json)]
|
|
pub struct JoinChannel {
|
|
/// The channel's id on the server.
|
|
pub channel: u64,
|
|
}
|
|
|
|
/// A click on a channel's row: select it (the Slint tree opens the channel's
|
|
/// chat, which comes with the chat slice).
|
|
#[derive(Clone, Debug, PartialEq, Action)]
|
|
#[action(namespace = voelin, no_json)]
|
|
pub struct SelectChannel {
|
|
/// The channel's id on the server.
|
|
pub channel: u64,
|
|
}
|
|
|
|
/// `toggle_collapse`: fold or unfold a channel of the tree.
|
|
#[derive(Clone, Debug, PartialEq, Action)]
|
|
#[action(namespace = voelin, no_json)]
|
|
pub struct ToggleChannel {
|
|
/// The channel's id on the server.
|
|
pub channel: u64,
|
|
}
|
|
|
|
/// The context menu's Edit channel: the channel editor is a slice of its own,
|
|
/// today it is logged.
|
|
#[derive(Clone, Debug, PartialEq, Action)]
|
|
#[action(namespace = voelin, no_json)]
|
|
pub struct EditChannel {
|
|
/// The channel's id on the server.
|
|
pub channel: u64,
|
|
}
|
|
|
|
/// The context menu's Move to my channel: moving another client needs a command
|
|
/// the engine does not have yet, so today it is logged.
|
|
#[derive(Clone, Debug, PartialEq, Action)]
|
|
#[action(namespace = voelin, no_json)]
|
|
pub struct MoveClient {
|
|
/// The client's id on the server.
|
|
pub client: u16,
|
|
}
|
|
|
|
/// `open_client`: a click on a person in the tree opens their volume dialog,
|
|
/// which is a dialog of its own slice: today it is logged.
|
|
#[derive(Clone, Debug, PartialEq, Action)]
|
|
#[action(namespace = voelin, no_json)]
|
|
pub struct OpenClient {
|
|
/// The client's id on the server.
|
|
pub client: u16,
|
|
}
|
|
|
|
/// `search_members`: the members panel's search text.
|
|
#[derive(Clone, Debug, PartialEq, Action)]
|
|
#[action(namespace = voelin, no_json)]
|
|
pub struct SearchMembers {
|
|
/// What the box holds; empty shows everyone.
|
|
pub text: String,
|
|
}
|
|
|
|
/// `open_member`: open the card of a person over the members panel; -1 closes it.
|
|
#[derive(Clone, Debug, PartialEq, Action)]
|
|
#[action(namespace = voelin, no_json)]
|
|
pub struct OpenMember {
|
|
/// The client's id on the server, or -1.
|
|
pub client: i32,
|
|
}
|