rename ImageCache -> MediaCache
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use crate::persist::{AppSizeHandler, ZoomHandler};
|
||||
use crate::{
|
||||
Accounts, AppContext, Args, DataPath, DataPathType, Directory, FileKeyStorage, ImageCache,
|
||||
KeyStorageType, NoteCache, RelayDebugView, ThemeHandler, UnknownIds,
|
||||
Accounts, AppContext, Args, DataPath, DataPathType, Directory, FileKeyStorage, KeyStorageType,
|
||||
MediaCache, NoteCache, RelayDebugView, ThemeHandler, UnknownIds,
|
||||
};
|
||||
use egui::ThemePreference;
|
||||
use enostr::RelayPool;
|
||||
@@ -19,7 +19,7 @@ pub trait App {
|
||||
/// Main notedeck app framework
|
||||
pub struct Notedeck {
|
||||
ndb: Ndb,
|
||||
img_cache: ImageCache,
|
||||
img_cache: MediaCache,
|
||||
unknown_ids: UnknownIds,
|
||||
pool: RelayPool,
|
||||
note_cache: NoteCache,
|
||||
@@ -129,7 +129,7 @@ impl Notedeck {
|
||||
|
||||
let _ = std::fs::create_dir_all(&dbpath_str);
|
||||
|
||||
let img_cache_dir = path.path(DataPathType::Cache).join(ImageCache::rel_dir());
|
||||
let img_cache_dir = path.path(DataPathType::Cache).join(MediaCache::rel_dir());
|
||||
let _ = std::fs::create_dir_all(img_cache_dir.clone());
|
||||
|
||||
let map_size = if cfg!(target_os = "windows") {
|
||||
@@ -184,7 +184,7 @@ impl Notedeck {
|
||||
}
|
||||
}
|
||||
|
||||
let img_cache = ImageCache::new(img_cache_dir);
|
||||
let img_cache = MediaCache::new(img_cache_dir);
|
||||
let note_cache = NoteCache::default();
|
||||
let unknown_ids = UnknownIds::default();
|
||||
let zoom = ZoomHandler::new(&path);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::{Accounts, Args, DataPath, ImageCache, NoteCache, ThemeHandler, UnknownIds};
|
||||
use crate::{Accounts, Args, DataPath, MediaCache, NoteCache, ThemeHandler, UnknownIds};
|
||||
|
||||
use enostr::RelayPool;
|
||||
use nostrdb::Ndb;
|
||||
@@ -7,7 +7,7 @@ use nostrdb::Ndb;
|
||||
|
||||
pub struct AppContext<'a> {
|
||||
pub ndb: &'a mut Ndb,
|
||||
pub img_cache: &'a mut ImageCache,
|
||||
pub img_cache: &'a mut MediaCache,
|
||||
pub unknown_ids: &'a mut UnknownIds,
|
||||
pub pool: &'a mut RelayPool,
|
||||
pub note_cache: &'a mut NoteCache,
|
||||
|
||||
@@ -13,15 +13,15 @@ use std::path;
|
||||
use std::path::PathBuf;
|
||||
use tracing::warn;
|
||||
|
||||
pub type ImageCacheValue = Promise<Result<TextureHandle>>;
|
||||
pub type ImageCacheMap = HashMap<String, ImageCacheValue>;
|
||||
pub type MediaCacheValue = Promise<Result<TextureHandle>>;
|
||||
pub type MediaCacheMap = HashMap<String, MediaCacheValue>;
|
||||
|
||||
pub struct ImageCache {
|
||||
pub struct MediaCache {
|
||||
pub cache_dir: path::PathBuf,
|
||||
url_imgs: ImageCacheMap,
|
||||
url_imgs: MediaCacheMap,
|
||||
}
|
||||
|
||||
impl ImageCache {
|
||||
impl MediaCache {
|
||||
pub fn new(cache_dir: path::PathBuf) -> Self {
|
||||
Self {
|
||||
cache_dir,
|
||||
@@ -118,11 +118,11 @@ impl ImageCache {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn map(&self) -> &ImageCacheMap {
|
||||
pub fn map(&self) -> &MediaCacheMap {
|
||||
&self.url_imgs
|
||||
}
|
||||
|
||||
pub fn map_mut(&mut self) -> &mut ImageCacheMap {
|
||||
pub fn map_mut(&mut self) -> &mut MediaCacheMap {
|
||||
&mut self.url_imgs
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ pub use context::AppContext;
|
||||
pub use error::{Error, FilterError};
|
||||
pub use filter::{FilterState, FilterStates, UnifiedSubscription};
|
||||
pub use fonts::NamedFontFamily;
|
||||
pub use imgcache::ImageCache;
|
||||
pub use imgcache::MediaCache;
|
||||
pub use muted::{MuteFun, Muted};
|
||||
pub use note::{NoteRef, RootIdError, RootNoteId, RootNoteIdBuf};
|
||||
pub use notecache::{CachedNote, NoteCache};
|
||||
|
||||
Reference in New Issue
Block a user