From 77ed51898157d99112be7550471ec06e32344c9e Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 11 Oct 2020 21:35:37 +0200 Subject: Refactor plugin into seperate pages TODO: Readd 4chan login page, manganelo creators page, autocomplete --- src/Body.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/Body.cpp') diff --git a/src/Body.cpp b/src/Body.cpp index 260e90d..ac63e0f 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -98,11 +98,6 @@ namespace QuickMedia { item_background.setFillColor(sf::Color(55, 60, 68)); } - Body::~Body() { - if(load_thumbnail_future.valid()) - load_thumbnail_future.get(); - } - // TODO: Make this work with wraparound enabled? // TODO: For plugins with different sized body items this can be weird, because after scrolling down thumbnails could load and they could move items up/down until we see items we haven't seen bool Body::select_previous_page() { @@ -250,6 +245,17 @@ namespace QuickMedia { } } + void Body::clear_cache() { + clear_text_cache(); + clear_thumbnails(); + } + + void Body::clear_text_cache() { + for(auto &body_item : items) { + clear_body_item_cache(body_item.get()); + } + } + void Body::clear_thumbnails() { item_thumbnail_textures.clear(); } @@ -566,7 +572,7 @@ namespace QuickMedia { if(draw_thumbnails) { if(!item->thumbnail_url.empty() && item_thumbnail->loading_state == LoadingState::NOT_LOADED) { - async_image_loader.load_thumbnail(item->thumbnail_url, item->thumbnail_is_local, thumbnail_resize_target_size, program->get_current_plugin()->use_tor, item_thumbnail); + async_image_loader.load_thumbnail(item->thumbnail_url, item->thumbnail_is_local, thumbnail_resize_target_size, program->is_tor_enabled(), item_thumbnail); } if(item_thumbnail->loading_state == LoadingState::FINISHED_LOADING && item_thumbnail->image->getSize().x > 0 && item_thumbnail->image->getSize().y > 0) { -- cgit v1.2.3