From 7097053723bab5cb91c312abaafeb69dc07dd4ac Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 24 Sep 2019 21:24:25 +0300 Subject: Change all instances of "colour" to "color" for consistency's sake Overhaul inline colors system to properly support additive text and further expansion Add two new colors - Gray and Blank, the latter being used for IC parsing. Instead of adding text symbol by symbol, reveal more of the already-rendered text instead so that it properly anticipates words that need to be on the newline. Changed the append_ic function slightly so it appends ": " to text only after it's no longer needed. Made gray color less inconsistent with everything else --- include/aoapplication.h | 2 +- include/aotextarea.h | 2 +- include/courtroom.h | 27 ++++----------------------- include/datatypes.h | 4 +++- 4 files changed, 9 insertions(+), 26 deletions(-) (limited to 'include') diff --git a/include/aoapplication.h b/include/aoapplication.h index 5fb63386..fef299b2 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -242,7 +242,7 @@ public: //Returns the color with p_identifier from p_file QColor get_color(QString p_identifier, QString p_file); - // Returns the colour from the misc folder. + // Returns the color from the misc folder. QColor get_chat_color(QString p_identifier, QString p_chat); //Returns the sfx with p_identifier from sounds.ini in the current theme path diff --git a/include/aotextarea.h b/include/aotextarea.h index 13b29c9e..643a8e34 100644 --- a/include/aotextarea.h +++ b/include/aotextarea.h @@ -13,7 +13,7 @@ public: AOTextArea(QWidget *p_parent = nullptr); void append_linked(QString p_message); - void append_chatmessage(QString p_name, QString p_message, QString p_colour); + void append_chatmessage(QString p_name, QString p_message, QString p_colur); void append_error(QString p_message); private: diff --git a/include/courtroom.h b/include/courtroom.h index 26018e2c..5aad1cb4 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -171,7 +171,7 @@ public: //sets text color based on text color in chatmessage void set_text_color(); - // And gets the colour, too! + // And gets the color, too! QColor get_text_color(QString color); //takes in serverD-formatted IP list as prints a converted version to server OOC @@ -202,7 +202,7 @@ public: //these are for OOC chat void append_ms_chatmessage(QString f_name, QString f_message); - void append_server_chatmessage(QString p_name, QString p_message, QString p_colour); + void append_server_chatmessage(QString p_name, QString p_message, QString p_color); //these functions handle chatmessages sequentially. //The process itself is very convoluted and merits separate documentation @@ -213,7 +213,7 @@ public: //This function filters out the common CC inline text trickery, for appending to //the IC chatlog. - QString filter_ic_text(QString p_text); + QString filter_ic_text(QString p_text, bool colorize = false, int pos = -1, int default_color = WHITE); //adds text to the IC chatlog. p_name first as bold then p_text then a newlin //this function keeps the chatlog scrolled to the top unless there's text selected @@ -259,18 +259,6 @@ private: QParallelAnimationGroup *screenshake_animation_group = new QParallelAnimationGroup; - // This is for inline message-colouring. - - enum INLINE_COLOURS { - INLINE_BLUE, - INLINE_GREEN, - INLINE_ORANGE, - INLINE_GREY - }; - - // A stack of inline colours. - std::stack inline_colour_stack; - bool next_character_is_not_special = false; // If true, write the // next character as it is. @@ -279,14 +267,6 @@ private: int current_display_speed = 3; int message_display_speed[7] = {0, 10, 25, 40, 50, 70, 90}; - // This is for checking if the character should start talking again - // when an inline blue text ends. - bool entire_message_is_blue = false; - - // And this is the inline 'talking checker'. Counts how 'deep' we are - // in inline blues. - int inline_blue_depth = 0; - // The character ID of the character this user wants to appear alongside with. int other_charid = -1; @@ -356,6 +336,7 @@ private: bool chatmessage_is_empty = false; QString previous_ic_message = ""; + QString additive_previous = ""; //char id, muted or not QMap mute_map; diff --git a/include/datatypes.h b/include/datatypes.h index 5426d981..1917482a 100644 --- a/include/datatypes.h +++ b/include/datatypes.h @@ -120,7 +120,9 @@ enum COLOR YELLOW, RAINBOW, PINK, - CYAN + CYAN, + GRAY, + BLANK }; #endif // DATATYPES_H -- cgit