mirror of
https://github.com/djibux/BoilR.git
synced 2026-09-01 05:53:41 +02:00
Fix clippy warnings and typos (#434)
* Fix clippy warnings. * Fixe more clippy warnings. * Fix exided lifetime warnings in clippy. * Fix errors. * Fix errors. --------- Co-authored-by: Guy Chronister <guyc.linux.patches@gmail.com>
This commit is contained in:
co-authored by
Guy Chronister
parent
6bc3908fe2
commit
f19bf2e30f
@@ -14,7 +14,7 @@ jobs:
|
|||||||
test_Ubuntu:
|
test_Ubuntu:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Rust Cache
|
- name: Rust Cache
|
||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
- name: dependencies
|
- name: dependencies
|
||||||
@@ -28,7 +28,7 @@ jobs:
|
|||||||
test_Windows:
|
test_Windows:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Install latest stable
|
- name: Install latest stable
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
@@ -41,7 +41,7 @@ jobs:
|
|||||||
# test_Macos:
|
# test_Macos:
|
||||||
# runs-on: macos-latest
|
# runs-on: macos-latest
|
||||||
# steps:
|
# steps:
|
||||||
# - uses: actions/checkout@v3
|
# - uses: actions/checkout@v4
|
||||||
# - name: Install latest stable
|
# - name: Install latest stable
|
||||||
# uses: actions-rs/toolchain@v1
|
# uses: actions-rs/toolchain@v1
|
||||||
# with:
|
# with:
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ jobs:
|
|||||||
asset_name: windows_BoilR.exe
|
asset_name: windows_BoilR.exe
|
||||||
strip: false
|
strip: false
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
if: ${{ matrix.os == 'ubuntu-latest'}}
|
if: ${{ matrix.os == 'ubuntu-latest'}}
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ jobs:
|
|||||||
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
|
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
- name: Install Rust toolchain
|
||||||
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1
|
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1
|
||||||
@@ -49,7 +49,7 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Upload analysis results to GitHub
|
- name: Upload analysis results to GitHub
|
||||||
uses: github/codeql-action/upload-sarif@v1
|
uses: github/codeql-action/upload-sarif@v2
|
||||||
with:
|
with:
|
||||||
sarif_file: rust-clippy-results.sarif
|
sarif_file: rust-clippy-results.sarif
|
||||||
wait-for-processing: true
|
wait-for-processing: true
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ impl EpicPlatform {
|
|||||||
};
|
};
|
||||||
|
|
||||||
egui::CollapsingHeader::new(safe_mode_header)
|
egui::CollapsingHeader::new(safe_mode_header)
|
||||||
.id_source("Epic_Launcher_safe_launch")
|
.id_salt("Epic_Launcher_safe_launch")
|
||||||
.show(ui, |ui| {
|
.show(ui, |ui| {
|
||||||
ui.label("Some games must be started from the Epic Launcher, select those games below and BoilR will create shortcuts that opens the games through the Epic Launcher.");
|
ui.label("Some games must be started from the Epic Launcher, select those games below and BoilR will create shortcuts that opens the games through the Epic Launcher.");
|
||||||
let manifests =self.epic_manifests.get_or_insert_with(||{
|
let manifests =self.epic_manifests.get_or_insert_with(||{
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ impl GamesPlatform for HeroicPlatform {
|
|||||||
(true, x) => format!("{x} games forced to launch directly"),
|
(true, x) => format!("{x} games forced to launch directly"),
|
||||||
};
|
};
|
||||||
|
|
||||||
egui::CollapsingHeader::new(safe_mode_header).id_source("Heroic_Launcher_safe_launch").show(ui, |ui| {
|
egui::CollapsingHeader::new(safe_mode_header).id_salt("Heroic_Launcher_safe_launch").show(ui, |ui| {
|
||||||
if self.settings.default_launch_through_heroic{
|
if self.settings.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.");
|
ui.label("Some games work best when launched directly, select those games below and BoilR will create shortcuts that launch the games directly.");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -38,15 +38,13 @@ fn parse_path(i: &[u8]) -> nom::IResult<&[u8], DbPaths> {
|
|||||||
|
|
||||||
let candidates = serde_json::from_str::<Vec<Candidate>>(&candidates_json);
|
let candidates = serde_json::from_str::<Vec<Candidate>>(&candidates_json);
|
||||||
match candidates {
|
match candidates {
|
||||||
Ok(candidates) => {
|
Ok(candidates) => IResult::Ok((
|
||||||
return IResult::Ok((
|
i,
|
||||||
i,
|
DbPaths {
|
||||||
DbPaths {
|
base_path,
|
||||||
base_path,
|
paths: candidates.iter().map(|c| c.path.clone()).collect(),
|
||||||
paths: candidates.iter().map(|c| c.path.clone()).collect(),
|
},
|
||||||
},
|
)),
|
||||||
))
|
|
||||||
}
|
|
||||||
Err(_err) => {
|
Err(_err) => {
|
||||||
//we found a basepath, but no executables
|
//we found a basepath, but no executables
|
||||||
IResult::Ok((
|
IResult::Ok((
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
use super::lutris_game::LutrisGame;
|
use super::lutris_game::LutrisGame;
|
||||||
|
|
||||||
pub fn parse_lutris_games(input: &str) -> Vec<LutrisGame> {
|
pub fn parse_lutris_games(input: &str) -> Vec<LutrisGame> {
|
||||||
let games = serde_json::from_str::<Vec<LutrisGame>>(input);
|
serde_json::from_str::<Vec<LutrisGame>>(input).unwrap_or_default()
|
||||||
match games {
|
|
||||||
Ok(games) => games,
|
|
||||||
Err(_err) => Vec::new(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@@ -3,4 +3,3 @@ mod platform;
|
|||||||
mod settings;
|
mod settings;
|
||||||
|
|
||||||
pub use platform::UplayPlatform;
|
pub use platform::UplayPlatform;
|
||||||
pub use settings::UplaySettings;
|
|
||||||
|
|||||||
+2
-2
@@ -90,11 +90,11 @@ pub fn get_shortcuts_paths(settings: &SteamSettings) -> eyre::Result<Vec<SteamUs
|
|||||||
let shortcuts_path = Path::new(path.as_str());
|
let shortcuts_path = Path::new(path.as_str());
|
||||||
let folder_string = folder_str.to_string();
|
let folder_string = folder_str.to_string();
|
||||||
if shortcuts_path.exists() {
|
if shortcuts_path.exists() {
|
||||||
return SteamUsersInfo {
|
SteamUsersInfo {
|
||||||
steam_user_data_folder: folder_string,
|
steam_user_data_folder: folder_string,
|
||||||
shortcut_path: Some(shortcuts_path.to_string_lossy().to_string()),
|
shortcut_path: Some(shortcuts_path.to_string_lossy().to_string()),
|
||||||
user_id,
|
user_id,
|
||||||
};
|
}
|
||||||
} else {
|
} else {
|
||||||
SteamUsersInfo {
|
SteamUsersInfo {
|
||||||
steam_user_data_folder: folder_string,
|
steam_user_data_folder: folder_string,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ pub struct CachedSearch<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CachedSearch<'a> {
|
impl<'a> CachedSearch<'a> {
|
||||||
pub fn new(client: &steamgriddb_api::Client) -> CachedSearch {
|
pub fn new(client: &'a steamgriddb_api::Client) -> CachedSearch<'a> {
|
||||||
CachedSearch {
|
CachedSearch {
|
||||||
search_map: get_search_map(),
|
search_map: get_search_map(),
|
||||||
client,
|
client,
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ impl SearchSettings for Settings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn download_images_for_users<'b>(
|
pub async fn download_images_for_users(
|
||||||
settings: &Settings,
|
settings: &Settings,
|
||||||
users: &[SteamUsersInfo],
|
users: &[SteamUsersInfo],
|
||||||
sender: &mut Option<Sender<SyncProgress>>,
|
sender: &mut Option<Sender<SyncProgress>>,
|
||||||
@@ -388,10 +388,10 @@ async fn get_steam_image_url(game_id: usize, image_type: &ImageType) -> Option<S
|
|||||||
d.platforms
|
d.platforms
|
||||||
.map(|p| p.steam.map(|s| s.metadata.map(|m| m.store_asset_mtime)))
|
.map(|p| p.steam.map(|s| s.metadata.map(|m| m.store_asset_mtime)))
|
||||||
});
|
});
|
||||||
if let (Some(Some(Some(steam_app_id))), Some(Some(Some(Some(Some(mtime)))))) =
|
if let (Some(Some(Some(steam_app_id))), Some(Some(Some(Some(mtime))))) =
|
||||||
(game_id, mtime)
|
(game_id, mtime)
|
||||||
{
|
{
|
||||||
return Some(image_type.steam_url(steam_app_id, mtime));
|
return Some(image_type.steam_url(steam_app_id.to_string(), mtime?));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -412,10 +412,10 @@ async fn get_steam_icon_url(game_id: usize) -> Option<String> {
|
|||||||
d.platforms
|
d.platforms
|
||||||
.map(|p| p.steam.map(|s| s.metadata.map(|m| m.clienticon)))
|
.map(|p| p.steam.map(|s| s.metadata.map(|m| m.clienticon)))
|
||||||
});
|
});
|
||||||
if let (Some(Some(Some(steam_app_id))), Some(Some(Some(Some(Some(mtime)))))) =
|
if let (Some(Some(Some(steam_app_id))), Some(Some(Some(Some(mtime))))) =
|
||||||
(game_id, mtime)
|
(game_id, mtime)
|
||||||
{
|
{
|
||||||
return Some(icon_url(&steam_app_id, &mtime));
|
return Some(icon_url(&steam_app_id.to_string(), &mtime?.to_string()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,6 @@ pub fn render_user_select<'a>(
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return steam_users.first();
|
steam_users.first()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
use steam_shortcuts_util::shortcut::ShortcutOwned;
|
use steam_shortcuts_util::shortcut::ShortcutOwned;
|
||||||
|
|
||||||
use crate::{steam::SteamUsersInfo, steamgriddb::ImageType, ui::FetcStatus};
|
use crate::{steam::SteamUsersInfo, steamgriddb::ImageType, ui::FetchStatus};
|
||||||
|
|
||||||
use super::{ gamemode::GameMode, possible_image::PossibleImage, gametype::GameType};
|
use super::{ gamemode::GameMode, possible_image::PossibleImage, gametype::GameType};
|
||||||
|
|
||||||
@@ -18,7 +17,7 @@ pub struct ImageSelectState {
|
|||||||
pub user_shortcuts: Option<Vec<ShortcutOwned>>,
|
pub user_shortcuts: Option<Vec<ShortcutOwned>>,
|
||||||
pub game_mode: GameMode,
|
pub game_mode: GameMode,
|
||||||
pub image_type_selected: Option<ImageType>,
|
pub image_type_selected: Option<ImageType>,
|
||||||
pub image_options: Receiver<FetcStatus<Vec<PossibleImage>>>,
|
pub image_options: Receiver<FetchStatus<Vec<PossibleImage>>>,
|
||||||
pub steam_games: Option<Vec<crate::steam::SteamGameInfo>>,
|
pub steam_games: Option<Vec<crate::steam::SteamGameInfo>>,
|
||||||
|
|
||||||
pub possible_names: Option<Vec<steamgriddb_api::search::SearchResult>>,
|
pub possible_names: Option<Vec<steamgriddb_api::search::SearchResult>>,
|
||||||
@@ -38,9 +37,8 @@ impl Default for ImageSelectState {
|
|||||||
game_mode: GameMode::Shortcuts,
|
game_mode: GameMode::Shortcuts,
|
||||||
image_type_selected: Default::default(),
|
image_type_selected: Default::default(),
|
||||||
possible_names: None,
|
possible_names: None,
|
||||||
image_options: watch::channel(FetcStatus::NeedsFetched).1,
|
image_options: watch::channel(FetchStatus::NeedsFetched).1,
|
||||||
steam_games: None,
|
steam_games: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ use crate::{
|
|||||||
constants::MAX_WIDTH, hasimagekey::HasImageKey, image_select_state::ImageSelectState,
|
constants::MAX_WIDTH, hasimagekey::HasImageKey, image_select_state::ImageSelectState,
|
||||||
possible_image::PossibleImage, useraction::UserAction,
|
possible_image::PossibleImage, useraction::UserAction,
|
||||||
},
|
},
|
||||||
FetcStatus, MyEguiApp,
|
FetchStatus, MyEguiApp,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ pub fn render_page_pick_image(
|
|||||||
let columns = (width / (column_width + column_padding)).floor() as u32;
|
let columns = (width / (column_width + column_padding)).floor() as u32;
|
||||||
let mut column = 0;
|
let mut column = 0;
|
||||||
match &*state.image_options.borrow() {
|
match &*state.image_options.borrow() {
|
||||||
FetcStatus::Fetched(images) => {
|
FetchStatus::Fetched(images) => {
|
||||||
let x = Grid::new("ImageThumbnailSelectGrid")
|
let x = Grid::new("ImageThumbnailSelectGrid")
|
||||||
.spacing([column_padding, column_padding])
|
.spacing([column_padding, column_padding])
|
||||||
.show(ui, |ui| {
|
.show(ui, |ui| {
|
||||||
@@ -128,7 +128,7 @@ pub fn handle_image_selected(app: &mut MyEguiApp, image: PossibleImage) {
|
|||||||
|
|
||||||
{
|
{
|
||||||
app.image_selected_state.image_type_selected = None;
|
app.image_selected_state.image_type_selected = None;
|
||||||
app.image_selected_state.image_options = watch::channel(FetcStatus::NeedsFetched).1;
|
app.image_selected_state.image_options = watch::channel(FetchStatus::NeedsFetched).1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use crate::{
|
|||||||
steam::{get_installed_games, SteamUsersInfo},
|
steam::{get_installed_games, SteamUsersInfo},
|
||||||
steamgriddb::{get_image_extension, get_query_type, ImageType},
|
steamgriddb::{get_image_extension, get_query_type, ImageType},
|
||||||
sync::{download_images, SyncProgress},
|
sync::{download_images, SyncProgress},
|
||||||
ui::{components::render_user_select, FetcStatus, MyEguiApp},
|
ui::{components::render_user_select, FetchStatus, MyEguiApp},
|
||||||
};
|
};
|
||||||
use egui::ScrollArea;
|
use egui::ScrollArea;
|
||||||
use futures::executor::block_on;
|
use futures::executor::block_on;
|
||||||
@@ -274,7 +274,7 @@ impl MyEguiApp {
|
|||||||
fn handle_image_type_selected(&mut self, image_type: ImageType) {
|
fn handle_image_type_selected(&mut self, image_type: ImageType) {
|
||||||
let state = &mut self.image_selected_state;
|
let state = &mut self.image_selected_state;
|
||||||
state.image_type_selected = Some(image_type);
|
state.image_type_selected = Some(image_type);
|
||||||
let (tx, rx) = watch::channel(FetcStatus::Fetching);
|
let (tx, rx) = watch::channel(FetchStatus::Fetching);
|
||||||
self.image_selected_state.image_options = rx;
|
self.image_selected_state.image_options = rx;
|
||||||
let settings = self.settings.clone();
|
let settings = self.settings.clone();
|
||||||
if let Some(auth_key) = settings.steamgrid_db.auth_key {
|
if let Some(auth_key) = settings.steamgrid_db.auth_key {
|
||||||
@@ -298,7 +298,7 @@ impl MyEguiApp {
|
|||||||
full_url: possible_image.url.clone(),
|
full_url: possible_image.url.clone(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let _ = tx.send(FetcStatus::Fetched(result));
|
let _ = tx.send(FetchStatus::Fetched(result));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use crate::sync::disconnect_shortcut;
|
|||||||
use crate::sync::IsBoilRShortcut;
|
use crate::sync::IsBoilRShortcut;
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct DiconnectState {
|
pub struct DisconnectState {
|
||||||
pub connected_shortcuts: Option<Result<Vec<ShortcutInfo>, String>>,
|
pub connected_shortcuts: Option<Result<Vec<ShortcutInfo>, String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ impl MyEguiApp {
|
|||||||
pub fn render_disconnect(&mut self, ui: &mut egui::Ui) {
|
pub fn render_disconnect(&mut self, ui: &mut egui::Ui) {
|
||||||
let steam_settings = self.settings.steam.clone();
|
let steam_settings = self.settings.steam.clone();
|
||||||
let users_info = self
|
let users_info = self
|
||||||
.disconect_state
|
.disconnect_state
|
||||||
.connected_shortcuts
|
.connected_shortcuts
|
||||||
.get_or_insert_with(|| {
|
.get_or_insert_with(|| {
|
||||||
let users = get_shortcuts_paths(&steam_settings)
|
let users = get_shortcuts_paths(&steam_settings)
|
||||||
@@ -56,7 +56,7 @@ impl MyEguiApp {
|
|||||||
|
|
||||||
for user in users.iter_mut() {
|
for user in users.iter_mut() {
|
||||||
if has_multiple_users {
|
if has_multiple_users {
|
||||||
ui.heading(&user.path.to_string_lossy().to_string());
|
ui.heading(user.path.to_string_lossy().to_string());
|
||||||
}
|
}
|
||||||
for shortcut in user.shortcuts.iter() {
|
for shortcut in user.shortcuts.iter() {
|
||||||
if shortcut.is_boilr_shortcut()
|
if shortcut.is_boilr_shortcut()
|
||||||
@@ -69,7 +69,7 @@ impl MyEguiApp {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if redraw != 0 {
|
if redraw != 0 {
|
||||||
self.disconect_state.connected_shortcuts = None;
|
self.disconnect_state.connected_shortcuts = None;
|
||||||
self.settings.blacklisted_games.push(redraw);
|
self.settings.blacklisted_games.push(redraw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,18 +22,18 @@ use super::{
|
|||||||
|
|
||||||
const SECTION_SPACING: f32 = 25.0;
|
const SECTION_SPACING: f32 = 25.0;
|
||||||
|
|
||||||
pub enum FetcStatus<T> {
|
pub enum FetchStatus<T> {
|
||||||
NeedsFetched,
|
NeedsFetched,
|
||||||
Fetching,
|
Fetching,
|
||||||
Fetched(T),
|
Fetched(T),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> FetcStatus<T> {
|
impl<T> FetchStatus<T> {
|
||||||
pub fn is_some(&self) -> bool {
|
pub fn is_some(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
FetcStatus::NeedsFetched => false,
|
FetchStatus::NeedsFetched => false,
|
||||||
FetcStatus::Fetching => false,
|
FetchStatus::Fetching => false,
|
||||||
FetcStatus::Fetched(_) => true,
|
FetchStatus::Fetched(_) => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,14 +58,14 @@ impl MyEguiApp {
|
|||||||
for (name,status) in &self.games_to_sync{
|
for (name,status) in &self.games_to_sync{
|
||||||
ui.heading(name);
|
ui.heading(name);
|
||||||
match &*status.borrow(){
|
match &*status.borrow(){
|
||||||
FetcStatus::NeedsFetched => {ui.label("Need to find games");},
|
FetchStatus::NeedsFetched => {ui.label("Need to find games");},
|
||||||
FetcStatus::Fetching => {
|
FetchStatus::Fetching => {
|
||||||
ui.horizontal(|ui|{
|
ui.horizontal(|ui|{
|
||||||
ui.spinner();
|
ui.spinner();
|
||||||
ui.label("Finding installed games");
|
ui.label("Finding installed games");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
FetcStatus::Fetched(shortcuts) => {
|
FetchStatus::Fetched(shortcuts) => {
|
||||||
match shortcuts{
|
match shortcuts{
|
||||||
Ok(shortcuts) => {
|
Ok(shortcuts) => {
|
||||||
if shortcuts.is_empty(){
|
if shortcuts.is_empty(){
|
||||||
|
|||||||
+9
-9
@@ -23,8 +23,8 @@ use super::{
|
|||||||
TEXT_COLOR,
|
TEXT_COLOR,
|
||||||
},
|
},
|
||||||
ui_images::get_logo_icon,
|
ui_images::get_logo_icon,
|
||||||
ui_import_games::FetcStatus,
|
ui_import_games::FetchStatus,
|
||||||
BackupState, DiconnectState,
|
BackupState, DisconnectState,
|
||||||
};
|
};
|
||||||
|
|
||||||
const SECTION_SPACING: f32 = 25.0;
|
const SECTION_SPACING: f32 = 25.0;
|
||||||
@@ -32,7 +32,7 @@ const SECTION_SPACING: f32 = 25.0;
|
|||||||
|
|
||||||
type GamesToSync = Vec<(
|
type GamesToSync = Vec<(
|
||||||
String,
|
String,
|
||||||
Receiver<FetcStatus<eyre::Result<Vec<ShortcutToImport>>>>,
|
Receiver<FetchStatus<eyre::Result<Vec<ShortcutToImport>>>>,
|
||||||
)>;
|
)>;
|
||||||
|
|
||||||
pub(crate) fn all_ready(games: &GamesToSync) -> bool {
|
pub(crate) fn all_ready(games: &GamesToSync) -> bool {
|
||||||
@@ -43,7 +43,7 @@ pub(crate) fn get_all_games(games: &GamesToSync) -> Vec<(String, Vec<ShortcutToI
|
|||||||
games
|
games
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|(name, rx)| {
|
.filter_map(|(name, rx)| {
|
||||||
if let FetcStatus::Fetched(Ok(data)) = &*rx.borrow() {
|
if let FetchStatus::Fetched(Ok(data)) = &*rx.borrow() {
|
||||||
Some((name.to_owned(), data.to_owned()))
|
Some((name.to_owned(), data.to_owned()))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@@ -60,7 +60,7 @@ pub struct MyEguiApp {
|
|||||||
pub(crate) status_reciever: Receiver<SyncProgress>,
|
pub(crate) status_reciever: Receiver<SyncProgress>,
|
||||||
pub(crate) image_selected_state: ImageSelectState,
|
pub(crate) image_selected_state: ImageSelectState,
|
||||||
pub(crate) backup_state: BackupState,
|
pub(crate) backup_state: BackupState,
|
||||||
pub(crate) disconect_state: DiconnectState,
|
pub(crate) disconnect_state: DisconnectState,
|
||||||
pub(crate) rename_map: HashMap<u32, String>,
|
pub(crate) rename_map: HashMap<u32, String>,
|
||||||
pub(crate) current_edit: Option<u32>,
|
pub(crate) current_edit: Option<u32>,
|
||||||
pub(crate) platforms: Platforms,
|
pub(crate) platforms: Platforms,
|
||||||
@@ -80,7 +80,7 @@ impl MyEguiApp {
|
|||||||
status_reciever: watch::channel(SyncProgress::NotStarted).1,
|
status_reciever: watch::channel(SyncProgress::NotStarted).1,
|
||||||
image_selected_state: ImageSelectState::default(),
|
image_selected_state: ImageSelectState::default(),
|
||||||
backup_state: BackupState::default(),
|
backup_state: BackupState::default(),
|
||||||
disconect_state: DiconnectState::default(),
|
disconnect_state: DisconnectState::default(),
|
||||||
rename_map: get_rename_map(),
|
rename_map: get_rename_map(),
|
||||||
current_edit: Option::None,
|
current_edit: Option::None,
|
||||||
platforms,
|
platforms,
|
||||||
@@ -160,13 +160,13 @@ fn create_games_to_sync(rt: &mut Runtime, platforms: &[Box<dyn GamesPlatform>])
|
|||||||
let mut to_sync = vec![];
|
let mut to_sync = vec![];
|
||||||
for platform in platforms {
|
for platform in platforms {
|
||||||
if platform.enabled() {
|
if platform.enabled() {
|
||||||
let (tx, rx) = watch::channel(FetcStatus::NeedsFetched);
|
let (tx, rx) = watch::channel(FetchStatus::NeedsFetched);
|
||||||
to_sync.push((platform.name().to_string(), rx));
|
to_sync.push((platform.name().to_string(), rx));
|
||||||
let platform = platform.clone();
|
let platform = platform.clone();
|
||||||
rt.spawn_blocking(move || {
|
rt.spawn_blocking(move || {
|
||||||
let _ = tx.send(FetcStatus::Fetching);
|
let _ = tx.send(FetchStatus::Fetching);
|
||||||
let games_to_sync = sync::get_platform_shortcuts(platform);
|
let games_to_sync = sync::get_platform_shortcuts(platform);
|
||||||
let _ = tx.send(FetcStatus::Fetched(games_to_sync));
|
let _ = tx.send(FetchStatus::Fetched(games_to_sync));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user