update ui

This commit is contained in:
ochibani 2023-10-23 03:47:55 +02:00
parent 5af98f9508
commit 4e4756e88a
No known key found for this signature in database
GPG Key ID: 2C6B61CE0C704ED4
3 changed files with 43 additions and 2 deletions

View File

@ -380,6 +380,29 @@
</layout> </layout>
</object> </object>
</child> </child>
<child>
<object class="GtkCheckButton" id="hideswitch">
<property name="label" translatable="yes">checkbutton</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="active">False</property>
<layout>
<property name="column">0</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkSeparator" id="followmouse-separator">
<property name="visible">True</property>
<property name="opacity">0.0</property>
<layout>
<property name="column">1</property>
<property name="row">2</property>
</layout>
</object>
</child>
</object> </object>
</child> </child>
<child> <child>
@ -432,6 +455,16 @@
</layout> </layout>
</object> </object>
</child> </child>
<child>
<object class="GtkSeparator" id="delay-separator">
<property name="visible">True</property>
<property name="opacity">0.0</property>
<layout>
<property name="column">1</property>
<property name="row">2</property>
</layout>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>

View File

@ -53,7 +53,7 @@ fn default() {
set("default", "audiocheck", "1"); set("default", "audiocheck", "1");
set("default", "mousecheck", "1"); set("default", "mousecheck", "1");
set("default", "followmousecheck", "0"); set("default", "followmousecheck", "0");
set("default", "overwritecheck", "0"); set("default", "hidecheck", "0");
} }
fn merge_previous_version() -> Option<PathBuf> { fn merge_previous_version() -> Option<PathBuf> {

View File

@ -90,6 +90,7 @@ pub fn build_ui(application: &Application) {
let format_chooser_combobox: ComboBoxText = builder.object("comboboxtext1").unwrap(); let format_chooser_combobox: ComboBoxText = builder.object("comboboxtext1").unwrap();
let frames_label: Label = builder.object("frames_label").unwrap(); let frames_label: Label = builder.object("frames_label").unwrap();
let frames_spin: SpinButton = builder.object("frames").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 mouse_switch: CheckButton = builder.object("mouseswitch").unwrap();
let play_button: Button = builder.object("playbutton").unwrap(); let play_button: Button = builder.object("playbutton").unwrap();
let record_button: Button = builder.object("recordbutton").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"))); audio_switch.set_label(Some(&gettext("Record Audio")));
mouse_switch.set_label(Some(&gettext("Show Mouse"))); mouse_switch.set_label(Some(&gettext("Show Mouse")));
follow_mouse_switch.set_label(Some(&gettext("Follow 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")); video_switch.set_active(config_management::get_bool("default", "videocheck"));
audio_switch.set_active(config_management::get_bool("default", "audiocheck")); audio_switch.set_active(config_management::get_bool("default", "audiocheck"));
mouse_switch.set_active(config_management::get_bool("default", "mousecheck")); mouse_switch.set_active(config_management::get_bool("default", "mousecheck"));
follow_mouse_switch.set_active(config_management::get_bool("default", "followmousecheck")); 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 _video_switch = video_switch.clone();
let _audio_switch = audio_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| { follow_mouse_switch.connect_toggled(|switch: &CheckButton| {
config_management::set_bool("default", "followmousecheck", switch.is_active()); 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() { match dark_light::detect() {
// Dark mode // Dark mode
@ -521,7 +527,9 @@ pub fn build_ui(application: &Application) {
_ => { _ => {
start_timer(record_time_label.clone()); start_timer(record_time_label.clone());
record_time_label.set_visible(true); record_time_label.set_visible(true);
if hide_switch.is_active() {
_main_window.minimize(); _main_window.minimize();
}
_play_button.hide(); _play_button.hide();
_record_button.hide(); _record_button.hide();
_stop_button.show(); _stop_button.show();