mirror of
https://github.com/xlmnxp/blue-recorder.git
synced 2025-04-01 15:24:55 +03:00
fix borrow_mut error
This commit is contained in:
parent
3e19d0af31
commit
4b3c8d7d9f
@ -428,7 +428,7 @@ impl Ffmpeg {
|
||||
#[cfg(feature = "gtk")]
|
||||
impl Ffmpeg {
|
||||
// Get file name
|
||||
pub fn get_filename(&mut self) -> Result<String> {
|
||||
pub fn get_filename(&mut self) -> Result<()> {
|
||||
self.saved_filename =
|
||||
self.filename
|
||||
.0
|
||||
@ -448,7 +448,7 @@ impl Ffmpeg {
|
||||
.as_path()
|
||||
.display()
|
||||
.to_string();
|
||||
Ok(self.saved_filename.clone())
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Start video recording
|
||||
|
@ -419,7 +419,7 @@ impl Ffmpeg {
|
||||
#[cfg(feature = "gtk")]
|
||||
impl Ffmpeg {
|
||||
// Get file name
|
||||
pub fn get_filename(&mut self) -> Result<String> {
|
||||
pub fn get_filename(&mut self) -> Result<()> {
|
||||
self.saved_filename =
|
||||
self.filename
|
||||
.0
|
||||
@ -439,7 +439,7 @@ impl Ffmpeg {
|
||||
.as_path()
|
||||
.display()
|
||||
.to_string();
|
||||
Ok(self.saved_filename.clone())
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Start video recording
|
||||
|
186
gui/src/ui.rs
186
gui/src/ui.rs
@ -820,102 +820,103 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
_error_dialog.show();
|
||||
},
|
||||
Ok(_) => {
|
||||
if !_audio_input_switch.is_active() &&
|
||||
!_audio_output_switch.is_active() &&
|
||||
!_video_switch.is_active() ||
|
||||
!is_overwrite(&get_bundle("already-exist", None),
|
||||
// Continue
|
||||
},
|
||||
}
|
||||
if !_audio_input_switch.is_active() &&
|
||||
!_audio_output_switch.is_active() &&
|
||||
!_video_switch.is_active() ||
|
||||
!is_overwrite(&get_bundle("already-exist", None),
|
||||
&_ffmpeg_record_interface.borrow_mut().saved_filename,
|
||||
_main_window.clone()
|
||||
) && !second_click.borrow_mut().is_clicked() && _delay_spin.value() as u16 == 0
|
||||
{
|
||||
// Do nothing
|
||||
} else {
|
||||
_delay_window_button.set_active(false);
|
||||
if _delay_spin.value() as u16 > 0 {
|
||||
if !is_overwrite(&get_bundle("already-exist", None),
|
||||
&_ffmpeg_record_interface.borrow_mut().saved_filename,
|
||||
_main_window.clone()
|
||||
) && !second_click.borrow_mut().is_clicked() && _delay_spin.value() as u16 == 0
|
||||
_main_window.clone())
|
||||
{
|
||||
// Do nothing
|
||||
//Do nothing
|
||||
} else {
|
||||
_delay_window_button.set_active(false);
|
||||
if _delay_spin.value() as u16 > 0 {
|
||||
if !is_overwrite(&get_bundle("already-exist", None),
|
||||
&_ffmpeg_record_interface.borrow_mut().saved_filename,
|
||||
_main_window.clone())
|
||||
{
|
||||
//Do nothing
|
||||
} else {
|
||||
recording_delay(
|
||||
_delay_spin.clone(),
|
||||
_delay_spin.value() as u16,
|
||||
delay_window.clone(),
|
||||
_delay_window_button.clone(),
|
||||
delay_window_label.clone(),
|
||||
_record_button.clone(),
|
||||
second_click.clone(),
|
||||
);
|
||||
}
|
||||
} else if _delay_spin.value() as u16 == 0 && !is_wayland() {
|
||||
let _area_capture = area_capture.borrow_mut();
|
||||
disable_input_widgets(_input_widgets.clone());
|
||||
start_timer(record_time_label.clone());
|
||||
record_time_label.set_visible(true);
|
||||
if hide_switch.is_active() {
|
||||
_main_window.minimize();
|
||||
}
|
||||
_play_button.hide();
|
||||
_record_button.hide();
|
||||
_stop_button.show();
|
||||
if _audio_input_switch.is_active() {
|
||||
match _ffmpeg_record_interface.borrow_mut().start_input_audio() {
|
||||
Ok(_) => {
|
||||
// Do nothing
|
||||
},
|
||||
Err(error) => {
|
||||
enable_input_widgets(_input_widgets.clone());
|
||||
_record_button.show();
|
||||
_stop_button.hide();
|
||||
let text_buffer = TextBuffer::new(None);
|
||||
text_buffer.set_text(&format!("{}", error));
|
||||
_error_message.set_buffer(Some(&text_buffer));
|
||||
_error_dialog.show();
|
||||
},
|
||||
}
|
||||
}
|
||||
if _audio_output_switch.is_active() {
|
||||
match _ffmpeg_record_interface.borrow_mut().start_output_audio() {
|
||||
Ok(_) => {
|
||||
// Do nothing
|
||||
},
|
||||
Err(error) => {
|
||||
enable_input_widgets(_input_widgets.clone());
|
||||
_record_button.show();
|
||||
_stop_button.hide();
|
||||
let text_buffer = TextBuffer::new(None);
|
||||
text_buffer.set_text(&format!("{}", error));
|
||||
_error_message.set_buffer(Some(&text_buffer));
|
||||
_error_dialog.show();
|
||||
},
|
||||
}
|
||||
}
|
||||
if _video_switch.is_active() {
|
||||
match _ffmpeg_record_interface.borrow_mut().start_video(
|
||||
_area_capture.x,
|
||||
_area_capture.y,
|
||||
_area_capture.width,
|
||||
_area_capture.height,
|
||||
mode
|
||||
) {
|
||||
Ok(_) => {
|
||||
// Do nothing
|
||||
},
|
||||
Err(error) => {
|
||||
enable_input_widgets(_input_widgets.clone());
|
||||
_record_button.show();
|
||||
_stop_button.hide();
|
||||
let text_buffer = TextBuffer::new(None);
|
||||
text_buffer.set_text(&format!("{}", error));
|
||||
_error_message.set_buffer(Some(&text_buffer));
|
||||
_error_dialog.show();
|
||||
},
|
||||
}
|
||||
}
|
||||
recording_delay(
|
||||
_delay_spin.clone(),
|
||||
_delay_spin.value() as u16,
|
||||
delay_window.clone(),
|
||||
_delay_window_button.clone(),
|
||||
delay_window_label.clone(),
|
||||
_record_button.clone(),
|
||||
second_click.clone(),
|
||||
);
|
||||
}
|
||||
} else if _delay_spin.value() as u16 == 0 && !is_wayland() {
|
||||
let _area_capture = area_capture.borrow_mut();
|
||||
disable_input_widgets(_input_widgets.clone());
|
||||
start_timer(record_time_label.clone());
|
||||
record_time_label.set_visible(true);
|
||||
if hide_switch.is_active() {
|
||||
_main_window.minimize();
|
||||
}
|
||||
_play_button.hide();
|
||||
_record_button.hide();
|
||||
_stop_button.show();
|
||||
if _audio_input_switch.is_active() {
|
||||
match _ffmpeg_record_interface.borrow_mut().start_input_audio() {
|
||||
Ok(_) => {
|
||||
// Do nothing
|
||||
},
|
||||
Err(error) => {
|
||||
enable_input_widgets(_input_widgets.clone());
|
||||
_record_button.show();
|
||||
_stop_button.hide();
|
||||
let text_buffer = TextBuffer::new(None);
|
||||
text_buffer.set_text(&format!("{}", error));
|
||||
_error_message.set_buffer(Some(&text_buffer));
|
||||
_error_dialog.show();
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
if _audio_output_switch.is_active() {
|
||||
match _ffmpeg_record_interface.borrow_mut().start_output_audio() {
|
||||
Ok(_) => {
|
||||
// Do nothing
|
||||
},
|
||||
Err(error) => {
|
||||
enable_input_widgets(_input_widgets.clone());
|
||||
_record_button.show();
|
||||
_stop_button.hide();
|
||||
let text_buffer = TextBuffer::new(None);
|
||||
text_buffer.set_text(&format!("{}", error));
|
||||
_error_message.set_buffer(Some(&text_buffer));
|
||||
_error_dialog.show();
|
||||
},
|
||||
}
|
||||
}
|
||||
if _video_switch.is_active() {
|
||||
match _ffmpeg_record_interface.borrow_mut().start_video(
|
||||
_area_capture.x,
|
||||
_area_capture.y,
|
||||
_area_capture.width,
|
||||
_area_capture.height,
|
||||
mode
|
||||
) {
|
||||
Ok(_) => {
|
||||
// Do nothing
|
||||
},
|
||||
Err(error) => {
|
||||
enable_input_widgets(_input_widgets.clone());
|
||||
_record_button.show();
|
||||
_stop_button.hide();
|
||||
let text_buffer = TextBuffer::new(None);
|
||||
text_buffer.set_text(&format!("{}", error));
|
||||
_error_message.set_buffer(Some(&text_buffer));
|
||||
_error_dialog.show();
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -1097,9 +1098,8 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
});
|
||||
|
||||
// Stop recording before close the application
|
||||
let mut _ffmpeg_record_interface = ffmpeg_record_interface.clone();
|
||||
main_window.connect_close_request(move |main_window| {
|
||||
_ffmpeg_record_interface.borrow_mut().kill().unwrap();
|
||||
ffmpeg_record_interface.borrow_mut().kill().unwrap();
|
||||
main_window.destroy();
|
||||
adw::gtk::Inhibit(true)
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user