From 4e4756e88a83dc76bad0eedad7e723e13e63849a Mon Sep 17 00:00:00 2001 From: ochibani <11yzyv86j@relay.firefox.com> Date: Mon, 23 Oct 2023 03:47:55 +0200 Subject: [PATCH] update ui --- interfaces/main.ui | 33 +++++++++++++++++++++++++++++++++ src/config_management.rs | 2 +- src/main.rs | 10 +++++++++- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/interfaces/main.ui b/interfaces/main.ui index c0a4d6c..7ad36df 100644 --- a/interfaces/main.ui +++ b/interfaces/main.ui @@ -380,6 +380,29 @@ + + + checkbutton + True + True + False + False + + 0 + 2 + + + + + + True + 0.0 + + 1 + 2 + + + @@ -432,6 +455,16 @@ + + + True + 0.0 + + 1 + 2 + + + diff --git a/src/config_management.rs b/src/config_management.rs index 57fdd73..bc81d18 100755 --- a/src/config_management.rs +++ b/src/config_management.rs @@ -53,7 +53,7 @@ fn default() { set("default", "audiocheck", "1"); set("default", "mousecheck", "1"); set("default", "followmousecheck", "0"); - set("default", "overwritecheck", "0"); + set("default", "hidecheck", "0"); } fn merge_previous_version() -> Option { diff --git a/src/main.rs b/src/main.rs index 42313a5..ce4eb3c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -90,6 +90,7 @@ pub fn build_ui(application: &Application) { let format_chooser_combobox: ComboBoxText = builder.object("comboboxtext1").unwrap(); let frames_label: Label = builder.object("frames_label").unwrap(); let frames_spin: SpinButton = builder.object("frames").unwrap(); + let hide_switch: CheckButton = builder.object("hideswitch").unwrap(); let mouse_switch: CheckButton = builder.object("mouseswitch").unwrap(); let play_button: Button = builder.object("playbutton").unwrap(); let record_button: Button = builder.object("recordbutton").unwrap(); @@ -181,10 +182,12 @@ pub fn build_ui(application: &Application) { audio_switch.set_label(Some(&gettext("Record Audio"))); mouse_switch.set_label(Some(&gettext("Show Mouse"))); follow_mouse_switch.set_label(Some(&gettext("Follow Mouse"))); + hide_switch.set_label(Some(&gettext("Auto Hide"))); video_switch.set_active(config_management::get_bool("default", "videocheck")); audio_switch.set_active(config_management::get_bool("default", "audiocheck")); mouse_switch.set_active(config_management::get_bool("default", "mousecheck")); follow_mouse_switch.set_active(config_management::get_bool("default", "followmousecheck")); + hide_switch.set_active(config_management::get_bool("default", "hidecheck")); let _video_switch = video_switch.clone(); let _audio_switch = audio_switch.clone(); @@ -223,6 +226,9 @@ pub fn build_ui(application: &Application) { follow_mouse_switch.connect_toggled(|switch: &CheckButton| { config_management::set_bool("default", "followmousecheck", switch.is_active()); }); + hide_switch.connect_toggled(|switch: &CheckButton| { + config_management::set_bool("default", "hidecheck", switch.is_active()); + }); match dark_light::detect() { // Dark mode @@ -521,7 +527,9 @@ pub fn build_ui(application: &Application) { _ => { start_timer(record_time_label.clone()); record_time_label.set_visible(true); - _main_window.minimize(); + if hide_switch.is_active() { + _main_window.minimize(); + } _play_button.hide(); _record_button.hide(); _stop_button.show();