diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-09-11 04:08:16 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-09-11 04:08:16 +0200 |
commit | 043b54f9d5c06257e33c9a0989158d9a99368e26 (patch) | |
tree | deeb5986f49af47806143dab6ca9499faa5675f2 | |
parent | 8aaf837c6f223c77563b6ed03eb7576163f784bb (diff) |
Cleanup thumbnail textures when hiding related videos menu
-rw-r--r-- | include/Body.hpp | 1 | ||||
-rw-r--r-- | src/Body.cpp | 5 | ||||
-rw-r--r-- | src/QuickMedia.cpp | 2 |
3 files changed, 8 insertions, 0 deletions
diff --git a/include/Body.hpp b/include/Body.hpp index a3058a6..db502c5 100644 --- a/include/Body.hpp +++ b/include/Body.hpp @@ -66,6 +66,7 @@ namespace QuickMedia { void select_first_item(); void reset_selected(); void clear_items(); + void clear_thumbnails(); BodyItem* get_selected() const; diff --git a/src/Body.cpp b/src/Body.cpp index 61d100b..a9dc18f 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -74,6 +74,10 @@ namespace QuickMedia { selected_item = 0; } + void Body::clear_thumbnails() { + item_thumbnail_textures.clear(); + } + BodyItem* Body::get_selected() const { if(items.empty() || !items[selected_item]->visible) return nullptr; @@ -186,6 +190,7 @@ namespace QuickMedia { } if(draw_thumbnails && !item->thumbnail_url.empty()) { auto &item_thumbnail = item_thumbnail_textures[item->thumbnail_url]; + item_thumbnail.referenced = false; float image_height = image_max_height; if(item_thumbnail.texture && item_thumbnail.texture->getNativeHandle() != 0) { auto image_size = item_thumbnail.texture->getSize(); diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 4cbf752..f6d28f8 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -1090,6 +1090,7 @@ namespace QuickMedia { current_page = previous_page; } else { related_media_body->clear_items(); + related_media_body->clear_thumbnails(); related_media_body->items = current_plugin->get_related_media(content_url); // TODO: Make this also work for other video plugins @@ -1215,6 +1216,7 @@ namespace QuickMedia { } else if(event.key.code == sf::Keyboard::R && event.key.control) { related_media_window_visible = false; related_media_window->setVisible(related_media_window_visible); + related_media_body->clear_thumbnails(); } else if(event.key.code == sf::Keyboard::Enter) { BodyItem *selected_item = related_media_body->get_selected(); if(!selected_item) |