From d274d3a6dfc0864ec6a44e7d6948c2d873eb6f76 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 11 Nov 2022 10:50:39 +0100 Subject: Add image (custom emoji) alt text for copy-pasting, limit custom emoji size in room description, change max size to 32, 32, cache custom emoji locally --- include/Text.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/Text.hpp b/include/Text.hpp index 245284f..89aba99 100644 --- a/include/Text.hpp +++ b/include/Text.hpp @@ -51,8 +51,9 @@ namespace QuickMedia } // If size is {0, 0} then the image is drawn at its original size - void create_image(std::string url, bool local, mgl::vec2i size) { + void create_image(std::string url, bool local, mgl::vec2i size, std::string alt) { this->url = std::move(url); + this->alt = std::move(alt); this->local = local; this->size = size; type = Type::IMAGE; @@ -68,6 +69,7 @@ namespace QuickMedia // TODO: Remove these std::string url; + std::string alt; bool local = false; mgl::vec2i pos; mgl::vec2i size; @@ -94,7 +96,7 @@ namespace QuickMedia const std::string& getString() const; void appendText(const std::string &str); // size = {0, 0} = keep original image size - static std::string formatted_image(const std::string &url, bool local, mgl::vec2i size); + static std::string formatted_image(const std::string &url, bool local, mgl::vec2i size, const std::string &alt); // text_flags is bit-or of FormattedTextFlag static std::string formatted_text(const std::string &text, mgl::Color color, uint8_t text_flags); void insert_text_at_caret_position(const std::string &str); -- cgit v1.2.3