feat(ui): added fps unlocker path chooser in initial setup

This commit is contained in:
Observer KRypt0n_ 2023-03-15 17:36:35 +02:00
parent ab2bad953e
commit 7d46f9b6ab

View file

@ -19,6 +19,7 @@ pub struct DefaultPathsApp {
dxvks: PathBuf, dxvks: PathBuf,
prefix: PathBuf, prefix: PathBuf,
game: PathBuf, game: PathBuf,
fps_unlocker: PathBuf,
components: PathBuf, components: PathBuf,
patch: PathBuf, patch: PathBuf,
temp: PathBuf temp: PathBuf
@ -31,6 +32,7 @@ pub enum Folders {
DXVK, DXVK,
Prefix, Prefix,
Game, Game,
FpsUnlocker,
Components, Components,
Patch, Patch,
Temp Temp
@ -147,6 +149,17 @@ impl SimpleAsyncComponent for DefaultPathsApp {
connect_activated => DefaultPathsAppMsg::ChoosePath(Folders::Game) connect_activated => DefaultPathsAppMsg::ChoosePath(Folders::Game)
}, },
adw::ActionRow {
set_title: &tr("fps-unlocker-folder"),
set_icon_name: Some("folder-symbolic"),
set_activatable: true,
#[watch]
set_subtitle: model.components.to_str().unwrap(),
connect_activated => DefaultPathsAppMsg::ChoosePath(Folders::FpsUnlocker)
},
adw::ActionRow { adw::ActionRow {
set_title: &tr("components-index"), set_title: &tr("components-index"),
set_icon_name: Some("folder-symbolic"), set_icon_name: Some("folder-symbolic"),
@ -221,6 +234,7 @@ impl SimpleAsyncComponent for DefaultPathsApp {
dxvks: CONFIG.game.dxvk.builds.clone(), dxvks: CONFIG.game.dxvk.builds.clone(),
prefix: CONFIG.game.wine.prefix.clone(), prefix: CONFIG.game.wine.prefix.clone(),
game: CONFIG.game.path.clone(), game: CONFIG.game.path.clone(),
fps_unlocker: CONFIG.game.enhancements.fps_unlocker.path.clone(),
components: CONFIG.components.path.clone(), components: CONFIG.components.path.clone(),
patch: CONFIG.patch.path.clone(), patch: CONFIG.patch.path.clone(),
@ -247,24 +261,26 @@ impl SimpleAsyncComponent for DefaultPathsApp {
match folder { match folder {
Folders::Launcher => { Folders::Launcher => {
self.runners = result.join("runners"); self.runners = result.join("runners");
self.dxvks = result.join("dxvks"); self.dxvks = result.join("dxvks");
self.prefix = result.join("game"); self.prefix = result.join("game");
self.game = result.join("game/drive_c/Program Files/Genshin Impact"); self.game = result.join("game/drive_c/Program Files/Genshin Impact");
self.components = result.join("components"); self.fps_unlocker = result.join("fps-unlocker");
self.patch = result.join("patch"); self.components = result.join("components");
self.temp = result.join("temp"); self.patch = result.join("patch");
self.temp = result.join("temp");
self.launcher = result; self.launcher = result;
} }
Folders::Runners => self.runners = result, Folders::Runners => self.runners = result,
Folders::DXVK => self.dxvks = result, Folders::DXVK => self.dxvks = result,
Folders::Prefix => self.prefix = result, Folders::Prefix => self.prefix = result,
Folders::Game => self.game = result, Folders::Game => self.game = result,
Folders::Components => self.components = result, Folders::FpsUnlocker => self.fps_unlocker = result,
Folders::Patch => self.patch = result, Folders::Components => self.components = result,
Folders::Temp => self.temp = result Folders::Patch => self.patch = result,
Folders::Temp => self.temp = result
} }
} }
} }
@ -298,6 +314,8 @@ impl DefaultPathsApp {
config.patch.path = self.patch.clone(); config.patch.path = self.patch.clone();
config.launcher.temp = Some(self.temp.clone()); config.launcher.temp = Some(self.temp.clone());
config.game.enhancements.fps_unlocker.path = self.fps_unlocker.clone();
config::update_raw(config) config::update_raw(config)
} }
} }