Merge the Stream Studio UI
Both sides kept: the studio page and the new home, friends, messages, events and settings pages in the Page enum, app.slint, the phone's top bar (studio, search, bell), bind/ and vm/ modules, dev.rs switches. The layers icon and Video::codecs were added on both sides; one of each is kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
bea6b335fa
52 files changed
+8115
-486
No files matched your search
@@ -8,8 +8,11 @@ mod servers;
|
||||
mod settings;
|
||||
mod social;
|
||||
mod streams;
|
||||
pub(crate) mod studio;
|
||||
|
||||
use crate::app::MainWindow;
|
||||
use slint::ComponentHandle;
|
||||
|
||||
use crate::app::{MainWindow, StudioBridge};
|
||||
|
||||
/// Connect every callback of the window.
|
||||
pub(crate) fn wire(ui: &MainWindow) {
|
||||
@@ -20,4 +23,5 @@ pub(crate) fn wire(ui: &MainWindow) {
|
||||
emoji::wire(ui);
|
||||
social::wire(ui);
|
||||
pages::wire(ui);
|
||||
studio::wire(&ui.global::<StudioBridge>());
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
//! The Stream Studio's callbacks, for the main window and for the studio's
|
||||
//! own window (each has its own StudioBridge global).
|
||||
|
||||
use voelin_core::studio::Command;
|
||||
|
||||
use crate::app::{StudioBridge, with_app};
|
||||
|
||||
/// Slint ids are ints; the studio's are u64.
|
||||
fn id(value: i32) -> u64 {
|
||||
u64::try_from(value).unwrap_or(u64::MAX)
|
||||
}
|
||||
|
||||
fn index(value: i32) -> usize {
|
||||
usize::try_from(value).unwrap_or(usize::MAX)
|
||||
}
|
||||
|
||||
pub(crate) fn wire(bridge: &StudioBridge) {
|
||||
// From a page's init: run it after the page is built, outside of Slint's
|
||||
// update.
|
||||
bridge.on_open(|| {
|
||||
let _ = slint::invoke_from_event_loop(|| {
|
||||
with_app(|app| app.studio_open());
|
||||
});
|
||||
});
|
||||
bridge.on_detach(|| {
|
||||
with_app(|app| app.studio_detach());
|
||||
});
|
||||
bridge.on_dock(|| {
|
||||
with_app(|app| app.studio_dock());
|
||||
});
|
||||
|
||||
bridge.on_select_scene(|scene| {
|
||||
with_app(|app| app.studio_scene_command(Command::SetActiveScene { scene: id(scene) }));
|
||||
});
|
||||
bridge.on_add_scene(|| {
|
||||
with_app(|app| app.studio_add_scene());
|
||||
});
|
||||
bridge.on_rename_scene(|scene, name| {
|
||||
let name = name.trim().to_owned();
|
||||
if !name.is_empty() {
|
||||
with_app(|app| {
|
||||
app.studio_scene_command(Command::RenameScene { scene: id(scene), name })
|
||||
});
|
||||
}
|
||||
});
|
||||
bridge.on_remove_scene(|scene| {
|
||||
with_app(|app| app.studio_scene_command(Command::RemoveScene { scene: id(scene) }));
|
||||
});
|
||||
|
||||
bridge.on_list_sources(|kind| with_app(|app| app.studio_list_sources(&kind)).unwrap_or(false));
|
||||
bridge.on_add_picked(|_, i| {
|
||||
with_app(|app| app.studio_add_picked(index(i)));
|
||||
});
|
||||
bridge.on_add_source(|form| {
|
||||
with_app(|app| app.studio_add_source(&form));
|
||||
});
|
||||
bridge.on_source_form(|source| {
|
||||
with_app(|app| app.studio_source_form(id(source))).unwrap_or_default()
|
||||
});
|
||||
bridge.on_apply_source(|form| {
|
||||
with_app(|app| app.studio_apply_source(&form));
|
||||
});
|
||||
bridge.on_toggle_source(|source| {
|
||||
with_app(|app| app.studio_toggle_source(id(source)));
|
||||
});
|
||||
bridge.on_source_action(|source, action| {
|
||||
with_app(|app| app.studio_source_action(id(source), &action));
|
||||
});
|
||||
bridge.on_main_source(|kind| {
|
||||
with_app(|app| app.studio_main_source(&kind));
|
||||
});
|
||||
|
||||
bridge.on_list_audio(|| {
|
||||
with_app(|app| app.studio_list_audio());
|
||||
});
|
||||
bridge.on_add_audio(|i| {
|
||||
with_app(|app| app.studio_add_audio(index(i)));
|
||||
});
|
||||
bridge.on_set_gain(|i, db, done| {
|
||||
with_app(|app| app.studio_set_gain(index(i), db, done));
|
||||
});
|
||||
bridge.on_toggle_mute(|i| {
|
||||
with_app(|app| app.studio_toggle_mute(index(i)));
|
||||
});
|
||||
bridge.on_remove_audio(|i| {
|
||||
with_app(|app| app.studio_remove_audio(index(i)));
|
||||
});
|
||||
|
||||
bridge.on_edit_form(|key, value| {
|
||||
with_app(|app| app.studio_edit(&key, &value));
|
||||
});
|
||||
bridge.on_set_output(|w, h, fps| {
|
||||
with_app(|app| app.studio_set_output(&w, &h, &fps));
|
||||
});
|
||||
bridge.on_set_layer(|i, layer| {
|
||||
with_app(|app| app.studio_set_layer(index(i), &layer));
|
||||
});
|
||||
bridge.on_add_layer(|| {
|
||||
with_app(|app| app.studio_add_layer());
|
||||
});
|
||||
bridge.on_remove_layer(|i| {
|
||||
with_app(|app| app.studio_remove_layer(index(i)));
|
||||
});
|
||||
bridge.on_advanced_settings(|| {
|
||||
with_app(|app| app.studio_advanced());
|
||||
});
|
||||
|
||||
bridge.on_save_clip(|| {
|
||||
with_app(|app| app.studio_save_clip());
|
||||
});
|
||||
bridge.on_toggle_recording(|| {
|
||||
with_app(|app| app.studio_toggle_recording());
|
||||
});
|
||||
bridge.on_open_recordings(|| {
|
||||
with_app(|app| app.studio_open_recordings());
|
||||
});
|
||||
bridge.on_go_live(|| {
|
||||
with_app(|app| app.studio_go_live());
|
||||
});
|
||||
bridge.on_end_stream(|| {
|
||||
with_app(|app| app.studio_end());
|
||||
});
|
||||
bridge.on_settings_form(|| with_app(|app| app.studio_settings_form()).unwrap_or_default());
|
||||
bridge.on_apply_settings(|form| {
|
||||
with_app(|app| app.studio_apply_settings(&form));
|
||||
});
|
||||
|
||||
bridge.on_respond_viewer(|client, accept| {
|
||||
with_app(|app| app.studio_respond_viewer(u16::try_from(client).unwrap_or(0), accept));
|
||||
});
|
||||
bridge.on_send_chat(|text| {
|
||||
with_app(|app| app.studio_send_chat(text.to_string()));
|
||||
});
|
||||
bridge.on_open_chat(|| {
|
||||
with_app(|app| app.studio_open_chat());
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user