diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-09-22 22:46:29 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-09-22 23:23:13 +0200 |
commit | a8e0846a7c111a8d5b5cf8592ecb9b9bbd15ce26 (patch) | |
tree | 0ada7bf9bcb31fffd698e261d8ecfc0c85f1d2de /include/Body.hpp | |
parent | a29f310b8ad0b088860fe05a5499bccef963a503 (diff) |
Initial file manager implementation, with thumbnail caching
Diffstat (limited to 'include/Body.hpp')
-rw-r--r-- | include/Body.hpp | 9 |
1 files changed, 7 insertions, 2 deletions
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<Text> title_text; std::unique_ptr<Text> 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<sf::Texture> texture; + bool loaded = false; }; Program *program; - std::shared_ptr<sf::Texture> load_thumbnail_from_url(const std::string &url); + std::shared_ptr<sf::Texture> load_thumbnail_from_url(const std::string &url, bool local, sf::Vector2i thumbnail_resize_target_size); std::unordered_map<std::string, ThumbnailData> item_thumbnail_textures; bool loading_thumbnail; int selected_item; |