@@ -2,7 +2,10 @@ use crate::{
22 config, global_store,
33 logic:: { toast, tr:: tr} ,
44 logic_cb,
5- slint_generatedAppWindow:: { AppWindow , SettingShareScreen as UISettingShareScreen } ,
5+ slint_generatedAppWindow:: {
6+ AppWindow , SettingShareScreen as UISettingShareScreen ,
7+ SettingShareScreenClient as UISettingShareScreenClient ,
8+ } ,
69} ;
710use recorder:: { RTCIceServer , ShareScreenConfig } ;
811use slint:: { ComponentHandle , Model , ModelRc , SharedString , VecModel , Weak } ;
@@ -18,26 +21,35 @@ macro_rules! host_ips {
1821}
1922
2023pub fn init ( ui : & AppWindow ) {
21- logic_cb ! ( add_host_ip, ui, ips, ip) ;
22- logic_cb ! ( remove_host_ip, ui, ips, index) ;
23- logic_cb ! ( load_share_screen_cert_file, ui) ;
24- logic_cb ! ( load_share_screen_key_file, ui) ;
25- logic_cb ! ( verify_setting_share_screen, ui, setting) ;
24+ // share screen server
25+ logic_cb ! ( share_screen_add_host_ip, ui, ips, ip) ;
26+ logic_cb ! ( share_screen_remove_host_ip, ui, ips, index) ;
27+ logic_cb ! ( share_screen_load_cert_file, ui) ;
28+ logic_cb ! ( share_screen_load_key_file, ui) ;
29+ logic_cb ! ( share_screen_verify_setting, ui, setting) ;
30+
31+ // share screen client
32+ logic_cb ! ( share_screen_player_play, ui) ;
33+ logic_cb ! ( share_screen_player_stop, ui) ;
34+ logic_cb ! ( share_screen_player_sound_changed, ui, progress) ;
35+ logic_cb ! ( share_screen_client_disconnect, ui) ;
36+ logic_cb ! ( share_screen_client_connect, ui, setting) ;
37+ logic_cb ! ( convert_to_meida_time, ui, duration) ;
2638}
2739
28- fn add_host_ip ( _ui : & AppWindow , ips : ModelRc < SharedString > , ip : SharedString ) {
40+ fn share_screen_add_host_ip ( _ui : & AppWindow , ips : ModelRc < SharedString > , ip : SharedString ) {
2941 host_ips ! ( ips) . insert ( 0 , ip) ;
3042}
3143
32- fn remove_host_ip ( _ui : & AppWindow , ips : ModelRc < SharedString > , index : i32 ) {
44+ fn share_screen_remove_host_ip ( _ui : & AppWindow , ips : ModelRc < SharedString > , index : i32 ) {
3345 if index < 0 || index >= host_ips ! ( ips) . row_count ( ) as i32 {
3446 return ;
3547 }
3648
3749 host_ips ! ( ips) . remove ( index as usize ) ;
3850}
3951
40- fn load_share_screen_cert_file ( ui : & AppWindow ) {
52+ fn share_screen_load_cert_file ( ui : & AppWindow ) {
4153 let ui_weak = ui. as_weak ( ) ;
4254
4355 tokio:: spawn ( async move {
@@ -57,7 +69,7 @@ fn load_share_screen_cert_file(ui: &AppWindow) {
5769 } ) ;
5870}
5971
60- fn load_share_screen_key_file ( ui : & AppWindow ) {
72+ fn share_screen_load_key_file ( ui : & AppWindow ) {
6173 let ui_weak = ui. as_weak ( ) ;
6274
6375 tokio:: spawn ( async move {
@@ -77,7 +89,7 @@ fn load_share_screen_key_file(ui: &AppWindow) {
7789 } ) ;
7890}
7991
80- fn verify_setting_share_screen ( _ui : & AppWindow , config : UISettingShareScreen ) -> SharedString {
92+ fn share_screen_verify_setting ( _ui : & AppWindow , config : UISettingShareScreen ) -> SharedString {
8193 if config. enable_stun_server && !config. stun_server . url . starts_with ( "stun" ) {
8294 return tr ( "Invalid STUN server url format. Should start with `stun:`" ) . into ( ) ;
8395 }
@@ -89,6 +101,30 @@ fn verify_setting_share_screen(_ui: &AppWindow, config: UISettingShareScreen) ->
89101 SharedString :: default ( )
90102}
91103
104+ fn share_screen_player_play ( ui : & AppWindow ) {
105+ todo ! ( )
106+ }
107+
108+ fn share_screen_player_stop ( ui : & AppWindow ) {
109+ todo ! ( )
110+ }
111+
112+ fn share_screen_player_sound_changed ( ui : & AppWindow , progress : f32 ) {
113+ todo ! ( )
114+ }
115+
116+ fn share_screen_client_disconnect ( ui : & AppWindow ) {
117+ todo ! ( )
118+ }
119+
120+ fn share_screen_client_connect ( ui : & AppWindow , setting : UISettingShareScreenClient ) {
121+ // todo!()
122+ }
123+
124+ fn convert_to_meida_time ( ui : & AppWindow , duration : i32 ) -> SharedString {
125+ cutil:: time:: seconds_to_media_timestamp ( duration. max ( 0 ) as f64 ) . into ( )
126+ }
127+
92128pub fn picker_file (
93129 ui : Weak < AppWindow > ,
94130 title : & str ,
0 commit comments