mirror of
https://github.com/djibux/BoilR.git
synced 2026-09-01 05:53:41 +02:00
Add option to always launch through heroic (#156)
* Add option to always launch through heroic * Default to launche through heroic
This commit is contained in:
@@ -39,6 +39,7 @@ flatpak = false
|
|||||||
[heroic]
|
[heroic]
|
||||||
enabled = true
|
enabled = true
|
||||||
launch_games_through_heroic =[]
|
launch_games_through_heroic =[]
|
||||||
|
default_launch_through_heroic = true
|
||||||
|
|
||||||
[amazon]
|
[amazon]
|
||||||
enabled = true
|
enabled = true
|
||||||
|
|||||||
@@ -138,17 +138,22 @@ impl HeroicPlatform {
|
|||||||
if let Some(shortcuts) = shortcuts.as_mut() {
|
if let Some(shortcuts) = shortcuts.as_mut() {
|
||||||
for shortcut in shortcuts {
|
for shortcut in shortcuts {
|
||||||
shortcut.install_mode = Some(install_mode.clone());
|
shortcut.install_mode = Some(install_mode.clone());
|
||||||
if self
|
|
||||||
|
let game_in_list = self
|
||||||
.settings
|
.settings
|
||||||
.launch_games_through_heroic
|
.launch_games_through_heroic
|
||||||
.contains(&shortcut.app_name)
|
.contains(&shortcut.app_name)
|
||||||
|| self
|
|| self
|
||||||
.settings
|
.settings
|
||||||
.launch_games_through_heroic
|
.launch_games_through_heroic
|
||||||
.contains(&shortcut.title)
|
.contains(&shortcut.title);
|
||||||
{
|
|
||||||
shortcut.launch_through_heroic = true;
|
shortcut.launch_through_heroic =
|
||||||
}
|
if self.settings.default_launch_through_heroic {
|
||||||
|
!game_in_list
|
||||||
|
} else {
|
||||||
|
game_in_list
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shortcuts
|
shortcuts
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ use serde::{Deserialize, Serialize};
|
|||||||
pub struct HeroicSettings {
|
pub struct HeroicSettings {
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
pub launch_games_through_heroic: Vec<String>,
|
pub launch_games_through_heroic: Vec<String>,
|
||||||
|
pub default_launch_through_heroic: bool,
|
||||||
}
|
}
|
||||||
|
|||||||
+54
-41
@@ -36,47 +36,7 @@ impl MyEguiApp {
|
|||||||
|
|
||||||
#[cfg(target_family = "unix")]
|
#[cfg(target_family = "unix")]
|
||||||
{
|
{
|
||||||
ui.heading("Heroic");
|
self.render_heroic_settings(ui);
|
||||||
ui.checkbox(&mut self.settings.heroic.enabled, "Import from Heroic");
|
|
||||||
|
|
||||||
|
|
||||||
let safe_mode_header = match self.settings.heroic.launch_games_through_heroic.len() {
|
|
||||||
0 => "Force games to launch through Heroic Launcher".to_string(),
|
|
||||||
1 => "One game forced to launch through Heroic Launcher".to_string(),
|
|
||||||
x => format!("{} games forced to launch through Heroic Launcher", x),
|
|
||||||
};
|
|
||||||
|
|
||||||
egui::CollapsingHeader::new(safe_mode_header)
|
|
||||||
.id_source("Heroic_Launcher_safe_launch")
|
|
||||||
.show(ui, |ui| {
|
|
||||||
ui.label("Some games must be started from the Heroic Launcher, select those games below and BoilR will create shortcuts that opens the games through the Heroic Launcher.");
|
|
||||||
let manifests =self.heroic_games.get_or_insert_with(||{
|
|
||||||
let heroic_setting = self.settings.heroic.clone();
|
|
||||||
|
|
||||||
let install_modes = vec![crate::heroic::InstallationMode::FlatPak, crate::heroic::InstallationMode::UserBin];
|
|
||||||
let heroic_platform =HeroicPlatform{
|
|
||||||
settings:heroic_setting
|
|
||||||
};
|
|
||||||
let heroic_games = heroic_platform.get_heroic_games(&install_modes);
|
|
||||||
heroic_games
|
|
||||||
});
|
|
||||||
|
|
||||||
let safe_open_games = &mut self.settings.heroic.launch_games_through_heroic;
|
|
||||||
for manifest in manifests{
|
|
||||||
let key = &manifest.app_name;
|
|
||||||
let display_name = &manifest.title;
|
|
||||||
let mut safe_open = safe_open_games.contains(display_name) || safe_open_games.contains(key);
|
|
||||||
if ui.checkbox(&mut safe_open, display_name).clicked(){
|
|
||||||
if safe_open{
|
|
||||||
safe_open_games.push(key.clone());
|
|
||||||
}else{
|
|
||||||
safe_open_games.retain(|m| m!= display_name && m!= key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}) ;
|
|
||||||
|
|
||||||
ui.add_space(SECTION_SPACING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.render_legendary_settings(ui);
|
self.render_legendary_settings(ui);
|
||||||
@@ -94,6 +54,59 @@ impl MyEguiApp {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn render_heroic_settings(&mut self, ui: &mut egui::Ui) {
|
||||||
|
ui.heading("Heroic");
|
||||||
|
ui.checkbox(&mut self.settings.heroic.enabled, "Import from Heroic");
|
||||||
|
ui.checkbox(&mut self.settings.heroic.default_launch_through_heroic, "Always launch games through Heroic");
|
||||||
|
let safe_mode_header = match (self.settings.heroic.default_launch_through_heroic,self.settings.heroic.launch_games_through_heroic.len()) {
|
||||||
|
(false,0) => "Force games to launch through Heroic Launcher".to_string(),
|
||||||
|
(false,1) => "One game forced to launch through Heroic Launcher".to_string(),
|
||||||
|
(false,x) => format!("{} games forced to launch through Heroic Launcher", x),
|
||||||
|
|
||||||
|
(true,0) => "Force games to launch directly".to_string(),
|
||||||
|
(true,1) => "One game forced to launch directly".to_string(),
|
||||||
|
(true,x) => format!("{} games forced to launch directly", x),
|
||||||
|
|
||||||
|
};
|
||||||
|
egui::CollapsingHeader::new(safe_mode_header)
|
||||||
|
.id_source("Heroic_Launcher_safe_launch")
|
||||||
|
.show(ui, |ui| {
|
||||||
|
if
|
||||||
|
self.settings.heroic.default_launch_through_heroic{
|
||||||
|
ui.label("Some games work best when launched directly, select those games below and BoilR will create shortcuts that launch the games directly.");
|
||||||
|
|
||||||
|
} else{
|
||||||
|
ui.label("Some games must be started from the Heroic Launcher, select those games below and BoilR will create shortcuts that opens the games through the Heroic Launcher.");
|
||||||
|
|
||||||
|
}
|
||||||
|
let manifests =self.heroic_games.get_or_insert_with(||{
|
||||||
|
let heroic_setting = self.settings.heroic.clone();
|
||||||
|
|
||||||
|
let install_modes = vec![crate::heroic::InstallationMode::FlatPak, crate::heroic::InstallationMode::UserBin];
|
||||||
|
let heroic_platform =HeroicPlatform{
|
||||||
|
settings:heroic_setting
|
||||||
|
};
|
||||||
|
let heroic_games = heroic_platform.get_heroic_games(&install_modes);
|
||||||
|
heroic_games
|
||||||
|
});
|
||||||
|
|
||||||
|
let safe_open_games = &mut self.settings.heroic.launch_games_through_heroic;
|
||||||
|
for manifest in manifests{
|
||||||
|
let key = &manifest.app_name;
|
||||||
|
let display_name = &manifest.title;
|
||||||
|
let mut safe_open = safe_open_games.contains(display_name) || safe_open_games.contains(key);
|
||||||
|
if ui.checkbox(&mut safe_open, display_name).clicked(){
|
||||||
|
if safe_open{
|
||||||
|
safe_open_games.push(key.clone());
|
||||||
|
}else{
|
||||||
|
safe_open_games.retain(|m| m!= display_name && m!= key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}) ;
|
||||||
|
ui.add_space(SECTION_SPACING);
|
||||||
|
}
|
||||||
|
|
||||||
fn render_lutris_settings(&mut self, ui: &mut egui::Ui) {
|
fn render_lutris_settings(&mut self, ui: &mut egui::Ui) {
|
||||||
ui.heading("Lutris");
|
ui.heading("Lutris");
|
||||||
ui.checkbox(&mut self.settings.lutris.enabled, "Import from Lutris");
|
ui.checkbox(&mut self.settings.lutris.enabled, "Import from Lutris");
|
||||||
|
|||||||
Reference in New Issue
Block a user