feat: added wine tools to settings
This commit is contained in:
parent
567df16610
commit
f777963548
4 changed files with 83 additions and 7 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -86,8 +86,8 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anime-launcher-sdk"
|
name = "anime-launcher-sdk"
|
||||||
version = "0.5.13"
|
version = "0.5.14"
|
||||||
source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=0.5.13#66a80e5f5906b1cfc1b9716a4448dd03cf854ae8"
|
source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=0.5.14#98de4c7d707ed7428257953526625e8f168f7d84"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anime-game-core",
|
"anime-game-core",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
@ -1718,9 +1718,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "open"
|
name = "open"
|
||||||
version = "4.0.0"
|
version = "4.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bd61e3bf9d78956c72ee864bba52431f7f43994b21a17e9e72596a81bd61075b"
|
checksum = "075c5203b3a2b698bc72c6c10b1f6263182135751d5013ea66e8a4b3d0562a43"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pathdiff",
|
"pathdiff",
|
||||||
]
|
]
|
||||||
|
|
|
@ -17,7 +17,7 @@ glib-build-tools = "0.17"
|
||||||
|
|
||||||
[dependencies.anime-launcher-sdk]
|
[dependencies.anime-launcher-sdk]
|
||||||
git = "https://github.com/an-anime-team/anime-launcher-sdk"
|
git = "https://github.com/an-anime-team/anime-launcher-sdk"
|
||||||
tag = "0.5.13"
|
tag = "0.5.14"
|
||||||
|
|
||||||
# path = "../anime-launcher-sdk" # ! for dev purposes only
|
# path = "../anime-launcher-sdk" # ! for dev purposes only
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@ tag = "0.5.13"
|
||||||
relm4 = { version = "0.6.0-alpha.2", features = ["macros", "libadwaita"] }
|
relm4 = { version = "0.6.0-alpha.2", features = ["macros", "libadwaita"] }
|
||||||
gtk = { package = "gtk4", version = "0.6", features = ["v4_8"] }
|
gtk = { package = "gtk4", version = "0.6", features = ["v4_8"] }
|
||||||
adw = { package = "libadwaita", version = "0.3", features = ["v1_2"] }
|
adw = { package = "libadwaita", version = "0.3", features = ["v1_2"] }
|
||||||
|
|
||||||
rfd = { version = "0.11", features = ["xdg-portal"], default-features = false }
|
rfd = { version = "0.11", features = ["xdg-portal"], default-features = false }
|
||||||
open = "4.0.0"
|
open = "4.0"
|
||||||
|
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
tracing-subscriber = "0.3"
|
tracing-subscriber = "0.3"
|
||||||
|
|
|
@ -6,6 +6,8 @@ debug-file-opening-error = Failed to open debug file
|
||||||
wish-url-search-failed = No wishes url found
|
wish-url-search-failed = No wishes url found
|
||||||
wish-url-opening-error = Could not open wishes url
|
wish-url-opening-error = Could not open wishes url
|
||||||
|
|
||||||
|
wine-run-error = Failed to run {$executable} executable using wine
|
||||||
|
|
||||||
game-launching-failed = Failed to launch game
|
game-launching-failed = Failed to launch game
|
||||||
failed-get-selected-wine = Failed to get selected wine version
|
failed-get-selected-wine = Failed to get selected wine version
|
||||||
downloading-failed = Downloading failed
|
downloading-failed = Downloading failed
|
||||||
|
|
|
@ -152,6 +152,7 @@ pub enum GeneralAppMsg {
|
||||||
|
|
||||||
OpenMigrateInstallation,
|
OpenMigrateInstallation,
|
||||||
RepairGame,
|
RepairGame,
|
||||||
|
WineOpen(&'static [&'static str]),
|
||||||
|
|
||||||
UpdateLauncherStyle(LauncherStyle),
|
UpdateLauncherStyle(LauncherStyle),
|
||||||
|
|
||||||
|
@ -696,6 +697,57 @@ impl SimpleAsyncComponent for GeneralApp {
|
||||||
add = model.wine_components.widget(),
|
add = model.wine_components.widget(),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
add = &adw::PreferencesGroup {
|
||||||
|
adw::ExpanderRow {
|
||||||
|
set_title: "Wine tools",
|
||||||
|
|
||||||
|
add_row = &adw::ActionRow {
|
||||||
|
set_title: "Command line",
|
||||||
|
set_subtitle: "start cmd",
|
||||||
|
|
||||||
|
set_activatable: true,
|
||||||
|
|
||||||
|
connect_activated => GeneralAppMsg::WineOpen(&["start", "cmd"])
|
||||||
|
},
|
||||||
|
|
||||||
|
add_row = &adw::ActionRow {
|
||||||
|
set_title: "Registry editor",
|
||||||
|
set_subtitle: "regedit",
|
||||||
|
|
||||||
|
set_activatable: true,
|
||||||
|
|
||||||
|
connect_activated => GeneralAppMsg::WineOpen(&["regedit"])
|
||||||
|
},
|
||||||
|
|
||||||
|
add_row = &adw::ActionRow {
|
||||||
|
set_title: "Explorer",
|
||||||
|
set_subtitle: "explorer",
|
||||||
|
|
||||||
|
set_activatable: true,
|
||||||
|
|
||||||
|
connect_activated => GeneralAppMsg::WineOpen(&["explorer"])
|
||||||
|
},
|
||||||
|
|
||||||
|
add_row = &adw::ActionRow {
|
||||||
|
set_title: "Task manager",
|
||||||
|
set_subtitle: "taskmgr",
|
||||||
|
|
||||||
|
set_activatable: true,
|
||||||
|
|
||||||
|
connect_activated => GeneralAppMsg::WineOpen(&["taskmgr"])
|
||||||
|
},
|
||||||
|
|
||||||
|
add_row = &adw::ActionRow {
|
||||||
|
set_title: "Configuration",
|
||||||
|
set_subtitle: "winecfg",
|
||||||
|
|
||||||
|
set_activatable: true,
|
||||||
|
|
||||||
|
connect_activated => GeneralAppMsg::WineOpen(&["winecfg"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
add = &adw::PreferencesGroup {
|
add = &adw::PreferencesGroup {
|
||||||
set_title: &tr("dxvk-version"),
|
set_title: &tr("dxvk-version"),
|
||||||
|
|
||||||
|
@ -968,6 +1020,27 @@ impl SimpleAsyncComponent for GeneralApp {
|
||||||
sender.output(Self::Output::RepairGame);
|
sender.output(Self::Output::RepairGame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GeneralAppMsg::WineOpen(executable) => {
|
||||||
|
let config = config::get().unwrap_or_else(|_| CONFIG.clone());
|
||||||
|
|
||||||
|
if let Ok(Some(wine)) = config.get_selected_wine() {
|
||||||
|
let result = wine.to_wine(config.components.path, Some(config.game.wine.builds.join(&wine.name)))
|
||||||
|
.with_prefix(config.game.wine.prefix)
|
||||||
|
.run_args(executable);
|
||||||
|
|
||||||
|
if let Err(err) = result {
|
||||||
|
sender.input(GeneralAppMsg::Toast {
|
||||||
|
title: tr_args("wine-run-error", [
|
||||||
|
("executable", executable.join(" ").into())
|
||||||
|
]),
|
||||||
|
description: Some(err.to_string())
|
||||||
|
});
|
||||||
|
|
||||||
|
tracing::error!("Failed to run {:?} using wine: {err}", executable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(unused_must_use)]
|
#[allow(unused_must_use)]
|
||||||
GeneralAppMsg::UpdateLauncherStyle(style) => {
|
GeneralAppMsg::UpdateLauncherStyle(style) => {
|
||||||
if style == LauncherStyle::Classic && !KEEP_BACKGROUND_FILE.exists() {
|
if style == LauncherStyle::Classic && !KEEP_BACKGROUND_FILE.exists() {
|
||||||
|
|
Loading…
Reference in a new issue