Fix icon overwrite (#128)

* run sync twive to fix up images

* Update dependencies versions

* update cargo-lock dependencies

* Adding spinners to ui

* Fix icons for gog games

* Run fix shortcuts for all boilr shortcuts

* Update flatpak release notes
This commit is contained in:
Philip Kristoffersen
2022-05-15 07:51:21 +02:00
committed by GitHub
parent 4135d62416
commit eb819c1357
10 changed files with 915 additions and 1805 deletions
Generated
+330 -733
View File
File diff suppressed because it is too large Load Diff
+11 -11
View File
@@ -1,30 +1,30 @@
[package] [package]
name = "boilr" name = "boilr"
version = "1.3.3" version = "1.3.4"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
steam_shortcuts_util = "1.1.7" steam_shortcuts_util = "1.1.7"
steamgriddb_api = "^0.3.0" steamgriddb_api = "^0.3.0"
serde = { version = "^1.0.136", features = ["derive"] } serde = { version = "^1.0.137", features = ["derive"] }
serde_json = "^1.0.79" serde_json = "^1.0.81"
tokio = { version = "^1.17.0", features = ["full"] } tokio = { version = "^1.18.2", features = ["full"] }
reqwest = { version = "^0.11.10", default_features = false } reqwest = { version = "^0.11.10", default_features = false }
config = "^0.11.0" config = "^0.11.0"
failure = "^0.1.8" failure = "^0.1.8"
nom = "^7.1.1" nom = "^7.1.1"
flate2 = "^1.0.22" flate2 = "^1.0.23"
futures = { version = "^0.3.21" } futures = { version = "^0.3.21" }
dashmap = { version = "^5.2.0", features = ["serde"] } dashmap = { version = "^5.3.3", features = ["serde"] }
is_executable = "^1.0.1" is_executable = "^1.0.1"
rusty-leveldb = "^0.3.6" rusty-leveldb = "^0.3.6"
base64 = "^0.13.0" base64 = "^0.13.0"
eframe = { version = "0.17.0" } eframe = { version = "^0.18.0" }
egui = { version = "0.17.0" } egui = { version = "^0.18.1" }
image = { version = "0.24.1", features = ["png"] } image = { version = "0.24.2", features = ["png"] }
toml = { version = "^0.5.8" } toml = { version = "^0.5.9" }
sysinfo = "0.23.10" sysinfo = "^0.23.12"
sqlite = "0.26.0" sqlite = "0.26.0"
copypasta = "0.7.1" copypasta = "0.7.1"
+508 -1015
View File
File diff suppressed because it is too large Load Diff
@@ -25,6 +25,11 @@ https://hughsie.github.io/oars/index.html
--> -->
<content_rating type="oars-1.1" /> <content_rating type="oars-1.1" />
<releases> <releases>
<release version="1.3.4" date="2022-05-15">
<description>
<ul><li>Fix icons not being set on games</li><li>Update dependencies to improve performance</li><li>Add progress spinners to ui</li></ul>
</description>
</release>
<release version="1.3.3" date="2022-05-14"> <release version="1.3.3" date="2022-05-14">
<description> <description>
<p>Set custom images on Steam games as well as shortcuts</p> <p>Set custom images on Steam games as well as shortcuts</p>
+1 -1
View File
@@ -44,7 +44,7 @@ impl From<GogShortcut> for ShortcutOwned {
let icon = if icon_path.exists() { let icon = if icon_path.exists() {
icon_path.to_str().unwrap().to_string() icon_path.to_str().unwrap().to_string()
} else { } else {
exe.to_str().unwrap_or("").to_string() "".to_string()
}; };
let mut exe_string = exe.to_string_lossy().to_string(); let mut exe_string = exe.to_string_lossy().to_string();
if exe_string.contains(' ') && !exe_string.starts_with('\"') { if exe_string.contains(' ') && !exe_string.starts_with('\"') {
+9 -14
View File
@@ -142,20 +142,15 @@ fn fix_shortcut_icons(
for shortcut in shortcuts { for shortcut in shortcuts {
if shortcut.is_boilr_shortcut() { if shortcut.is_boilr_shortcut() {
let replace_icon = shortcut.icon.trim().eq("") let app_id = steam_shortcuts_util::app_id_generator::calculate_app_id(
|| !Path::new(shortcut.icon.trim()).exists() &shortcut.exe,
|| shortcut.icon.eq(&shortcut.exe); &shortcut.app_name,
if replace_icon { );
let app_id = steam_shortcuts_util::app_id_generator::calculate_app_id( for ext in ["ico", "png", "jpg", "webp"] {
&shortcut.exe, let path = image_folder.join(image_type.file_name(app_id, ext));
&shortcut.app_name, if path.exists() {
); shortcut.icon = path.to_string_lossy().to_string();
for ext in ["ico", "png", "jpg", "webp"] { break;
let path = image_folder.join(image_type.file_name(app_id, ext));
if path.exists() {
shortcut.icon = path.to_string_lossy().to_string();
break;
}
} }
} }
} }
+1 -1
View File
@@ -13,7 +13,7 @@ pub mod ui_colors {
pub mod ui_images { pub mod ui_images {
use std::path::Path; use std::path::Path;
use eframe::epi::IconData; use eframe::IconData;
use egui::{ColorImage, ImageData}; use egui::{ColorImage, ImageData};
pub const IMPORT_GAMES_IMAGE: &[u8] = include_bytes!("../../resources/import_games_button.png"); pub const IMPORT_GAMES_IMAGE: &[u8] = include_bytes!("../../resources/import_games_button.png");
+15 -6
View File
@@ -5,9 +5,9 @@ use std::{
use crate::{ use crate::{
config::get_thumbnails_folder, config::get_thumbnails_folder,
steam::{get_installed_games, SteamGameInfo},
steam::{get_shortcuts_paths, SteamUsersInfo}, steam::{get_shortcuts_paths, SteamUsersInfo},
steamgriddb::{get_image_extension, get_query_type, CachedSearch, ImageType, ToDownload}, steamgriddb::{get_image_extension, get_query_type, CachedSearch, ImageType, ToDownload},
steam::{get_installed_games, SteamGameInfo},
}; };
use dashmap::DashMap; use dashmap::DashMap;
use egui::{ImageButton, ScrollArea}; use egui::{ImageButton, ScrollArea};
@@ -262,7 +262,10 @@ impl MyEguiApp {
TextureState::Downloading => { TextureState::Downloading => {
ui.ctx().request_repaint(); ui.ctx().request_repaint();
//nothing to do,just wait //nothing to do,just wait
ui.label(format!("Downloading id {}", image.id)); ui.horizontal(|ui| {
ui.spinner();
ui.label(format!("Downloading id {}", image.id));
});
} }
TextureState::Downloaded => { TextureState::Downloaded => {
//Need to load //Need to load
@@ -272,7 +275,10 @@ impl MyEguiApp {
*state.value_mut() = TextureState::Loaded(handle); *state.value_mut() = TextureState::Loaded(handle);
} }
ui.ctx().request_repaint(); ui.ctx().request_repaint();
ui.label("Loading"); ui.horizontal(|ui| {
ui.spinner();
ui.label("Loading");
});
} }
TextureState::Loaded(texture_handle) => { TextureState::Loaded(texture_handle) => {
//need to show //need to show
@@ -317,7 +323,10 @@ impl MyEguiApp {
} }
} }
_ => { _ => {
ui.label("Finding possible images"); ui.horizontal(|ui| {
ui.spinner();
ui.label("Finding possible images");
});
ui.ctx().request_repaint(); ui.ctx().request_repaint();
} }
} }
@@ -732,8 +741,8 @@ impl HasImageKey for GameType {
impl HasImageKey for SteamGameInfo { impl HasImageKey for SteamGameInfo {
fn key(&self, image_type: &ImageType, user_path: &Path) -> (PathBuf, String) { fn key(&self, image_type: &ImageType, user_path: &Path) -> (PathBuf, String) {
let mut keys = POSSIBLE_EXTENSIONS let mut keys = POSSIBLE_EXTENSIONS
.iter() .iter()
.map(|ext| key_from_extension(self.appid, image_type, user_path, ext)); .map(|ext| key_from_extension(self.appid, image_type, user_path, ext));
let first = keys.next().unwrap(); let first = keys.next().unwrap();
let other = keys.filter(|(exsists, _, _)| *exsists).next(); let other = keys.filter(|(exsists, _, _)| *exsists).next();
let (_, path, key) = other.unwrap_or(first); let (_, path, key) = other.unwrap_or(first);
+8 -1
View File
@@ -84,7 +84,10 @@ impl MyEguiApp {
}, },
_=> { _=> {
ui.ctx().request_repaint(); ui.ctx().request_repaint();
ui.label("Finding installed games"); ui.horizontal(|ui|{
ui.spinner();
ui.label("Finding installed games");
});
}, },
}; };
}); });
@@ -118,6 +121,10 @@ impl MyEguiApp {
let usersinfo = sync::run_sync(&settings, &mut some_sender).unwrap(); let usersinfo = sync::run_sync(&settings, &mut some_sender).unwrap();
let task = download_images(&settings, &usersinfo, &mut some_sender); let task = download_images(&settings, &usersinfo, &mut some_sender);
block_on(task); block_on(task);
//Run a second time to fix up shortcuts after images are downloaded
sync::run_sync(&settings, &mut some_sender).unwrap();
if let Some(sender) = some_sender { if let Some(sender) = some_sender {
let _ = sender.send(SyncProgress::Done); let _ = sender.send(SyncProgress::Done);
} }
+27 -23
View File
@@ -1,6 +1,6 @@
use std::error::Error; use std::error::Error;
use eframe::{egui, epi}; use eframe::{egui, App, Frame};
use egui::{ImageButton, Rounding, Stroke, TextureHandle}; use egui::{ImageButton, Rounding, Stroke, TextureHandle};
use steam_shortcuts_util::shortcut::ShortcutOwned; use steam_shortcuts_util::shortcut::ShortcutOwned;
use tokio::{ use tokio::{
@@ -68,26 +68,8 @@ impl Default for Menues {
} }
} }
impl epi::App for MyEguiApp { impl App for MyEguiApp {
fn name(&self) -> &str { fn update(&mut self, ctx: &egui::Context, _frame: &mut Frame) {
"BoilR"
}
fn setup(
&mut self,
ctx: &egui::Context,
_frame: &epi::Frame,
_storage: Option<&dyn epi::Storage>,
) {
#[cfg(target_family = "unix")]
ctx.set_pixels_per_point(1.0);
let mut style: egui::Style = (*ctx.style()).clone();
create_style(&mut style);
ctx.set_style(style);
}
fn update(&mut self, ctx: &egui::Context, _frame: &epi::Frame) {
let frame = egui::Frame::default() let frame = egui::Frame::default()
.stroke(Stroke::new(0., BACKGROUND_COLOR)) .stroke(Stroke::new(0., BACKGROUND_COLOR))
.fill(BACKGROUND_COLOR); .fill(BACKGROUND_COLOR);
@@ -138,7 +120,14 @@ impl epi::App for MyEguiApp {
ui.ctx().request_repaint(); ui.ctx().request_repaint();
} }
if !status_string.is_empty() { if !status_string.is_empty() {
ui.label(status_string); if syncing {
ui.horizontal(|c| {
c.spinner();
c.label(&status_string);
});
} else {
ui.label(&status_string);
}
} }
let texture = self.get_import_image(ui); let texture = self.get_import_image(ui);
@@ -218,6 +207,14 @@ impl MyEguiApp {
} }
} }
fn setup(ctx: &egui::Context) {
#[cfg(target_family = "unix")]
ctx.set_pixels_per_point(1.0);
let mut style: egui::Style = (*ctx.style()).clone();
create_style(&mut style);
ctx.set_style(style);
}
pub fn run_sync() { pub fn run_sync() {
let mut app = MyEguiApp::new(); let mut app = MyEguiApp::new();
app.run_sync(); app.run_sync();
@@ -231,5 +228,12 @@ pub fn run_ui() -> Result<(), Box<dyn Error>> {
icon_data: Some(get_logo_icon()), icon_data: Some(get_logo_icon()),
..Default::default() ..Default::default()
}; };
eframe::run_native(Box::new(app), native_options); eframe::run_native(
"BoilR",
native_options,
Box::new(|cc| {
setup(&cc.egui_ctx);
Box::new(app)
}),
);
} }