mirror of
https://github.com/djibux/BoilR.git
synced 2026-09-01 14:03:42 +02:00
UI for image download refactor and fixes (#98)
This commit is contained in:
@@ -20,10 +20,11 @@ impl<'a> CachedSearch<'a> {
|
||||
save_search_map(&self.search_map);
|
||||
}
|
||||
|
||||
pub fn set_cache<S>(&mut self, app_id: u32, name:S, new_grid_id:usize)
|
||||
pub fn set_cache<S>(&mut self, app_id: u32, name: S, new_grid_id: usize)
|
||||
where
|
||||
S: Into<String>{
|
||||
self.search_map.insert(app_id,(name.into(),new_grid_id));
|
||||
S: Into<String>,
|
||||
{
|
||||
self.search_map.insert(app_id, (name.into(), new_grid_id));
|
||||
self.save();
|
||||
}
|
||||
|
||||
|
||||
@@ -248,9 +248,12 @@ async fn get_images_for_ids(
|
||||
image_search_result.map_err(|e| format!("Image search failed {:?}", e))
|
||||
}
|
||||
|
||||
const BIG_PICTURE_DIMS : [GridDimentions;2] = [GridDimentions::D920x430, GridDimentions::D460x215];
|
||||
const BIG_PICTURE_DIMS: [GridDimentions; 2] = [GridDimentions::D920x430, GridDimentions::D460x215];
|
||||
|
||||
pub fn get_query_type(download_animated: bool, image_type: &ImageType) -> steamgriddb_api::QueryType {
|
||||
pub fn get_query_type(
|
||||
download_animated: bool,
|
||||
image_type: &ImageType,
|
||||
) -> steamgriddb_api::QueryType {
|
||||
let anymation_type = if download_animated {
|
||||
Some(&[steamgriddb_api::query_parameters::AnimtionType::Animated][..])
|
||||
} else {
|
||||
@@ -366,6 +369,3 @@ pub struct ToDownload {
|
||||
pub app_name: String,
|
||||
pub image_type: ImageType,
|
||||
}
|
||||
|
||||
unsafe impl Send for ToDownload {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#[derive(Debug, Clone, Copy,PartialEq)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum ImageType {
|
||||
Hero,
|
||||
Grid,
|
||||
@@ -8,16 +8,21 @@ pub enum ImageType {
|
||||
Icon,
|
||||
}
|
||||
|
||||
pub const ALL_TYPES : [ImageType;6] =
|
||||
[ImageType::Hero,ImageType::Grid,ImageType::WideGrid,ImageType::Logo,ImageType::BigPicture,ImageType::Icon];
|
||||
pub const ALL_TYPES: [ImageType; 6] = [
|
||||
ImageType::Hero,
|
||||
ImageType::Grid,
|
||||
ImageType::WideGrid,
|
||||
ImageType::Logo,
|
||||
ImageType::BigPicture,
|
||||
ImageType::Icon,
|
||||
];
|
||||
|
||||
impl ImageType {
|
||||
|
||||
pub fn all() -> &'static [ImageType;6]{
|
||||
pub fn all() -> &'static [ImageType; 6] {
|
||||
&ALL_TYPES
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &str{
|
||||
pub fn name(&self) -> &str {
|
||||
match self {
|
||||
ImageType::Hero => "Hero",
|
||||
ImageType::Grid => "Grid",
|
||||
|
||||
Reference in New Issue
Block a user