From 12cdc09759edf506fbafe051895343b20a67798c Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 17 Oct 2020 18:56:44 +0200 Subject: Matrix: make text that mentions us red --- include/Body.hpp | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'include/Body.hpp') diff --git a/include/Body.hpp b/include/Body.hpp index 7032ad8..e430bfb 100644 --- a/include/Body.hpp +++ b/include/Body.hpp @@ -44,11 +44,6 @@ namespace QuickMedia { dirty = true; } - void append_title(std::string str) { - title += str; - dirty = true; - } - void set_description(std::string new_description) { if(description.empty() && new_description.empty()) return; @@ -56,11 +51,6 @@ namespace QuickMedia { dirty_description = true; } - void append_description(std::string str) { - description += str; - dirty_description = true; - } - void set_author(std::string new_author) { if(author.empty() && new_author.empty()) return; @@ -75,11 +65,36 @@ namespace QuickMedia { dirty_timestamp = true; } + void set_title_color(sf::Color new_color) { + if(new_color != title_color) { + title_color = new_color; + dirty = true; + } + } + + void set_description_color(sf::Color new_color) { + if(new_color != description_color) { + description_color = new_color; + dirty_description = true; + } + } + + void set_author_color(sf::Color new_color) { + if(new_color != author_color) { + author_color = new_color; + dirty_author = true; + } + } + const std::string& get_title() const { return title; } const std::string& get_description() const { return description; } const std::string& get_author() const { return author; } time_t get_timestamp() const { return timestamp; } + sf::Color get_title_color() const { return title_color; } + sf::Color get_description_color() const { return description_color; } + sf::Color get_author_color() const { return author_color; } + // TODO: Use a list of strings instead, not all plugins need all of these fields std::string url; std::string thumbnail_url; @@ -97,8 +112,6 @@ namespace QuickMedia { // Used by image boards for example. The elements are indices to other body items std::vector replies; std::string post_number; - sf::Color title_color; - sf::Color author_color; void *userdata; // Not managed, should be deallocated by whoever sets this sf::Int32 last_drawn_time; EmbeddedItemStatus embedded_item_status = EmbeddedItemStatus::NONE; @@ -110,6 +123,9 @@ namespace QuickMedia { std::string description; std::string author; time_t timestamp; + sf::Color title_color; + sf::Color author_color; + sf::Color description_color; }; using BodyItems = std::vector>; -- cgit v1.2.3