The Volume rows of the Slint member card (members.slint): what the person is played at in percent, a mute for us and a slider (0 to 200, steps of 5), both off for a person the server gave no unique id, since the choice is kept by it. A click on a person on the voice page or in the members panel opens the card, so the volume is a click away from the people the voice page shows. The slider and the button are the actions SetMemberVolume and SetMemberMuted, which go through voelin-ui-vm's settings_page logic (open_client, then client_playback_changed: the engine's SetClientVolume and SetClientMuted, the `client_playback` key, the tree's mark of who is muted), the logic the Slint front end's volume dialog calls; the dialogs slice keeps the dialog itself. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
207 lines
6.9 KiB
Rust
207 lines
6.9 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 (the member card has the volume and the mute of a person,
|
|
//! [`SetMemberVolume`] and [`SetMemberMuted`]), 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,
|
|
}
|
|
|
|
/// The member card's volume slider: the person's playback volume, in percent
|
|
/// (`member_volume` of the Slint card).
|
|
#[derive(Clone, Debug, PartialEq, Action)]
|
|
#[action(namespace = voelin, no_json)]
|
|
pub struct SetMemberVolume {
|
|
/// The client's id on the server.
|
|
pub client: u16,
|
|
/// 0 to 200.
|
|
pub percent: f32,
|
|
}
|
|
|
|
/// The member card's Mute for me: stop playing the person (local only).
|
|
#[derive(Clone, Debug, PartialEq, Action)]
|
|
#[action(namespace = voelin, no_json)]
|
|
pub struct SetMemberMuted {
|
|
/// The client's id on the server.
|
|
pub client: u16,
|
|
/// Muted from now on.
|
|
pub muted: 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,
|
|
}
|