|
1 | | -use crate::{logic_cb, slint_generatedAppWindow::AppWindow}; |
| 1 | +use crate::{ |
| 2 | + global_store, logic_cb, |
| 3 | + slint_generatedAppWindow::{AppWindow, Source as UISource}, |
| 4 | +}; |
2 | 5 | use slint::{ComponentHandle, Model, ModelRc, SharedString, VecModel}; |
3 | 6 |
|
| 7 | +// static CACHE: Lazy<Mutex<Cache>> = Lazy::new(|| Mutex::new(Cache::default())); |
| 8 | + |
| 9 | +#[macro_export] |
| 10 | +macro_rules! store_audio_sources { |
| 11 | + ($ui:expr) => { |
| 12 | + crate::global_store!($ui) |
| 13 | + .get_audio_sources() |
| 14 | + .as_any() |
| 15 | + .downcast_ref::<VecModel<SharedString>>() |
| 16 | + .expect("We know we set a VecModel<SharedString> earlier") |
| 17 | + }; |
| 18 | +} |
| 19 | + |
| 20 | +#[macro_export] |
| 21 | +macro_rules! store_video_sources { |
| 22 | + ($ui:expr) => { |
| 23 | + crate::global_store!($ui) |
| 24 | + .get_video_sources() |
| 25 | + .as_any() |
| 26 | + .downcast_ref::<VecModel<SharedString>>() |
| 27 | + .expect("We know we set a VecModel<SharedString> earlier") |
| 28 | + }; |
| 29 | +} |
| 30 | + |
| 31 | +#[macro_export] |
| 32 | +macro_rules! store_sources { |
| 33 | + ($ui:expr) => { |
| 34 | + crate::global_store!($ui) |
| 35 | + .get_sources() |
| 36 | + .as_any() |
| 37 | + .downcast_ref::<VecModel<UISource>>() |
| 38 | + .expect("We know we set a VecModel<UISource> earlier") |
| 39 | + }; |
| 40 | +} |
| 41 | + |
4 | 42 | pub fn init(ui: &AppWindow) { |
5 | | - // logic_cb!(generate_search_values, ui, entries); |
6 | | - // logic_cb!(get_sidebar_key_from_search_values, ui, entries, text); |
| 43 | + inner_init(&ui); |
| 44 | + |
| 45 | + logic_cb!(screen_changed, ui, name); |
| 46 | + logic_cb!(input_audio_changed, ui, name); |
| 47 | + logic_cb!(start_recording, ui); |
| 48 | + logic_cb!(stop_recording, ui); |
| 49 | + logic_cb!(stop_merge_tracks, ui); |
| 50 | +} |
| 51 | + |
| 52 | +fn inner_init(ui: &AppWindow) { |
| 53 | + store_sources!(ui).set_vec(vec![]); |
| 54 | + store_audio_sources!(ui).set_vec(vec![]); |
| 55 | + store_video_sources!(ui).set_vec(vec![]); |
| 56 | + global_store!(ui).set_preview_image(Default::default()); |
7 | 57 | } |
8 | 58 |
|
9 | | -// fn generate_search_values( |
10 | | -// _ui: &AppWindow, |
11 | | -// entries: ModelRc<UISideBarEntry>, |
12 | | -// ) -> ModelRc<SharedString> { |
13 | | -// } |
14 | | -// |
15 | | -// fn get_sidebar_key_from_search_values( |
16 | | -// _ui: &AppWindow, |
17 | | -// entries: ModelRc<UISideBarEntry>, |
18 | | -// text: SharedString, |
19 | | -// ) -> SharedString { |
20 | | -// } |
| 59 | +fn screen_changed(ui: &AppWindow, name: SharedString) {} |
| 60 | + |
| 61 | +fn input_audio_changed(ui: &AppWindow, name: SharedString) {} |
| 62 | + |
| 63 | +fn start_recording(ui: &AppWindow) {} |
| 64 | + |
| 65 | +fn stop_recording(ui: &AppWindow) {} |
| 66 | + |
| 67 | +fn stop_merge_tracks(ui: &AppWindow) {} |
0 commit comments