mirror of
https://github.com/xlmnxp/blue-recorder.git
synced 2025-04-02 07:44:54 +03:00
Compare commits
6 Commits
fcba5a7be8
...
d313eacd01
Author | SHA1 | Date | |
---|---|---|---|
|
d313eacd01 | ||
7f036c2049 | |||
58ed310a2b | |||
feeaf31e07 | |||
|
fd4f3cdaa9 | ||
|
c601747c79 |
1651
Cargo.lock
generated
1651
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
anyhow = "1.0.86"
|
||||
async-std = {version = "1.12.0", features = ["attributes"]}
|
||||
blue-recorder-core = { git = "https://github.com/ochibani/blue-recorder-core.git", rev = "fb3ff78" }
|
||||
blue-recorder-core = { git = "https://github.com/ochibani/blue-recorder-core.git", rev = "85c9d8f" }
|
||||
cpal = "0.15.3"
|
||||
dark-light = "1.0.0"
|
||||
dirs = "4.0.0"
|
||||
|
@ -423,7 +423,7 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="trayswitch">
|
||||
<object class="GtkCheckButton" id="areaswitch">
|
||||
<property name="label" translatable="yes">checkbutton</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
@ -437,9 +437,9 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="areaswitch">
|
||||
<object class="GtkCheckButton" id="trayswitch">
|
||||
<property name="label" translatable="yes">checkbutton</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="visible">False</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="active">True</property>
|
||||
|
@ -147,8 +147,8 @@ show-area = Show Area
|
||||
# Show mouse label
|
||||
show-mouse = إظهار مؤشر الفأرة
|
||||
|
||||
# Show tray icon
|
||||
show-tray = Show Tray
|
||||
# Minimize to tray icon
|
||||
tray-minimize = Minimize to tray
|
||||
|
||||
# Video bitrate label
|
||||
video-bitrate = B/Video:
|
||||
@ -173,9 +173,10 @@ video-bitrate-tooltip = Set video bitrate in KB/s
|
||||
record-tooltip = يبدأ تسجيل الشاشة
|
||||
screen-tooltip = يحدد الشاشة ليسجلها
|
||||
show-area-tooltip = Show selected area during record
|
||||
show-tray-tooltip = Show tray icon
|
||||
speaker-tooltip = Speakr sound recording
|
||||
stop-tooltip = وقف تسجيل الشاشة
|
||||
tray-minimize-tooltip = Minimize application to tray icon
|
||||
video-tooltip = يسجل الشاشة
|
||||
wayland-tooltip = غير مدعوم في وايلاند
|
||||
window-tooltip = يحدد نافذة ليسجلها
|
||||
windows-unsupported-tooltip = Not supported in windows platform
|
||||
|
@ -147,8 +147,8 @@ show-area = Show Area
|
||||
# Show mouse label
|
||||
show-mouse = إظهار مؤشر الفأرة
|
||||
|
||||
# Show tray icon
|
||||
show-tray = Show Tray
|
||||
# Minimize to tray icon
|
||||
tray-minimize = Minimize to tray
|
||||
|
||||
# Video bitrate label
|
||||
video-bitrate = B/Video:
|
||||
@ -173,9 +173,10 @@ video-bitrate-tooltip = Set video bitrate in KB/s
|
||||
record-tooltip = يبدأ تسجيل الشاشة
|
||||
screen-tooltip = يحدد الشاشة ليسجلها
|
||||
show-area-tooltip = Show selected area during record
|
||||
show-tray-tooltip = Show tray icon
|
||||
speaker-tooltip = Speakr sound recording
|
||||
stop-tooltip = وقف تسجيل الشاشة
|
||||
tray-minimize-tooltip = Minimize application to tray icon
|
||||
video-tooltip = يسجل الشاشة
|
||||
wayland-tooltip = غير مدعوم في وايلاند
|
||||
window-tooltip = يحدد نافذة ليسجلها
|
||||
windows-unsupported-tooltip = Not supported in windows platform
|
||||
|
@ -66,6 +66,9 @@ close = Close
|
||||
# Copy right
|
||||
copy-right = © 2021 Salem Yaslem
|
||||
|
||||
# Close error dialog
|
||||
close-error-dialog = Close
|
||||
|
||||
# Run command label
|
||||
default-command = Default command:
|
||||
|
||||
@ -81,12 +84,12 @@ delay-title = Start Recording in…
|
||||
# Stop delay timer
|
||||
delay-window-stop = Stop
|
||||
|
||||
# About message
|
||||
dialog-comment = A simple screen recorder for Linux desktop. Supports Wayland & Xorg.
|
||||
|
||||
# Details button
|
||||
details-button = Details
|
||||
|
||||
# About message
|
||||
dialog-comment = A simple screen recorder for Linux desktop. Supports Wayland & Xorg.
|
||||
|
||||
# Run command input
|
||||
enter-command = Enter your command here..
|
||||
|
||||
@ -144,8 +147,8 @@ show-area = Show Area
|
||||
# Show mouse label
|
||||
show-mouse = Show Mouse
|
||||
|
||||
# Show tray icon
|
||||
show-tray = Show Tray
|
||||
# Minimize to tray icon
|
||||
tray-minimize = Minimize to tray
|
||||
|
||||
# Video bitrate label
|
||||
video-bitrate = B/Video:
|
||||
@ -170,9 +173,10 @@ video-bitrate-tooltip = Set video bitrate in KB/s
|
||||
record-tooltip = Start screen record
|
||||
screen-tooltip = Select screen to record
|
||||
show-area-tooltip = Show selected area during record
|
||||
show-tray-tooltip = Show tray icon
|
||||
speaker-tooltip = Speakr sound recording
|
||||
stop-tooltip = Stop screen recording
|
||||
tray-minimize-tooltip = Minimize application to tray icon
|
||||
video-tooltip = Video recording
|
||||
wayland-tooltip = Not supported in Wayland
|
||||
window-tooltip = Select window to record
|
||||
windows-unsupported-tooltip = Not supported in windows platform
|
||||
|
@ -144,8 +144,8 @@ show-area = Show Area
|
||||
# Show mouse label
|
||||
show-mouse = Show Mouse
|
||||
|
||||
# Show tray icon
|
||||
show-tray = Show Tray
|
||||
# Minimize to tray icon
|
||||
tray-minimize = Minimize to tray
|
||||
|
||||
# Video bitrate label
|
||||
video-bitrate = B/Video:
|
||||
@ -170,9 +170,10 @@ video-bitrate-tooltip = Set video bitrate in KB/s
|
||||
record-tooltip = Start screen record
|
||||
screen-tooltip = Select screen to record
|
||||
show-area-tooltip = Show selected area during record
|
||||
show-tray-tooltip = Show tray icon
|
||||
speaker-tooltip = Speakr sound recording
|
||||
stop-tooltip = Stop screen recording
|
||||
tray-minimize-tooltip = Minimize application to tray icon
|
||||
video-tooltip = Video recording
|
||||
wayland-tooltip = Not supported in Wayland
|
||||
window-tooltip = Select window to record
|
||||
windows-unsupported-tooltip = Not supported in windows platform
|
||||
|
@ -10,8 +10,9 @@ pub fn get_bundle(message_id: &str, arg: Option<&FluentArgs>) -> String {
|
||||
current_exec_dir
|
||||
}.join(Path::new("locales"));
|
||||
if !ftl_path.exists() {
|
||||
let var = std::env::var("LC_DIR");
|
||||
ftl_path = std::fs::canonicalize(Path::new(
|
||||
&std::env::var("LC_DIR").unwrap_or_else(|_| String::from("locales")),
|
||||
&var.unwrap_or_else(|_| String::from("locales")),
|
||||
)).unwrap();
|
||||
}
|
||||
let supported_lang: Vec<String> = std::fs::read_dir(&ftl_path)
|
||||
@ -27,8 +28,9 @@ pub fn get_bundle(message_id: &str, arg: Option<&FluentArgs>) -> String {
|
||||
locale = String::from("en_US");
|
||||
}
|
||||
}
|
||||
let ftl_in_loacle = ftl_path.join(Path::new(&locale.split('.').next().unwrap()));
|
||||
let ftl_file = std::fs::read_to_string(
|
||||
format!("{}/{}.ftl", ftl_path.to_str().unwrap(),locale.split('.').next().unwrap())
|
||||
format!("{}.ftl", ftl_in_loacle.to_str().unwrap())
|
||||
).unwrap();
|
||||
let res = FluentResource::try_new(ftl_file).unwrap();
|
||||
let mut bundle = FluentBundle::default();
|
||||
|
47
src/ui.rs
47
src/ui.rs
@ -1,5 +1,8 @@
|
||||
use anyhow::{anyhow, Result};
|
||||
#[cfg(any(target_os = "freebsd", target_os = "linux"))]
|
||||
use blue_recorder_core::ffmpeg_linux::Ffmpeg;
|
||||
#[cfg(target_os = "windows")]
|
||||
use blue_recorder_core::ffmpeg_windows::Ffmpeg;
|
||||
use blue_recorder_core::utils::is_wayland;
|
||||
use cpal::traits::{DeviceTrait, HostTrait};
|
||||
use libadwaita::{Application, Window};
|
||||
@ -12,7 +15,7 @@ use std::ops::Add;
|
||||
use std::path::Path;
|
||||
use std::rc::Rc;
|
||||
|
||||
use crate::{area_capture, config_management, fluent::get_bundle};
|
||||
use crate::{/*area_capture,*/ config_management, fluent::get_bundle};
|
||||
use crate::timer::{recording_delay, start_timer, stop_timer};
|
||||
|
||||
pub fn run_ui(application: &Application) {
|
||||
@ -167,7 +170,7 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
format_chooser_combobox.append(Some("avi"), &get_bundle("avi-format", None));
|
||||
format_chooser_combobox.append(Some("wmv"), &get_bundle("wmv-format", None));
|
||||
format_chooser_combobox.append(Some("nut"), &get_bundle("nut-format", None));
|
||||
format_chooser_combobox.set_active(Some(config_management::get("default", "format").parse::<u32>().unwrap()));
|
||||
format_chooser_combobox.set_active(Some(config_management::get("default", "format").parse::<u32>().unwrap_or(0u32)));
|
||||
|
||||
// Get audio sources
|
||||
let input_device = host_audio_device.input_devices().unwrap();
|
||||
@ -196,7 +199,7 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
hide_switch.set_label(Some(&get_bundle("auto-hide", None)));
|
||||
mouse_switch.set_label(Some(&get_bundle("show-mouse", None)));
|
||||
speaker_switch.set_label(Some(&get_bundle("record-speaker", None)));
|
||||
tray_switch.set_label(Some(&get_bundle("show-tray", None)));
|
||||
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)));
|
||||
@ -204,7 +207,7 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
hide_switch.set_tooltip_text(Some(&get_bundle("hide-tooltip", None)));
|
||||
mouse_switch.set_tooltip_text(Some(&get_bundle("mouse-tooltip", None)));
|
||||
speaker_switch.set_tooltip_text(Some(&get_bundle("speaker-tooltip", None)));
|
||||
tray_switch.set_tooltip_text(Some(&get_bundle("show-tray-tooltip", None)));
|
||||
tray_switch.set_tooltip_text(Some(&get_bundle("tray-minimize-tooltip", None)));
|
||||
video_switch.set_tooltip_text(Some(&get_bundle("video-tooltip", None)));
|
||||
|
||||
let _mouse_switch = mouse_switch.clone();
|
||||
@ -370,17 +373,17 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
("frame-{}",
|
||||
&format_chooser_combobox.active().unwrap().to_string()))
|
||||
.parse::<f64>()
|
||||
.unwrap(),
|
||||
.unwrap_or(0f64),
|
||||
);
|
||||
audio_bitrate_spin.set_value(
|
||||
config_management::get("default", "audiobitrate")
|
||||
.parse::<f64>()
|
||||
.unwrap(),
|
||||
.unwrap_or(0f64),
|
||||
);
|
||||
delay_spin.set_value(
|
||||
config_management::get("default", "delay")
|
||||
.parse::<f64>()
|
||||
.unwrap(),
|
||||
.unwrap_or(0f64),
|
||||
);
|
||||
video_bitrate_spin.set_value(
|
||||
config_management::get("default",
|
||||
@ -388,7 +391,7 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
("videobitrate-{}",
|
||||
&format_chooser_combobox.active().unwrap().to_string()))
|
||||
.parse::<f64>()
|
||||
.unwrap(),
|
||||
.unwrap_or(0f64),
|
||||
);
|
||||
|
||||
let _format_chooser_combobox = format_chooser_combobox.clone();
|
||||
@ -408,7 +411,7 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
("frame-{}",
|
||||
&format_chooser_combobox.active().unwrap().to_string()))
|
||||
.parse::<f64>()
|
||||
.unwrap(),
|
||||
.unwrap_or(0f64),
|
||||
);
|
||||
_video_bitrate_spin.set_value(
|
||||
config_management::get("default",
|
||||
@ -416,7 +419,7 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
("videobitrate-{}",
|
||||
&format_chooser_combobox.active().unwrap().to_string()))
|
||||
.parse::<f64>()
|
||||
.unwrap(),
|
||||
.unwrap_or(0f64),
|
||||
);
|
||||
}
|
||||
});
|
||||
@ -526,12 +529,12 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
});
|
||||
|
||||
// Buttons
|
||||
let area_capture: Rc<RefCell<area_capture::AreaCapture>> =
|
||||
Rc::new(RefCell::new(area_capture::AreaCapture::new()?));
|
||||
//let area_capture: Rc<RefCell<area_capture::AreaCapture>> =
|
||||
//Rc::new(RefCell::new(area_capture::AreaCapture::new()?));
|
||||
|
||||
area_grab_label.set_label(&get_bundle("select-area", None));
|
||||
let _area_chooser_window = area_chooser_window.clone();
|
||||
let mut _area_capture = area_capture.clone();
|
||||
//let mut _area_capture = area_capture.clone();
|
||||
let _area_switch = area_switch.clone();
|
||||
area_grab_button.connect_clicked(move |_| {
|
||||
config_management::set("default", "mode", "area");
|
||||
@ -542,23 +545,23 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
|
||||
area_apply_label.set_label(&get_bundle("apply", None));
|
||||
let _area_chooser_window = area_chooser_window.clone();
|
||||
let mut _area_capture = area_capture.clone();
|
||||
//let mut _area_capture = area_capture.clone();
|
||||
let _error_dialog = error_dialog.clone();
|
||||
let _error_message = error_message.clone();
|
||||
area_set_button.connect_clicked(move |_| {
|
||||
let text_buffer = TextBuffer::new(None);
|
||||
if _area_capture
|
||||
/*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");
|
||||
_error_message.set_buffer(Some(&text_buffer));
|
||||
_error_dialog.show();
|
||||
}
|
||||
}*/
|
||||
_area_chooser_window.hide();
|
||||
});
|
||||
|
||||
let _area_chooser_window = area_chooser_window.clone();
|
||||
let mut _area_capture = area_capture.clone();
|
||||
//let mut _area_capture = area_capture.clone();
|
||||
let _area_switch = area_switch.clone();
|
||||
let _error_dialog = error_dialog.clone();
|
||||
let _error_message = error_message.clone();
|
||||
@ -575,15 +578,15 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
config_management::set("default", "mode", "screen");
|
||||
screen_grab_button_record_window.replace(false);
|
||||
_area_chooser_window.hide();
|
||||
if _area_capture.borrow_mut().reset().is_err() {
|
||||
/*if _area_capture.borrow_mut().reset().is_err() {
|
||||
text_buffer.set_text("failed to get reset area_capture value");
|
||||
_error_message.set_buffer(Some(&text_buffer));
|
||||
_error_dialog.show();
|
||||
}
|
||||
}*/
|
||||
});
|
||||
|
||||
let _area_chooser_window: Window = area_chooser_window.clone();
|
||||
let mut _area_capture: Rc<RefCell<area_capture::AreaCapture>> = area_capture.clone();
|
||||
//let mut _area_capture: Rc<RefCell<area_capture::AreaCapture>> = area_capture.clone();
|
||||
let _area_switch = area_switch.clone();
|
||||
let _error_dialog = error_dialog.clone();
|
||||
let _error_message = error_message.clone();
|
||||
@ -599,11 +602,11 @@ fn build_ui(application: &Application, error_dialog: MessageDialog, error_messag
|
||||
if is_wayland() {
|
||||
window_grab_button_record_window.replace(true);
|
||||
} else {
|
||||
if _area_capture.borrow_mut().get_area().is_err() {
|
||||
/*if _area_capture.borrow_mut().get_area().is_err() {
|
||||
text_buffer.set_text("failed to get window size value");
|
||||
_error_message.set_buffer(Some(&text_buffer));
|
||||
_error_dialog.show();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user