From 35f13bb0ac5103fe16be081fa59089082e06ecd8 Mon Sep 17 00:00:00 2001 From: mkrsym1 Date: Thu, 28 Dec 2023 00:13:42 +0200 Subject: [PATCH] feat(ui): adapted to the new FPS unlocker --- src/ui/preferences/enhancements/mod.rs | 68 ++++---------------------- 1 file changed, 9 insertions(+), 59 deletions(-) diff --git a/src/ui/preferences/enhancements/mod.rs b/src/ui/preferences/enhancements/mod.rs index f55cb96..8013cd4 100644 --- a/src/ui/preferences/enhancements/mod.rs +++ b/src/ui/preferences/enhancements/mod.rs @@ -603,18 +603,18 @@ impl SimpleAsyncComponent for EnhancementsApp { }, adw::ActionRow { - set_title: &tr!("power-saving"), - set_subtitle: &tr!("power-saving-description"), + set_title: &tr!("periodic-unlock"), + set_subtitle: &tr!("periodic-unlock-description"), add_suffix = >k::Switch { set_valign: gtk::Align::Center, - set_state: CONFIG.game.enhancements.fps_unlocker.config.power_saving, + set_state: CONFIG.game.enhancements.fps_unlocker.config.periodic_writes, connect_state_notify => |switch| { if is_ready() { if let Ok(mut config) = Config::get() { - config.game.enhancements.fps_unlocker.config.power_saving = switch.state(); + config.game.enhancements.fps_unlocker.config.periodic_writes = switch.state(); Config::update(config); } @@ -624,19 +624,19 @@ impl SimpleAsyncComponent for EnhancementsApp { }, adw::ActionRow { - set_title: &tr!("monitor"), - set_subtitle: &tr!("monitor-description"), + set_title: &tr!("unlock-interval"), + set_subtitle: &tr!("unlock-interval-description"), add_suffix = >k::SpinButton { set_valign: gtk::Align::Center, - set_adjustment: >k::Adjustment::new(1.0, 1.0, 10.0, 1.0, 1.0, 0.0), + set_adjustment: >k::Adjustment::new(1.0, 1000.0, 60000.0, 1000.0, 1.0, 0.0), - set_value: CONFIG.game.enhancements.fps_unlocker.config.monitor as f64, + set_value: CONFIG.game.enhancements.fps_unlocker.config.interval as f64, connect_changed => |row| { if is_ready() { if let Ok(mut config) = Config::get() { - config.game.enhancements.fps_unlocker.config.monitor = row.value() as u64; + config.game.enhancements.fps_unlocker.config.interval = row.value() as u64; Config::update(config); } @@ -644,56 +644,6 @@ impl SimpleAsyncComponent for EnhancementsApp { } } }, - - adw::ComboRow { - set_title: &tr!("window-mode"), - - #[wrap(Some)] - set_model = >k::StringList::new(&[ - &tr!("default"), - &tr!("popup"), - &tr!("fullscreen") - ]), - - set_selected: CONFIG.game.enhancements.fps_unlocker.config.window_mode.ordinal() as u32, - - connect_selected_notify => |row| unsafe { - if is_ready() { - if let Ok(mut config) = Config::get() { - config.game.enhancements.fps_unlocker.config.window_mode = WindowMode::from_ordinal_unsafe(row.selected() as i8); - - Config::update(config); - } - } - } - }, - - adw::ComboRow { - set_title: &tr!("priority"), - set_subtitle: &tr!("priority-description"), - - #[wrap(Some)] - set_model = >k::StringList::new(&[ - &tr!("realtime"), - &tr!("high"), - &tr!("above-normal"), - &tr!("normal"), - &tr!("below-normal"), - &tr!("low") - ]), - - set_selected: CONFIG.game.enhancements.fps_unlocker.config.priority as u32, - - connect_selected_notify => |row| { - if is_ready() { - if let Ok(mut config) = Config::get() { - config.game.enhancements.fps_unlocker.config.priority = row.selected() as u64; - - Config::update(config); - } - } - } - }, } },