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
+1 -1
View File
@@ -13,7 +13,7 @@ pub mod ui_colors {
pub mod ui_images {
use std::path::Path;
use eframe::epi::IconData;
use eframe::IconData;
use egui::{ColorImage, ImageData};
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::{
config::get_thumbnails_folder,
steam::{get_installed_games, SteamGameInfo},
steam::{get_shortcuts_paths, SteamUsersInfo},
steamgriddb::{get_image_extension, get_query_type, CachedSearch, ImageType, ToDownload},
steam::{get_installed_games, SteamGameInfo},
};
use dashmap::DashMap;
use egui::{ImageButton, ScrollArea};
@@ -262,7 +262,10 @@ impl MyEguiApp {
TextureState::Downloading => {
ui.ctx().request_repaint();
//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 => {
//Need to load
@@ -272,7 +275,10 @@ impl MyEguiApp {
*state.value_mut() = TextureState::Loaded(handle);
}
ui.ctx().request_repaint();
ui.label("Loading");
ui.horizontal(|ui| {
ui.spinner();
ui.label("Loading");
});
}
TextureState::Loaded(texture_handle) => {
//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();
}
}
@@ -732,8 +741,8 @@ impl HasImageKey for GameType {
impl HasImageKey for SteamGameInfo {
fn key(&self, image_type: &ImageType, user_path: &Path) -> (PathBuf, String) {
let mut keys = POSSIBLE_EXTENSIONS
.iter()
.map(|ext| key_from_extension(self.appid, image_type, user_path, ext));
.iter()
.map(|ext| key_from_extension(self.appid, image_type, user_path, ext));
let first = keys.next().unwrap();
let other = keys.filter(|(exsists, _, _)| *exsists).next();
let (_, path, key) = other.unwrap_or(first);
+8 -1
View File
@@ -84,7 +84,10 @@ impl MyEguiApp {
},
_=> {
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 task = download_images(&settings, &usersinfo, &mut some_sender);
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 {
let _ = sender.send(SyncProgress::Done);
}
+27 -23
View File
@@ -1,6 +1,6 @@
use std::error::Error;
use eframe::{egui, epi};
use eframe::{egui, App, Frame};
use egui::{ImageButton, Rounding, Stroke, TextureHandle};
use steam_shortcuts_util::shortcut::ShortcutOwned;
use tokio::{
@@ -68,26 +68,8 @@ impl Default for Menues {
}
}
impl epi::App for MyEguiApp {
fn name(&self) -> &str {
"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) {
impl App for MyEguiApp {
fn update(&mut self, ctx: &egui::Context, _frame: &mut Frame) {
let frame = egui::Frame::default()
.stroke(Stroke::new(0., BACKGROUND_COLOR))
.fill(BACKGROUND_COLOR);
@@ -138,7 +120,14 @@ impl epi::App for MyEguiApp {
ui.ctx().request_repaint();
}
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);
@@ -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() {
let mut app = MyEguiApp::new();
app.run_sync();
@@ -231,5 +228,12 @@ pub fn run_ui() -> Result<(), Box<dyn Error>> {
icon_data: Some(get_logo_icon()),
..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)
}),
);
}