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,
prefix: PathBuf,
game: PathBuf,
fps_unlocker: PathBuf,
components: PathBuf,
patch: PathBuf,
temp: PathBuf
@ -31,6 +32,7 @@ pub enum Folders {
DXVK,
Prefix,
Game,
FpsUnlocker,
Components,
Patch,
Temp
@ -147,6 +149,17 @@ impl SimpleAsyncComponent for DefaultPathsApp {
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 {
set_title: &tr("components-index"),
set_icon_name: Some("folder-symbolic"),
@ -221,6 +234,7 @@ impl SimpleAsyncComponent for DefaultPathsApp {
dxvks: CONFIG.game.dxvk.builds.clone(),
prefix: CONFIG.game.wine.prefix.clone(),
game: CONFIG.game.path.clone(),
fps_unlocker: CONFIG.game.enhancements.fps_unlocker.path.clone(),
components: CONFIG.components.path.clone(),
patch: CONFIG.patch.path.clone(),
@ -247,24 +261,26 @@ impl SimpleAsyncComponent for DefaultPathsApp {
match folder {
Folders::Launcher => {
self.runners = result.join("runners");
self.dxvks = result.join("dxvks");
self.prefix = result.join("game");
self.game = result.join("game/drive_c/Program Files/Genshin Impact");
self.components = result.join("components");
self.patch = result.join("patch");
self.temp = result.join("temp");
self.runners = result.join("runners");
self.dxvks = result.join("dxvks");
self.prefix = result.join("game");
self.game = result.join("game/drive_c/Program Files/Genshin Impact");
self.fps_unlocker = result.join("fps-unlocker");
self.components = result.join("components");
self.patch = result.join("patch");
self.temp = result.join("temp");
self.launcher = result;
}
Folders::Runners => self.runners = result,
Folders::DXVK => self.dxvks = result,
Folders::Prefix => self.prefix = result,
Folders::Game => self.game = result,
Folders::Components => self.components = result,
Folders::Patch => self.patch = result,
Folders::Temp => self.temp = result
Folders::Runners => self.runners = result,
Folders::DXVK => self.dxvks = result,
Folders::Prefix => self.prefix = result,
Folders::Game => self.game = result,
Folders::FpsUnlocker => self.fps_unlocker = result,
Folders::Components => self.components = result,
Folders::Patch => self.patch = result,
Folders::Temp => self.temp = result
}
}
}
@ -298,6 +314,8 @@ impl DefaultPathsApp {
config.patch.path = self.patch.clone();
config.launcher.temp = Some(self.temp.clone());
config.game.enhancements.fps_unlocker.path = self.fps_unlocker.clone();
config::update_raw(config)
}
}