mirror of
https://github.com/xlmnxp/blue-recorder.git
synced 2025-04-02 07:44:54 +03:00
update error messages
This commit is contained in:
parent
b176a065c8
commit
8be6dedec4
@ -154,7 +154,7 @@ impl Ffmpeg {
|
||||
if self.video_process.is_some() {
|
||||
self.video_process
|
||||
.clone()
|
||||
.ok_or_else(|| anyhow!("Not exiting the video recording process successfully"))?
|
||||
.ok_or_else(|| anyhow!("Not exiting the video recording process successfully."))?
|
||||
.borrow_mut()
|
||||
.quit()?;
|
||||
}
|
||||
@ -201,7 +201,7 @@ impl Ffmpeg {
|
||||
if self.input_audio_process.is_some() {
|
||||
self.input_audio_process
|
||||
.clone()
|
||||
.ok_or_else(|| anyhow!("Not exiting the input audio recording process successfully"))?
|
||||
.ok_or_else(|| anyhow!("Not exiting the input audio recording process successfully."))?
|
||||
.borrow_mut()
|
||||
.quit()?;
|
||||
}
|
||||
@ -241,7 +241,7 @@ impl Ffmpeg {
|
||||
if self.output_audio_process.is_some() {
|
||||
self.output_audio_process
|
||||
.clone()
|
||||
.ok_or_else(|| anyhow!("Not exiting the output audio recording process successfully"))?
|
||||
.ok_or_else(|| anyhow!("Not exiting the output audio recording process successfully."))?
|
||||
.borrow_mut()
|
||||
.quit()?;
|
||||
}
|
||||
@ -259,7 +259,7 @@ impl Ffmpeg {
|
||||
if is_valide(&self.temp_video_filename)? {
|
||||
break;
|
||||
} else if Instant::now().duration_since(start_time) >= duration {
|
||||
return Err(Error::msg("Unable to validate tmp video file"));
|
||||
return Err(Error::msg("Unable to validate tmp video file."));
|
||||
}
|
||||
}
|
||||
let mut ffmpeg_command = FfmpegCommand::new();
|
||||
@ -287,7 +287,7 @@ impl Ffmpeg {
|
||||
if is_valide(&self.temp_video_filename)? {
|
||||
break;
|
||||
} else if Instant::now().duration_since(start_time) >= duration {
|
||||
return Err(Error::msg("Unable to validate tmp video file"));
|
||||
return Err(Error::msg("Unable to validate tmp video file."));
|
||||
}
|
||||
}
|
||||
// Convert MP4 to GIF
|
||||
@ -306,7 +306,7 @@ impl Ffmpeg {
|
||||
if is_valide(&self.temp_input_audio_filename)? {
|
||||
break;
|
||||
} else if Instant::now().duration_since(start_time) >= duration {
|
||||
return Err(Error::msg("Unable to validate tmp video file"));
|
||||
return Err(Error::msg("Unable to validate tmp video file."));
|
||||
}
|
||||
}
|
||||
// If only audio is recording then convert it to chosen format
|
||||
@ -331,7 +331,7 @@ impl Ffmpeg {
|
||||
if is_valide(&self.temp_output_audio_filename)? {
|
||||
break;
|
||||
} else if Instant::now().duration_since(start_time) >= duration {
|
||||
return Err(Error::msg("Unable to validate tmp video file"));
|
||||
return Err(Error::msg("Unable to validate tmp video file."));
|
||||
}
|
||||
}
|
||||
// If only output audio is recording then convert it to chosen format
|
||||
|
@ -141,7 +141,7 @@ impl Ffmpeg {
|
||||
if self.video_process.is_some() {
|
||||
self.video_process
|
||||
.clone()
|
||||
.ok_or_else(|| anyhow!("Not exiting the video recording process successfully"))?
|
||||
.ok_or_else(|| anyhow!("Not exiting the video recording process successfully."))?
|
||||
.borrow_mut()
|
||||
.quit()?;
|
||||
}
|
||||
@ -188,7 +188,7 @@ impl Ffmpeg {
|
||||
if self.input_audio_process.is_some() {
|
||||
self.input_audio_process
|
||||
.clone()
|
||||
.ok_or_else(|| anyhow!("Not exiting the input audio recording process successfully"))?
|
||||
.ok_or_else(|| anyhow!("Not exiting the input audio recording process successfully."))?
|
||||
.borrow_mut()
|
||||
.quit()?;
|
||||
}
|
||||
@ -228,7 +228,7 @@ impl Ffmpeg {
|
||||
if self.output_audio_process.is_some() {
|
||||
self.output_audio_process
|
||||
.clone()
|
||||
.ok_or_else(|| anyhow!("Not exiting the output audio recording process successfully"))?
|
||||
.ok_or_else(|| anyhow!("Not exiting the output audio recording process successfully."))?
|
||||
.borrow_mut()
|
||||
.quit()?;
|
||||
}
|
||||
@ -246,7 +246,7 @@ impl Ffmpeg {
|
||||
if is_valide(&self.temp_video_filename)? {
|
||||
break;
|
||||
} else if Instant::now().duration_since(start_time) >= duration {
|
||||
return Err(Error::msg("Unable to validate tmp video file"));
|
||||
return Err(Error::msg("Unable to validate tmp video file."));
|
||||
}
|
||||
}
|
||||
let mut ffmpeg_command = FfmpegCommand::new();
|
||||
@ -274,7 +274,7 @@ impl Ffmpeg {
|
||||
if is_valide(&self.temp_video_filename)? {
|
||||
break;
|
||||
} else if Instant::now().duration_since(start_time) >= duration {
|
||||
return Err(Error::msg("Unable to validate tmp video file"));
|
||||
return Err(Error::msg("Unable to validate tmp video file."));
|
||||
}
|
||||
}
|
||||
// Convert MP4 to GIF
|
||||
@ -293,7 +293,7 @@ impl Ffmpeg {
|
||||
if is_valide(&self.temp_input_audio_filename)? {
|
||||
break;
|
||||
} else if Instant::now().duration_since(start_time) >= duration {
|
||||
return Err(Error::msg("Unable to validate tmp video file"));
|
||||
return Err(Error::msg("Unable to validate tmp video file."));
|
||||
}
|
||||
}
|
||||
// If only audio is recording then convert it to chosen format
|
||||
@ -318,7 +318,7 @@ impl Ffmpeg {
|
||||
if is_valide(&self.temp_output_audio_filename)? {
|
||||
break;
|
||||
} else if Instant::now().duration_since(start_time) >= duration {
|
||||
return Err(Error::msg("Unable to validate tmp video file"));
|
||||
return Err(Error::msg("Unable to validate tmp video file."));
|
||||
}
|
||||
}
|
||||
// If only output audio is recording then convert it to chosen format
|
||||
|
@ -125,33 +125,33 @@ impl AreaCapture {
|
||||
fn xwininfo_to_coordinate(xwininfo_output: String) -> Result<(u16, u16, u16, u16)> {
|
||||
let x: u16 = Regex::new(r"A.*X:\s+(\d+)\n")?
|
||||
.captures(xwininfo_output.as_str())
|
||||
.ok_or_else(|| anyhow!("failed to capture string from xwininfo_output"))?
|
||||
.ok_or_else(|| anyhow!("Failed to capture string from xwininfo_output."))?
|
||||
.get(1)
|
||||
.ok_or_else(|| anyhow!("failed to get x value from xwininfo_output"))?
|
||||
.ok_or_else(|| anyhow!("Failed to get x value from xwininfo_output."))?
|
||||
.as_str()
|
||||
.to_string()
|
||||
.parse::<u16>()?;
|
||||
let y: u16 = Regex::new(r"A.*Y:\s+(\d+)\n")?
|
||||
.captures(xwininfo_output.as_str())
|
||||
.ok_or_else(|| anyhow!("failed to capture string from xwininfo_output"))?
|
||||
.ok_or_else(|| anyhow!("Failed to capture string from xwininfo_output."))?
|
||||
.get(1)
|
||||
.ok_or_else(|| anyhow!("failed to get y value from xwininfo_output"))?
|
||||
.ok_or_else(|| anyhow!("Failed to get y value from xwininfo_output."))?
|
||||
.as_str()
|
||||
.to_string()
|
||||
.parse::<u16>()?;
|
||||
let width: u16 = Regex::new(r"Width:\s(\d+)\n")?
|
||||
.captures(xwininfo_output.as_str())
|
||||
.ok_or_else(|| anyhow!("failed to capture string from xwininfo_output"))?
|
||||
.ok_or_else(|| anyhow!("Failed to capture string from xwininfo_output."))?
|
||||
.get(1)
|
||||
.ok_or_else(|| anyhow!("failed to get width value from xwininfo_output"))?
|
||||
.ok_or_else(|| anyhow!("Failed to get width value from xwininfo_output."))?
|
||||
.as_str()
|
||||
.to_string()
|
||||
.parse::<u16>()?;
|
||||
let height: u16 = Regex::new(r"Height:\s(\d+)\n")?
|
||||
.captures(xwininfo_output.as_str())
|
||||
.ok_or_else(|| anyhow!("failed to capture string from xwininfo_output"))?
|
||||
.ok_or_else(|| anyhow!("Failed to capture string from xwininfo_output."))?
|
||||
.get(1)
|
||||
.ok_or_else(|| anyhow!("failed to get height value from xwininfo_output"))?
|
||||
.ok_or_else(|| anyhow!("Failed to get height value from xwininfo_output."))?
|
||||
.as_str()
|
||||
.to_string()
|
||||
.parse::<u16>()?;
|
||||
|
@ -524,7 +524,7 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
let text_buffer = TextBuffer::new(None);
|
||||
if response == libadwaita::gtk::ResponseType::Accept {
|
||||
if folder_chooser_native.file().is_none() {
|
||||
text_buffer.set_text("Failed to get save file path");
|
||||
text_buffer.set_text("Failed to get save file path.");
|
||||
error_message.set_buffer(Some(&text_buffer));
|
||||
error_dialog.show();
|
||||
}
|
||||
@ -572,7 +572,7 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
area_size_top_label.clone(),
|
||||
).is_err() {
|
||||
let text_buffer = TextBuffer::new(None);
|
||||
text_buffer.set_text("Failed to get area size value");
|
||||
text_buffer.set_text("Failed to get area size value.");
|
||||
_error_message.set_buffer(Some(&text_buffer));
|
||||
_error_dialog.show();
|
||||
}
|
||||
@ -591,7 +591,7 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
if _area_capture
|
||||
.borrow_mut()
|
||||
.get_active_window().is_err() {
|
||||
text_buffer.set_text("Failed to get area size value");
|
||||
text_buffer.set_text("Failed to get area size value.");
|
||||
_error_message.set_buffer(Some(&text_buffer));
|
||||
_error_dialog.show();
|
||||
}
|
||||
@ -599,7 +599,7 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
if _area_capture
|
||||
.borrow_mut()
|
||||
.get_window_by_name(_area_chooser_window.title().unwrap().as_str()).is_err() {
|
||||
text_buffer.set_text("Failed to get area size value");
|
||||
text_buffer.set_text("Failed to get area size value.");
|
||||
_error_message.set_buffer(Some(&text_buffer));
|
||||
_error_dialog.show();
|
||||
}
|
||||
@ -625,7 +625,7 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
screen_grab_button_record_window.replace(false);
|
||||
_area_chooser_window.hide();
|
||||
if _area_capture.borrow_mut().reset().is_err() {
|
||||
text_buffer.set_text("Failed to reset area_capture value");
|
||||
text_buffer.set_text("Failed to reset area_capture value.");
|
||||
_error_message.set_buffer(Some(&text_buffer));
|
||||
_error_dialog.show();
|
||||
}
|
||||
@ -662,7 +662,7 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
if clicked {
|
||||
_select_window.hide();
|
||||
if area_capture.borrow_mut().get_title().is_err() {
|
||||
text_buffer.set_text("Failed to get window info");
|
||||
text_buffer.set_text("Failed to get window info.");
|
||||
error_message.set_buffer(Some(&text_buffer));
|
||||
error_dialog.show();
|
||||
}
|
||||
@ -678,13 +678,23 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
#[cfg(any(target_os = "freebsd", target_os = "linux"))]
|
||||
{
|
||||
if _area_capture.borrow_mut().get_area().is_err() {
|
||||
text_buffer.set_text("Failed to get window info");
|
||||
text_buffer.set_text("Failed to get window info.");
|
||||
_error_message.set_buffer(Some(&text_buffer));
|
||||
_error_dialog.show();
|
||||
}
|
||||
}}
|
||||
});
|
||||
|
||||
// Record struct values
|
||||
let audio_input_id = audio_source_combobox
|
||||
.active_id()
|
||||
.ok_or_else(|| anyhow!("Failed to get audio_input_id value from audio_source_combobox."))?;
|
||||
let audio_output_id = output_device;
|
||||
let filename = String::from("");
|
||||
let output_file = Path::new(&filename)
|
||||
.extension()
|
||||
.ok_or_else(|| anyhow!("Failed to get output extension from filename."))?;
|
||||
|
||||
// Init record struct
|
||||
/*let ffmpeg_record_interface: Rc<RefCell<Ffmpeg>> = Rc::new(RefCell::new(Ffmpeg {
|
||||
audio_input_id: String::new(),
|
||||
|
Loading…
Reference in New Issue
Block a user