From a8e0846a7c111a8d5b5cf8592ecb9b9bbd15ce26 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 22 Sep 2020 22:46:29 +0200 Subject: Initial file manager implementation, with thumbnail caching --- include/Body.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include/Body.hpp') diff --git a/include/Body.hpp b/include/Body.hpp index 0bea3c2..4e30684 100644 --- a/include/Body.hpp +++ b/include/Body.hpp @@ -42,11 +42,12 @@ namespace QuickMedia { // TODO: Use a list of strings instead, not all plugins need all of these fields std::string url; std::string thumbnail_url; - std::string attached_content_url; + std::string attached_content_url; // TODO: Remove and use |url| instead std::string author; bool visible; bool dirty; bool dirty_description; + bool thumbnail_is_local; std::unique_ptr title_text; std::unique_ptr description_text; // Used by image boards for example. The elements are indices to other body items @@ -103,13 +104,17 @@ namespace QuickMedia { std::thread thumbnail_load_thread; bool draw_thumbnails; bool wrap_around; + // Set to {0, 0} to disable resizing + sf::Vector2i thumbnail_resize_target_size; + sf::Vector2f thumbnail_fallback_size; private: struct ThumbnailData { bool referenced; std::shared_ptr texture; + bool loaded = false; }; Program *program; - std::shared_ptr load_thumbnail_from_url(const std::string &url); + std::shared_ptr load_thumbnail_from_url(const std::string &url, bool local, sf::Vector2i thumbnail_resize_target_size); std::unordered_map item_thumbnail_textures; bool loading_thumbnail; int selected_item; -- cgit v1.2.3