Join a Server and Add a Server were the same dialog with other buttons, and Join saved the server in Slint and then connected the one shown: when saving failed, that was the server shown before. The dialog now has Cancel, Save and Connect (also Enter in the address or password field). Connect goes through Bridge.save-and-connect, which connects only the server it saved (vm::servers::connect_to); it is hidden while the server has voice, and Save is the main button then. On a phone Delete shows only its icon, so the four buttons fit. BookmarkForm carries a channel, its password and a privilege key for the links to come: the dialog shows "Joins <channel>" and "This link grants a server group", Connect connects into that channel, and connect_voice_to passes the key on. Nav.join-server is gone; the dev switch join opens the same dialog as bookmark. "Add server" reads "Add a server" everywhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ
66 lines
2.2 KiB
Rust
66 lines
2.2 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::{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_members(|text| {
|
|
with_app(|app| app.search_members(text.to_string()));
|
|
});
|
|
bridge.on_show_voice_view(|on| {
|
|
with_app(|app| app.show_voice_view(on));
|
|
});
|
|
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_join_channel(|cid| {
|
|
with_app(|app| {
|
|
if let Some(session) = app.current {
|
|
app.join_channel(session, cid as ChannelId);
|
|
}
|
|
});
|
|
});
|
|
bridge.on_join_with_password(|password| {
|
|
with_app(|app| app.join_with_password(password.to_string()));
|
|
});
|
|
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_save_and_connect(|form| with_app(|app| app.save_and_connect(&form)).unwrap_or(false));
|
|
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));
|
|
});
|
|
bridge.on_invite(|| with_app(|app| app.invite_link()).unwrap_or_default().into());
|
|
// Nav.copy, from any screen.
|
|
bridge.on_copied(|| {
|
|
with_app(App::copied);
|
|
});
|
|
}
|