From 68aea8349fe83fb71faab6d04ee1da947e35e559 Mon Sep 17 00:00:00 2001
From: ochibani <11yzyv86j@relay.firefox.com>
Date: Sun, 16 Jun 2024 08:24:23 +0200
Subject: [PATCH] gui update
---
interfaces/main.ui | 32 +++++----------------------
locales/ar.ftl | 8 +++----
locales/ar_YE.ftl | 8 +++----
locales/en.ftl | 4 ++--
locales/en_US.ftl | 4 ++--
src/config_management.rs | 22 ++++++++++---------
src/main.rs | 47 ++++++++++++++++++++++------------------
7 files changed, 56 insertions(+), 69 deletions(-)
diff --git a/interfaces/main.ui b/interfaces/main.ui
index e807bff..231cabc 100644
--- a/interfaces/main.ui
+++ b/interfaces/main.ui
@@ -7,18 +7,18 @@
blue-recorder
True
-
-
-
- True
- 0.0
-
- 1
- 2
-
-
-
diff --git a/locales/ar.ftl b/locales/ar.ftl
index 24b3e5e..e84bdb0 100644
--- a/locales/ar.ftl
+++ b/locales/ar.ftl
@@ -109,10 +109,10 @@ quality = الجودة:
record = سجل
# Record audio label
-record-audio = تسجيل الصوت
+record-audio = تسجيل صوت اللاقط
# Record speaker label
-record-speaker = تسجيل المكبر
+record-speaker = تسجيل صوت المكبر
# Record video label
record-video = تسجيل الصورة
@@ -138,7 +138,7 @@ website = الموقع
about-tooltip = ما يُستَحسَنُ أن تعلمه عن المسجل الأزرق
area-tooltip = يحدد المنطقة المُراد تسجيلها
audio-source-tooltip = لاختيار مدخل الصوت
-audio-tooltip = يسجل مع الصوت
+audio-tooltip = يسجل باستخدام مدخل الصوت
delay-tooltip = مُهلة قبل بدء التسجيل
folder-tooltip = لاختيار مكان التخزين
follow-mouse-tooltip = يميز مؤشر الفأرة عند التسجيل
@@ -149,7 +149,7 @@ mouse-tooltip = يظهر مؤشر الفأرة عند التسجيل
quality-tooltip = جودة التسجيل (CRF)
record-tooltip = يبدأ تسجيل الشاشة
screen-tooltip = يحدد الشاشة ليسجلها
-speaker-tooltip = تسجيل صوت المكبر
+speaker-tooltip = يسجل باستخدام مخرج الصوت
stop-tooltip = وقف تسجيل الشاشة
video-tooltip = يسجل الشاشة
wayland-tooltip = غير مدعوم في وايلاند
diff --git a/locales/ar_YE.ftl b/locales/ar_YE.ftl
index 24b3e5e..e84bdb0 100644
--- a/locales/ar_YE.ftl
+++ b/locales/ar_YE.ftl
@@ -109,10 +109,10 @@ quality = الجودة:
record = سجل
# Record audio label
-record-audio = تسجيل الصوت
+record-audio = تسجيل صوت اللاقط
# Record speaker label
-record-speaker = تسجيل المكبر
+record-speaker = تسجيل صوت المكبر
# Record video label
record-video = تسجيل الصورة
@@ -138,7 +138,7 @@ website = الموقع
about-tooltip = ما يُستَحسَنُ أن تعلمه عن المسجل الأزرق
area-tooltip = يحدد المنطقة المُراد تسجيلها
audio-source-tooltip = لاختيار مدخل الصوت
-audio-tooltip = يسجل مع الصوت
+audio-tooltip = يسجل باستخدام مدخل الصوت
delay-tooltip = مُهلة قبل بدء التسجيل
folder-tooltip = لاختيار مكان التخزين
follow-mouse-tooltip = يميز مؤشر الفأرة عند التسجيل
@@ -149,7 +149,7 @@ mouse-tooltip = يظهر مؤشر الفأرة عند التسجيل
quality-tooltip = جودة التسجيل (CRF)
record-tooltip = يبدأ تسجيل الشاشة
screen-tooltip = يحدد الشاشة ليسجلها
-speaker-tooltip = تسجيل صوت المكبر
+speaker-tooltip = يسجل باستخدام مخرج الصوت
stop-tooltip = وقف تسجيل الشاشة
video-tooltip = يسجل الشاشة
wayland-tooltip = غير مدعوم في وايلاند
diff --git a/locales/en.ftl b/locales/en.ftl
index c0f51ba..4091498 100644
--- a/locales/en.ftl
+++ b/locales/en.ftl
@@ -106,7 +106,7 @@ quality = Quality:
record = Record
# Record audio label
-record-audio = Record Audio
+record-audio = Record Mic
# Record speaker label
record-speaker = Record Speaker
@@ -135,7 +135,7 @@ website = Website
about-tooltip = Information about Blue Recorder
area-tooltip = Select area to record
audio-source-tooltip = Select audio source
-audio-tooltip = Audio recording
+audio-tooltip = Mic audio recording
delay-tooltip = Delay time before starting record
folder-tooltip = Select storage location
follow-mouse-tooltip = Highlight mouse
diff --git a/locales/en_US.ftl b/locales/en_US.ftl
index c0f51ba..4091498 100644
--- a/locales/en_US.ftl
+++ b/locales/en_US.ftl
@@ -106,7 +106,7 @@ quality = Quality:
record = Record
# Record audio label
-record-audio = Record Audio
+record-audio = Record Mic
# Record speaker label
record-speaker = Record Speaker
@@ -135,7 +135,7 @@ website = Website
about-tooltip = Information about Blue Recorder
area-tooltip = Select area to record
audio-source-tooltip = Select audio source
-audio-tooltip = Audio recording
+audio-tooltip = Mic audio recording
delay-tooltip = Delay time before starting record
folder-tooltip = Select storage location
follow-mouse-tooltip = Highlight mouse
diff --git a/src/config_management.rs b/src/config_management.rs
index 49eada4..b1b81e4 100755
--- a/src/config_management.rs
+++ b/src/config_management.rs
@@ -27,10 +27,12 @@ pub fn initialize() -> PathBuf {
}
fn default() {
+ for format in 0..7 {
+ set_default_quality(&format.to_string());
+ }
set("default", "frame", "60");
set("default", "delay", "0");
set("default", "format", "0");
- set("default", "quality", get_quality(&self::get("default", "format")));
set(
"default",
"folder",
@@ -129,16 +131,16 @@ pub fn folder_icon(folder_chooser_name: Option<&str>) -> &str {
}
}
-pub fn get_quality(format: &str) -> &str {
+pub fn set_default_quality(format: &str) -> bool {
let crf = match format {
- "0" => "23",
- "1" => "23",
- "2" => "10.0",
- "3" => "23",
- "4" => "23",
- "5" => "23",
- "6" => "23.0",
- _=> "23", // Default value
+ "0" => self::set("default", "quality-0", "23"),
+ "1" => self::set("default", "quality-1", "23"),
+ "2" => self::set("default", "quality-2", "10"),
+ "3" => self::set("default", "quality-3", "23"),
+ "4" => self::set("default", "quality-4", "23"),
+ "5" => self::set("default", "quality-5", "23"),
+ "6" => self::set("default", "quality-6", "23"),
+ _ => self::set("default", "quality-0", "23"), // Default value
};
crf
}
diff --git a/src/main.rs b/src/main.rs
index 4a4b13e..037eaf3 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -186,7 +186,7 @@ pub fn build_ui(application: &Application) {
.value().unwrap(), None, &mut vec![]).to_string());
format_chooser_combobox.append(Some("nut"), &bundle.format_pattern(bundle.get_message("nut-format").unwrap()
.value().unwrap(), None, &mut vec![]).to_string());
- //format_chooser_combobox.set_active(Some(config_management::get("default", "format").parse::().unwrap()));
+ format_chooser_combobox.set_active(Some(config_management::get("default", "format").parse::().unwrap()));
// Get audio sources
let input_device = host_audio_device.input_devices().unwrap();
@@ -407,29 +407,33 @@ pub fn build_ui(application: &Application) {
.parse::()
.unwrap(),
);
- //quality_spin.set_value(
- //config_management::get("default", "quality")
- //.parse::()
- //.unwrap(),
- //);
+ quality_spin.set_value(
+ config_management::get("default",
+ &format!
+ ("quality-{}",
+ &format_chooser_combobox.active().unwrap().to_string()))
+ .parse::()
+ .unwrap(),
+ );
let _format_chooser_combobox = format_chooser_combobox.clone();
let _quality_spin = quality_spin.clone();
format_chooser_combobox.connect_changed(move |_| {
+ let format_chooser_combobox = _format_chooser_combobox.clone();
if _format_chooser_combobox.active_text().is_some() {
config_management::set(
"default",
"format",
&_format_chooser_combobox.active().unwrap().to_string(),
);
- let quality_spin = _quality_spin.clone();
- _quality_spin.connect_value_changed(move |_| {
- config_management::set(
- "default",
- "quality",
- quality_spin.to_string().as_str(),
- );
- });
+ _quality_spin.set_value(
+ config_management::get("default",
+ &format!
+ ("quality-{}",
+ &format_chooser_combobox.active().unwrap().to_string()))
+ .parse::()
+ .unwrap(),
+ );
}
});
@@ -447,14 +451,15 @@ pub fn build_ui(application: &Application) {
"delay",
_delay_spin.value().to_string().as_str());
});
- let _quality_spin = delay_spin.to_owned();
+ let _quality_spin = quality_spin.to_owned();
+ let _format_chooser_combobox = format_chooser_combobox.clone();
quality_spin.connect_value_changed(move |_| {
- config_management::set(
- "default",
- "quality",
- _quality_spin.value().to_string().as_str(),
- );
- });
+ config_management::set("default",
+ &format!
+ ("quality-{}",
+ &_format_chooser_combobox.active().unwrap().to_string()),
+ _quality_spin.value().to_string().as_str());
+ });
// Labels
command_label.set_label(&bundle.format_pattern(bundle.get_message("run-command").unwrap()