mirror of
https://github.com/djibux/BoilR.git
synced 2026-09-01 05:53:41 +02:00
@@ -20,6 +20,7 @@ pub(crate) fn get_egs_manifests(
|
||||
.filter_map(get_manifest_item);
|
||||
let mut manifests = vec![];
|
||||
for mut manifest in all_manifests {
|
||||
manifest.manifest_location = manifest.manifest_location;
|
||||
#[cfg(target_family = "unix")]
|
||||
{
|
||||
if let Some(compat_folder) = locations.compat_folder_path.as_ref() {
|
||||
|
||||
@@ -22,9 +22,9 @@ impl HeroicGameType {
|
||||
HeroicGameType::Epic(g) => g.app_name.as_ref(),
|
||||
HeroicGameType::Gog(g, _) => g.game_id.as_ref(),
|
||||
HeroicGameType::Heroic {
|
||||
title,
|
||||
title:_,
|
||||
app_name,
|
||||
install_mode,
|
||||
install_mode:_,
|
||||
} => app_name,
|
||||
}
|
||||
}
|
||||
@@ -35,8 +35,8 @@ impl HeroicGameType {
|
||||
HeroicGameType::Gog(g, _) => g.name.as_ref(),
|
||||
HeroicGameType::Heroic {
|
||||
title,
|
||||
app_name,
|
||||
install_mode,
|
||||
app_name:_,
|
||||
install_mode:_,
|
||||
} => title.as_ref(),
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ mod config;
|
||||
mod egs;
|
||||
mod flatpak;
|
||||
mod gog;
|
||||
#[cfg(target_family = "unix")]
|
||||
mod heroic;
|
||||
mod itch;
|
||||
mod legendary;
|
||||
@@ -17,7 +18,7 @@ mod sync;
|
||||
mod ui;
|
||||
mod uplay;
|
||||
|
||||
fn main(){
|
||||
fn main() {
|
||||
ensure_config_folder();
|
||||
migration::migrate_config();
|
||||
|
||||
|
||||
+7
-3
@@ -1,10 +1,13 @@
|
||||
use crate::{
|
||||
amazon::AmazonSettings, config::get_config_file, egs::EpicGamesLauncherSettings,
|
||||
flatpak::FlatpakSettings, gog::GogSettings, heroic::HeroicSettings, itch::ItchSettings,
|
||||
legendary::LegendarySettings, lutris::settings::LutrisSettings, origin::OriginSettings,
|
||||
steam::SteamSettings, steamgriddb::SteamGridDbSettings, uplay::UplaySettings,
|
||||
flatpak::FlatpakSettings, gog::GogSettings, itch::ItchSettings, legendary::LegendarySettings,
|
||||
lutris::settings::LutrisSettings, origin::OriginSettings, steam::SteamSettings,
|
||||
steamgriddb::SteamGridDbSettings, uplay::UplaySettings,
|
||||
};
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
use crate::heroic::HeroicSettings;
|
||||
|
||||
use config::{Config, ConfigError, Environment, File};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::env;
|
||||
@@ -23,6 +26,7 @@ pub struct Settings {
|
||||
pub gog: GogSettings,
|
||||
pub uplay: UplaySettings,
|
||||
pub lutris: LutrisSettings,
|
||||
#[cfg(target_family = "unix")]
|
||||
pub heroic: HeroicSettings,
|
||||
pub amazon: AmazonSettings,
|
||||
pub flatpak: FlatpakSettings,
|
||||
|
||||
@@ -3,7 +3,6 @@ use tokio::sync::watch::Sender;
|
||||
|
||||
use crate::{
|
||||
egs::EpicPlatform,
|
||||
flatpak::FlatpakPlatform,
|
||||
legendary::LegendaryPlatform,
|
||||
lutris::lutris_platform::LutrisPlatform,
|
||||
platform::Platform,
|
||||
@@ -19,6 +18,9 @@ use crate::{
|
||||
#[cfg(target_family = "unix")]
|
||||
use crate::heroic::HeroicPlatform;
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
use crate::flatpak::FlatpakPlatform;
|
||||
|
||||
use std::error::Error;
|
||||
|
||||
use crate::{gog::GogPlatform, itch::ItchPlatform, origin::OriginPlatform};
|
||||
|
||||
+46
-23
@@ -1,6 +1,6 @@
|
||||
use std::{
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc, thread::Thread,
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@@ -9,7 +9,6 @@ use crate::{
|
||||
steam::{get_shortcuts_paths, SteamUsersInfo},
|
||||
steamgriddb::{get_image_extension, get_query_type, CachedSearch, ImageType, ToDownload},
|
||||
};
|
||||
use config::File;
|
||||
use dashmap::DashMap;
|
||||
use egui::{ImageButton, ScrollArea};
|
||||
use futures::executor::block_on;
|
||||
@@ -41,6 +40,7 @@ pub enum TextureState {
|
||||
Downloading,
|
||||
Downloaded,
|
||||
Loaded(egui::TextureHandle),
|
||||
Failed,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -149,7 +149,7 @@ impl MyEguiApp {
|
||||
ui.heading(shortcut.name());
|
||||
|
||||
if let Some(possible_names) = state.possible_names.as_ref() {
|
||||
if let Some(value) = render_possible_names(possible_names, ui,state) {
|
||||
if let Some(value) = render_possible_names(possible_names, ui, state) {
|
||||
return value;
|
||||
}
|
||||
} else if let Some(image_type) = state.image_type_selected.as_ref() {
|
||||
@@ -265,20 +265,23 @@ impl MyEguiApp {
|
||||
TextureState::Downloaded => {
|
||||
//Need to load
|
||||
let image_data = load_image_from_path(&image.thumbnail_path);
|
||||
if let Ok(image_data) = image_data {
|
||||
match image_data {
|
||||
Ok(image_data) => {
|
||||
let handle = ui.ctx().load_texture(
|
||||
&image_key,
|
||||
image_data,
|
||||
egui::TextureFilter::Linear,
|
||||
);
|
||||
*state.value_mut() = TextureState::Loaded(handle);
|
||||
}
|
||||
ui.ctx().request_repaint();
|
||||
ui.horizontal(|ui| {
|
||||
ui.spinner();
|
||||
ui.label("Loading");
|
||||
});
|
||||
}
|
||||
Err(_) => *state.value_mut() = TextureState::Failed,
|
||||
}
|
||||
ui.ctx().request_repaint();
|
||||
}
|
||||
TextureState::Loaded(texture_handle) => {
|
||||
//need to show
|
||||
let mut size = texture_handle.size_vec2();
|
||||
@@ -288,6 +291,9 @@ impl MyEguiApp {
|
||||
return Some(UserAction::ImageSelected(image.clone()));
|
||||
}
|
||||
}
|
||||
TextureState::Failed => {
|
||||
ui.label("Failed to load image");
|
||||
}
|
||||
}
|
||||
}
|
||||
None => {
|
||||
@@ -401,12 +407,12 @@ impl MyEguiApp {
|
||||
.set_image_banned(&image_type, app_id, should_ban);
|
||||
self.handle_image_type_clear(image_type);
|
||||
}
|
||||
UserAction::ClearImages =>{
|
||||
for image_type in ImageType::all(){
|
||||
UserAction::ClearImages => {
|
||||
for image_type in ImageType::all() {
|
||||
self.handle_image_type_clear(*image_type);
|
||||
}
|
||||
self.handle_back_button_action();
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -523,7 +529,8 @@ impl MyEguiApp {
|
||||
let mut result = vec![];
|
||||
for possible_image in &possible_images {
|
||||
let ext = get_image_extension(&possible_image.mime);
|
||||
let path = thumbnails_folder.join(format!("{}.{}",possible_image.id,ext));
|
||||
let path =
|
||||
thumbnails_folder.join(format!("{}.{}", possible_image.id, ext));
|
||||
result.push(PossibleImage {
|
||||
thumbnail_path: path,
|
||||
mime: possible_image.mime.clone(),
|
||||
@@ -563,20 +570,25 @@ impl MyEguiApp {
|
||||
|
||||
let data_folder = Path::new(&user.steam_user_data_folder);
|
||||
|
||||
|
||||
//Keep deleting images of this type untill we don't find any more
|
||||
let mut path = self.get_shortcut_image_path(data_folder);
|
||||
while Path::new(&path).exists(){
|
||||
let _= std::fs::remove_file(&path);
|
||||
while Path::new(&path).exists() {
|
||||
let _ = std::fs::remove_file(&path);
|
||||
path = self.get_shortcut_image_path(data_folder);
|
||||
}
|
||||
|
||||
//Put the loaded thumbnail into the image handler map, we can use that for preview
|
||||
let full_image_key = to_download_to_path.to_string_lossy().to_string();
|
||||
let _ = self.image_selected_state.image_handles.remove(&full_image_key);
|
||||
let _ = self
|
||||
.image_selected_state
|
||||
.image_handles
|
||||
.remove(&full_image_key);
|
||||
let thumbnail_key = image.thumbnail_path.to_string_lossy().to_string();
|
||||
let thumbnail = self.image_selected_state.image_handles.remove(&thumbnail_key);
|
||||
if let Some((key,thumbnail)) = thumbnail {
|
||||
let thumbnail = self
|
||||
.image_selected_state
|
||||
.image_handles
|
||||
.remove(&thumbnail_key);
|
||||
if let Some((_key, thumbnail)) = thumbnail {
|
||||
self.image_selected_state
|
||||
.image_handles
|
||||
.insert(full_image_key, thumbnail);
|
||||
@@ -601,7 +613,15 @@ impl MyEguiApp {
|
||||
}
|
||||
|
||||
fn get_shortcut_image_path(&self, data_folder: &Path) -> String {
|
||||
self.image_selected_state.selected_shortcut.as_ref().unwrap().key(&self.image_selected_state.image_type_selected.unwrap(), data_folder).1
|
||||
self.image_selected_state
|
||||
.selected_shortcut
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.key(
|
||||
&self.image_selected_state.image_type_selected.unwrap(),
|
||||
data_folder,
|
||||
)
|
||||
.1
|
||||
}
|
||||
|
||||
fn clear_loaded_images(&mut self) {
|
||||
@@ -662,12 +682,12 @@ impl MyEguiApp {
|
||||
fn render_possible_names(
|
||||
possible_names: &Vec<steamgriddb_api::search::SearchResult>,
|
||||
ui: &mut egui::Ui,
|
||||
state: &ImageSelectState
|
||||
state: &ImageSelectState,
|
||||
) -> Option<UserAction> {
|
||||
let mut grid_id_text = state.grid_id.map(|id| id.to_string()).unwrap_or_default();
|
||||
ui.label("SteamGridDB ID").on_hover_text("You can change this id to one you have found at the steamgriddb webpage");
|
||||
if ui.text_edit_singleline(&mut grid_id_text)
|
||||
.changed() {
|
||||
ui.label("SteamGridDB ID")
|
||||
.on_hover_text("You can change this id to one you have found at the steamgriddb webpage");
|
||||
if ui.text_edit_singleline(&mut grid_id_text).changed() {
|
||||
if let Ok(grid_id) = grid_id_text.parse::<usize>() {
|
||||
return Some(UserAction::GridIdChanged(grid_id));
|
||||
}
|
||||
@@ -680,7 +700,11 @@ fn render_possible_names(
|
||||
}
|
||||
|
||||
ui.separator();
|
||||
if ui.button("Clear all images").on_hover_text("Clicking this deletes all images for this shortcut").clicked(){
|
||||
if ui
|
||||
.button("Clear all images")
|
||||
.on_hover_text("Clicking this deletes all images for this shortcut")
|
||||
.clicked()
|
||||
{
|
||||
return Some(UserAction::ClearImages);
|
||||
}
|
||||
None
|
||||
@@ -700,7 +724,6 @@ fn render_steam_game_select(ui: &mut egui::Ui, state: &ImageSelectState) -> Opti
|
||||
}
|
||||
|
||||
fn render_shortcut_images(ui: &mut egui::Ui, state: &ImageSelectState) -> Option<UserAction> {
|
||||
|
||||
if ui
|
||||
.button("Click here if the images are for a wrong game")
|
||||
.clicked()
|
||||
|
||||
@@ -2,7 +2,9 @@ use copypasta::ClipboardProvider;
|
||||
use eframe::egui;
|
||||
use egui::ScrollArea;
|
||||
|
||||
use crate::{egs::EpicPlatform, heroic::HeroicPlatform};
|
||||
use crate::{egs::EpicPlatform};
|
||||
#[cfg(target_family = "unix")]
|
||||
use crate::heroic::HeroicPlatform;
|
||||
|
||||
use super::{
|
||||
ui_colors::{BACKGROUND_COLOR, EXTRA_BACKGROUND_COLOR},
|
||||
@@ -62,6 +64,7 @@ impl MyEguiApp {
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
fn render_flatpak_settings(&mut self, ui: &mut egui::Ui) {
|
||||
ui.heading("Flatpak");
|
||||
ui.checkbox(&mut self.settings.flatpak.enabled, "Import from Flatpak");
|
||||
@@ -69,7 +72,7 @@ impl MyEguiApp {
|
||||
ui.add_space(SECTION_SPACING);
|
||||
}
|
||||
|
||||
|
||||
␍#[cfg(target_family = "unix")]
|
||||
fn render_heroic_settings(&mut self, ui: &mut egui::Ui) {
|
||||
ui.heading("Heroic");
|
||||
ui.checkbox(&mut self.settings.heroic.enabled, "Import from Heroic");
|
||||
@@ -95,6 +98,7 @@ self.settings.heroic.default_launch_through_heroic{
|
||||
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.");
|
||||
|
||||
}
|
||||
#[cfg(target_family = "unix")]{
|
||||
let manifests =self.heroic_games.get_or_insert_with(||{
|
||||
let heroic_setting = self.settings.heroic.clone();
|
||||
|
||||
@@ -117,6 +121,7 @@ self.settings.heroic.default_launch_through_heroic{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}) ;
|
||||
ui.add_space(SECTION_SPACING);
|
||||
}
|
||||
|
||||
+16
-12
@@ -1,19 +1,15 @@
|
||||
use std::{env::Args, error::Error};
|
||||
#[cfg(target_family = "unix")]
|
||||
use crate::heroic::HeroicGameType;
|
||||
|
||||
use eframe::{egui, App, Frame};
|
||||
use egui::{Button, ImageButton, Rounding, Stroke, TextureHandle};
|
||||
use egui::{ImageButton, Rounding, Stroke, TextureHandle};
|
||||
use steam_shortcuts_util::shortcut::ShortcutOwned;
|
||||
use tokio::{
|
||||
runtime::Runtime,
|
||||
sync::watch::{self, Receiver},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
egs::ManifestItem,
|
||||
heroic::{HeroicGame, HeroicGameType},
|
||||
settings::Settings,
|
||||
sync::SyncProgress,
|
||||
};
|
||||
use crate::{egs::ManifestItem, settings::Settings, sync::SyncProgress};
|
||||
|
||||
use super::{
|
||||
ui_colors::{
|
||||
@@ -42,6 +38,7 @@ pub struct MyEguiApp {
|
||||
pub(crate) games_to_sync: Receiver<FetcStatus<Vec<(String, Vec<ShortcutOwned>)>>>,
|
||||
pub(crate) status_reciever: Receiver<SyncProgress>,
|
||||
pub(crate) epic_manifests: Option<Vec<ManifestItem>>,
|
||||
#[cfg(target_family = "unix")]
|
||||
pub(crate) heroic_games: Option<Vec<HeroicGameType>>,
|
||||
pub(crate) image_selected_state: ImageSelectState,
|
||||
pub(crate) backup_state: BackupState,
|
||||
@@ -59,6 +56,7 @@ impl MyEguiApp {
|
||||
ui_images: UiImages::default(),
|
||||
status_reciever: watch::channel(SyncProgress::NotStarted).1,
|
||||
epic_manifests: None,
|
||||
#[cfg(target_family = "unix")]
|
||||
heroic_games: None,
|
||||
image_selected_state: ImageSelectState::default(),
|
||||
backup_state: BackupState::default(),
|
||||
@@ -243,21 +241,27 @@ impl MyEguiApp {
|
||||
fn get_import_image(&mut self, ui: &mut egui::Ui) -> &mut TextureHandle {
|
||||
self.ui_images.import_button.get_or_insert_with(|| {
|
||||
// Load the texture only once.
|
||||
ui.ctx().load_texture("import_image", get_import_image(),egui::TextureFilter::Linear)
|
||||
ui.ctx().load_texture(
|
||||
"import_image",
|
||||
get_import_image(),
|
||||
egui::TextureFilter::Linear,
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn get_save_image(&mut self, ui: &mut egui::Ui) -> &mut TextureHandle {
|
||||
self.ui_images.save_button.get_or_insert_with(|| {
|
||||
// Load the texture only once.
|
||||
ui.ctx().load_texture("save_image", get_save_image(),egui::TextureFilter::Linear)
|
||||
ui.ctx()
|
||||
.load_texture("save_image", get_save_image(), egui::TextureFilter::Linear)
|
||||
})
|
||||
}
|
||||
|
||||
fn get_logo_image(&mut self, ui: &mut egui::Ui) -> &mut TextureHandle {
|
||||
self.ui_images.logo_32.get_or_insert_with(|| {
|
||||
// Load the texture only once.
|
||||
ui.ctx().load_texture("logo32", get_logo(),egui::TextureFilter::Linear)
|
||||
ui.ctx()
|
||||
.load_texture("logo32", get_logo(), egui::TextureFilter::Linear)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -275,7 +279,7 @@ pub fn run_sync() {
|
||||
app.run_sync(true);
|
||||
}
|
||||
|
||||
pub fn run_ui(args: Vec<String>){
|
||||
pub fn run_ui(args: Vec<String>) {
|
||||
let app = MyEguiApp::new();
|
||||
let no_v_sync = args.contains(&"--no-vsync".to_string());
|
||||
let native_options = eframe::NativeOptions {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use crate::platform::Platform;
|
||||
use std::error::Error;
|
||||
#[cfg(target_os = "windows")]
|
||||
use std::path::Path;
|
||||
#[cfg(target_os = "windows")]
|
||||
use std::path::PathBuf;
|
||||
|
||||
use super::{game::Game, settings::UplaySettings};
|
||||
|
||||
Reference in New Issue
Block a user