diff --git a/gui/src/ui.rs b/gui/src/ui.rs index b7a4689..b442a4c 100644 --- a/gui/src/ui.rs +++ b/gui/src/ui.rs @@ -214,9 +214,21 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag }; #[cfg(any(target_os = "freebsd", target_os = "linux"))] - let sources_descriptions: Vec = sources_descriptions_list().unwrap_or_else(|_| Vec::new()); + let sources_descriptions: Vec = match sources_descriptions_list() { + Ok(descriptions) => descriptions, + Err(_) => { + Vec::new() + } + }; #[cfg(any(target_os = "freebsd", target_os = "linux"))] - let audio_output_source: String = audio_output_source().unwrap_or_else(|_| String::new()); + let audio_output_source = match audio_output_source() { + Ok(audio_output_source) => { + audio_output_source + } + Err(_) => { + String::new() + } + }; #[cfg(any(target_os = "freebsd", target_os = "linux"))] audio_source_combobox.append(Some("default"), &get_bundle("audio-input", None)); @@ -242,7 +254,7 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag tray_switch.set_label(Some(&get_bundle("tray-minimize", None))); video_switch.set_label(Some(&get_bundle("record-video", None))); area_switch.set_tooltip_text(Some(&get_bundle("show-area-tooltip", None))); - audio_input_switch.set_tooltip_text(Some(&get_bundle("audio-input-tooltip", None))); + audio_input_switch.set_tooltip_text(Some(&get_bundle("mic-tooltip", None))); #[cfg(target_os = "windows")] follow_mouse_switch.set_tooltip_text(Some(&get_bundle("windows-unsupported-tooltip", None))); #[cfg(any(target_os = "freebsd", target_os = "linux"))] @@ -721,13 +733,11 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag screen_grab_button.clone().into(), window_grab_button.clone().into(), video_switch.clone().into(), - audio_input_switch.clone().into(), frames_label.clone().into(), frames_spin.clone().into(), delay_label.clone().into(), delay_spin.clone().into(), hide_switch.clone().into(), - audio_output_switch.clone().into(), video_bitrate_label.clone().into(), video_bitrate_spin.clone().into(), audio_bitrate_label.clone().into(), @@ -737,6 +747,7 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag command_label.clone().into(), command_entry.clone().into() ]; + // Temporary solution if !is_wayland() { // Keep area_selection disaled in wayland @@ -749,18 +760,29 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag area_switch.set_sensitive(false); } - // Record struct values - let audio_output_id = if audio_output_switch.is_active() { - audio_output_source + // Disable audio input record + if sources_descriptions.is_empty() { + audio_input_switch.set_active(false); + audio_input_switch.set_sensitive(false); + audio_input_switch.set_tooltip_text(Some(&get_bundle("no-audio-input-tooltip", None))); } else { - String::new() - }; + input_widgets.push(audio_input_switch.clone().into()); + } + + // Disable audio output record + if audio_output_source.is_empty() { + audio_output_switch.set_active(false); + audio_output_switch.set_sensitive(false); + audio_output_switch.set_tooltip_text(Some(&get_bundle("no-audio-output-tooltip", None))); + } else { + input_widgets.push(audio_output_switch.clone().into()); + } // Init record struct #[cfg(target_os = "windows")] let ffmpeg_record_interface: Rc> = Rc::new(RefCell::new(Ffmpeg { audio_input_id: audio_source_combobox.clone(), - audio_output_id, + audio_output_id: audio_output_source, filename: ( folder_chooser_native, filename_entry, @@ -788,7 +810,7 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag #[cfg(any(target_os = "freebsd", target_os = "linux"))] let ffmpeg_record_interface: Rc> = Rc::new(RefCell::new(Ffmpeg { audio_input_id: audio_source_combobox.clone(), - audio_output_id, + audio_output_id: audio_output_source, filename: ( folder_chooser_native, filename_entry, diff --git a/locales/ar.ftl b/locales/ar.ftl index 12ffa70..34df123 100644 --- a/locales/ar.ftl +++ b/locales/ar.ftl @@ -164,14 +164,16 @@ about-tooltip = غرة ما يحسن بك علمه عن المسجل الأزر area-tooltip = اختر البقعة المُراد تسجيلها audio-bitrate-tooltip = اضبط جودة الصوت بما يناسب بالبت audio-source-tooltip = اختر منبع الصوت -audio-input-tooltip = يسجل الصوت delay-tooltip = المُهلة قبل بدء التسجيل folder-tooltip = اختر مقر تسجيلاتك follow-mouse-tooltip = اجعل الرقعة المختارة تتبع حركة السهم format-tooltip = اختر صيغة الخَرج frames-tooltip = خصص عدد الصور في الثانية hide-tooltip = اطوِ نافذة المسجل الأزرق عند بدء التسجيل +mic-tooltip = يسجل الصوت mouse-tooltip = يظهر مؤشر الفأرة عند التسجيل +no-audio-input-tooltip = لم يُعثَر على مدخل صوت +no-audio-output-tooltip = لم يُعثَر على مخرج صوت play-tooltip = انقر لمشاهدة ما سُجِّل record-tooltip = يشرع في التسجيل screen-tooltip = يحدد الشاشة كاملة ليسجلها diff --git a/locales/ar_YE.ftl b/locales/ar_YE.ftl index 12ffa70..34df123 100644 --- a/locales/ar_YE.ftl +++ b/locales/ar_YE.ftl @@ -164,14 +164,16 @@ about-tooltip = غرة ما يحسن بك علمه عن المسجل الأزر area-tooltip = اختر البقعة المُراد تسجيلها audio-bitrate-tooltip = اضبط جودة الصوت بما يناسب بالبت audio-source-tooltip = اختر منبع الصوت -audio-input-tooltip = يسجل الصوت delay-tooltip = المُهلة قبل بدء التسجيل folder-tooltip = اختر مقر تسجيلاتك follow-mouse-tooltip = اجعل الرقعة المختارة تتبع حركة السهم format-tooltip = اختر صيغة الخَرج frames-tooltip = خصص عدد الصور في الثانية hide-tooltip = اطوِ نافذة المسجل الأزرق عند بدء التسجيل +mic-tooltip = يسجل الصوت mouse-tooltip = يظهر مؤشر الفأرة عند التسجيل +no-audio-input-tooltip = لم يُعثَر على مدخل صوت +no-audio-output-tooltip = لم يُعثَر على مخرج صوت play-tooltip = انقر لمشاهدة ما سُجِّل record-tooltip = يشرع في التسجيل screen-tooltip = يحدد الشاشة كاملة ليسجلها diff --git a/locales/en.ftl b/locales/en.ftl index 1c8bbcc..d6c6d12 100644 --- a/locales/en.ftl +++ b/locales/en.ftl @@ -164,14 +164,16 @@ about-tooltip = Information about Blue Recorder area-tooltip = Select area to record audio-bitrate-tooltip = Set audio bitrate in KB/s audio-source-tooltip = Select audio source -audio-input-tooltip = Mic audio recording delay-tooltip = Delay time before starting record folder-tooltip = Select storage location follow-mouse-tooltip = Make the grabbed area follow the mouse format-tooltip = Select file format frames-tooltip = Set frames rate hide-tooltip = Hide window when start recording +mic-tooltip = Mic audio recording mouse-tooltip = Mouse appears in video recording +no-audio-input-tooltip = There were no audio input devices detected +no-audio-output-tooltip = There were no audio output devices detected play-tooltip = Click to play video record-tooltip = Start screen record screen-tooltip = Select screen to record diff --git a/locales/en_US.ftl b/locales/en_US.ftl index 1c8bbcc..d6c6d12 100644 --- a/locales/en_US.ftl +++ b/locales/en_US.ftl @@ -164,14 +164,16 @@ about-tooltip = Information about Blue Recorder area-tooltip = Select area to record audio-bitrate-tooltip = Set audio bitrate in KB/s audio-source-tooltip = Select audio source -audio-input-tooltip = Mic audio recording delay-tooltip = Delay time before starting record folder-tooltip = Select storage location follow-mouse-tooltip = Make the grabbed area follow the mouse format-tooltip = Select file format frames-tooltip = Set frames rate hide-tooltip = Hide window when start recording +mic-tooltip = Mic audio recording mouse-tooltip = Mouse appears in video recording +no-audio-input-tooltip = There were no audio input devices detected +no-audio-output-tooltip = There were no audio output devices detected play-tooltip = Click to play video record-tooltip = Start screen record screen-tooltip = Select screen to record