diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-10-11 21:35:37 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-10-13 13:13:01 +0200 |
commit | 77ed51898157d99112be7550471ec06e32344c9e (patch) | |
tree | 0645274d0f13b4fa6940d4054f74a070611a8ef0 /src/Body.cpp | |
parent | da89ec98fb34757f0c46dc8cb2dd87ae78d317ce (diff) |
Refactor plugin into seperate pages
TODO: Readd 4chan login page, manganelo creators page, autocomplete
Diffstat (limited to 'src/Body.cpp')
-rw-r--r-- | src/Body.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
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) { |