mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-11-28 18:08:46 +03:00
Added wine & dxvk version selection during initial setup
This commit is contained in:
parent
b5fe109be6
commit
ceffbe795a
3 changed files with 64 additions and 22 deletions
|
@ -21,22 +21,10 @@ Gtk.Box page {
|
|||
|
||||
Adw.ComboRow wine_version {
|
||||
title: "Wine version";
|
||||
|
||||
model: Gtk.StringList {
|
||||
strings [
|
||||
"Wine-GE-Proton 7-22"
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
Adw.ComboRow dxvk_version {
|
||||
title: "DXVK version";
|
||||
|
||||
model: Gtk.StringList {
|
||||
strings [
|
||||
"dxvk-1.10.2"
|
||||
]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@ mod page_6;
|
|||
use crate::ui::*;
|
||||
use crate::ui::components::progress_bar::*;
|
||||
|
||||
use crate::lib::wine::Version as WineVersion;
|
||||
use crate::lib::dxvk::Version as DxvkVersion;
|
||||
use crate::lib::wine_prefix::WinePrefix;
|
||||
use crate::lib::config;
|
||||
|
||||
|
@ -208,8 +206,8 @@ impl App {
|
|||
|
||||
let progress_bar = this.widgets.page_5.progress_bar.clone();
|
||||
|
||||
let wine_version = WineVersion::latest().unwrap();
|
||||
let dxvk_version = DxvkVersion::latest().unwrap();
|
||||
let wine_version = this.widgets.page_5.get_wine_version().clone();
|
||||
let dxvk_version = this.widgets.page_5.get_dxvk_version().clone();
|
||||
|
||||
let wine_version_copy = wine_version.clone();
|
||||
|
||||
|
@ -297,8 +295,9 @@ impl App {
|
|||
this.widgets.carousel.scroll_to(&this.widgets.page_6.page, true);
|
||||
}
|
||||
|
||||
// FIXME
|
||||
Actions::Restart => {
|
||||
Command::new(std::env::current_exe().unwrap()).spawn().unwrap();
|
||||
|
||||
this.widgets.window.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
use gtk4 as gtk;
|
||||
use libadwaita as adw;
|
||||
use libadwaita::{self as adw, prelude::*};
|
||||
|
||||
use crate::lib::wine::{Version as WineVersion, List as WineList};
|
||||
use crate::lib::dxvk::{Version as DxvkVersion, List as DxvkList};
|
||||
|
||||
use crate::ui::*;
|
||||
use crate::ui::components::progress_bar::ProgressBar;
|
||||
|
@ -14,14 +17,17 @@ pub struct Page {
|
|||
pub download_button: gtk::Button,
|
||||
pub exit_button: gtk::Button,
|
||||
|
||||
pub progress_bar: ProgressBar
|
||||
pub progress_bar: ProgressBar,
|
||||
|
||||
pub wine_versions: Vec<WineVersion>,
|
||||
pub dxvk_versions: Vec<DxvkVersion>
|
||||
}
|
||||
|
||||
impl Page {
|
||||
pub fn new() -> Result<Self, String> {
|
||||
let builder = gtk::Builder::from_resource("/org/app/ui/first_run/page_5.ui");
|
||||
|
||||
Ok(Self {
|
||||
let mut result = Self {
|
||||
page: get_object(&builder, "page")?,
|
||||
|
||||
wine_version: get_object(&builder, "wine_version")?,
|
||||
|
@ -34,7 +40,56 @@ impl Page {
|
|||
get_object(&builder, "progress_bar")?,
|
||||
get_object(&builder, "buttons_group")?,
|
||||
get_object(&builder, "progress_bar_group")?
|
||||
)
|
||||
})
|
||||
),
|
||||
|
||||
wine_versions: Vec::new(),
|
||||
dxvk_versions: Vec::new()
|
||||
};
|
||||
|
||||
// Add wine versions
|
||||
let model = gtk::StringList::new(&[]);
|
||||
|
||||
let versions = match WineList::get() {
|
||||
Ok(versions) => versions,
|
||||
Err(err) => return Err(err.to_string())
|
||||
};
|
||||
|
||||
for version in &versions[0].versions {
|
||||
if version.recommended {
|
||||
model.append(&version.title);
|
||||
|
||||
result.wine_versions.push(version.clone());
|
||||
}
|
||||
}
|
||||
|
||||
result.wine_version.set_model(Some(&model));
|
||||
|
||||
// Add DXVK versions
|
||||
let model = gtk::StringList::new(&[]);
|
||||
|
||||
let versions = match DxvkList::get() {
|
||||
Ok(versions) => versions,
|
||||
Err(err) => return Err(err.to_string())
|
||||
};
|
||||
|
||||
for version in &versions.vanilla {
|
||||
if version.recommended {
|
||||
model.append(&version.version);
|
||||
|
||||
result.dxvk_versions.push(version.clone());
|
||||
}
|
||||
}
|
||||
|
||||
result.dxvk_version.set_model(Some(&model));
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
pub fn get_wine_version(&self) -> &WineVersion {
|
||||
&self.wine_versions[self.wine_version.selected() as usize]
|
||||
}
|
||||
|
||||
pub fn get_dxvk_version(&self) -> &DxvkVersion {
|
||||
&self.dxvk_versions[self.dxvk_version.selected() as usize]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue