mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-11-24 22:06:18 +03:00
feat(ui): utilized new recommended
feature for wine / dxvk versions
This commit is contained in:
parent
487fdd79ee
commit
941851c234
4 changed files with 36 additions and 21 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -86,8 +86,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anime-launcher-sdk"
|
||||
version = "0.5.10"
|
||||
source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=0.5.10#186aa204d6a87a26198a00c9fb59e0a313f68227"
|
||||
version = "0.5.11"
|
||||
source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=0.5.11#46547a886f51ba8c58918c0903273c3d3c63d5fa"
|
||||
dependencies = [
|
||||
"anime-game-core",
|
||||
"anyhow",
|
||||
|
|
|
@ -17,7 +17,7 @@ glib-build-tools = "0.17"
|
|||
|
||||
[dependencies.anime-launcher-sdk]
|
||||
git = "https://github.com/an-anime-team/anime-launcher-sdk"
|
||||
tag = "0.5.10"
|
||||
tag = "0.5.11"
|
||||
|
||||
# path = "../anime-launcher-sdk" # ! for dev purposes only
|
||||
|
||||
|
|
|
@ -56,10 +56,14 @@ impl From<wine::Version> for ComponentsListVersion {
|
|||
#[inline]
|
||||
fn from(version: wine::Version) -> Self {
|
||||
Self {
|
||||
recommended: match version.version_features() {
|
||||
Some(features) => features.recommended,
|
||||
None => true
|
||||
},
|
||||
|
||||
name: version.name,
|
||||
title: version.title,
|
||||
uri: version.uri,
|
||||
recommended: true
|
||||
uri: version.uri
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,10 +72,14 @@ impl From<dxvk::Version> for ComponentsListVersion {
|
|||
#[inline]
|
||||
fn from(version: dxvk::Version) -> Self {
|
||||
Self {
|
||||
recommended: match version.version_features() {
|
||||
Some(features) => features.recommended,
|
||||
None => true
|
||||
},
|
||||
|
||||
name: version.name,
|
||||
title: version.title,
|
||||
uri: version.uri,
|
||||
recommended: true
|
||||
uri: version.uri
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -732,9 +732,14 @@ impl SimpleAsyncComponent for GeneralApp {
|
|||
group.versions = group.versions.into_iter().take(12).collect();
|
||||
|
||||
let mut group: ComponentsListGroup = group.into();
|
||||
let mut recommended = 6;
|
||||
|
||||
if group.versions.len() > 6 {
|
||||
for i in 6..group.versions.len() {
|
||||
for i in 0..group.versions.len() {
|
||||
if recommended > 0 && group.versions[i].recommended {
|
||||
recommended -= 1;
|
||||
}
|
||||
|
||||
else {
|
||||
group.versions[i].recommended = false;
|
||||
}
|
||||
}
|
||||
|
@ -758,9 +763,14 @@ impl SimpleAsyncComponent for GeneralApp {
|
|||
group.versions = group.versions.into_iter().take(12).collect();
|
||||
|
||||
let mut group: ComponentsListGroup = group.into();
|
||||
let mut recommended = 6;
|
||||
|
||||
if group.versions.len() > 6 {
|
||||
for i in 6..group.versions.len() {
|
||||
for i in 0..group.versions.len() {
|
||||
if recommended > 0 && group.versions[i].recommended {
|
||||
recommended -= 1;
|
||||
}
|
||||
|
||||
else {
|
||||
group.versions[i].recommended = false;
|
||||
}
|
||||
}
|
||||
|
@ -940,16 +950,13 @@ impl SimpleAsyncComponent for GeneralApp {
|
|||
self.downloaded_wine_versions = wine::get_downloaded(&CONFIG.components.path, &CONFIG.game.wine.builds)
|
||||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.flat_map(|group| group.versions
|
||||
.into_iter()
|
||||
.map(move |version| (
|
||||
version.clone(),
|
||||
version.features.unwrap_or_else(
|
||||
|| group.features.to_owned().unwrap_or_default()
|
||||
))
|
||||
)
|
||||
)
|
||||
.collect();
|
||||
.flat_map(|group| group.versions.clone().into_iter()
|
||||
.map(move |version| {
|
||||
let features = version.features_in(&group).unwrap_or_default();
|
||||
|
||||
(version, features)
|
||||
})
|
||||
).collect();
|
||||
|
||||
self.selected_wine_version = if let Some(selected) = &CONFIG.game.wine.selected {
|
||||
let mut index = 0;
|
||||
|
|
Loading…
Reference in a new issue