aboutsummaryrefslogtreecommitdiff
path: root/src/aotextarea.cpp
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2021-12-25 19:17:27 -0600
committeroldmud0 <oldmud0@users.noreply.github.com>2021-12-25 19:17:27 -0600
commitecfe6f2542d73e9559b75a502f6eebffe63a76cf (patch)
tree6ceea4666ade907af6e9a1ac79e5dc4763403c49 /src/aotextarea.cpp
parentd1fb7fde16ec37dfa7b13e0a02489417655d315d (diff)
Change master chat in courtroom to debug log
Since the MS chat has been disabled for quite some time now (and we aren't planning on bringing it back since Discord, Guilded etc. have better chat features), I decided to go ahead and change the pane into a debug log to keep it useful and avoid creating a gaping hole in themes. Though, maybe it is worth removing the whole switcher and keeping the debug log hidden away where it can't scare people.
Diffstat (limited to 'src/aotextarea.cpp')
-rw-r--r--src/aotextarea.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/aotextarea.cpp b/src/aotextarea.cpp
index 52e32f55..3513d221 100644
--- a/src/aotextarea.cpp
+++ b/src/aotextarea.cpp
@@ -11,7 +11,7 @@ void AOTextArea::append_linked(QString p_message)
}
void AOTextArea::append_chatmessage(QString p_name, QString p_message,
- QString p_colour)
+ QString p_name_colour, QString p_color)
{
const QTextCursor old_cursor = this->textCursor();
const int old_scrollbar_value = this->verticalScrollBar()->value();
@@ -21,15 +21,22 @@ void AOTextArea::append_chatmessage(QString p_name, QString p_message,
this->moveCursor(QTextCursor::End);
this->append("");
- this->insertHtml("<b><font color=" + p_colour + ">" + p_name.toHtmlEscaped() +
- "</font></b>:&nbsp;");
+ if (!p_name.isEmpty()) {
+ this->insertHtml("<b><font color=" + p_name_colour + ">" + p_name.toHtmlEscaped() +
+ "</font></b>:&nbsp;");
+
+ // cheap workarounds ahoy
+ p_message += " ";
+ }
- // cheap workarounds ahoy
- p_message += " ";
QString result = p_message.toHtmlEscaped()
.replace("\n", "<br>")
.replace(url_parser_regex, "<a href='\\1'>\\1</a>");
+ if (!p_color.isEmpty()) {
+ result = "<font color=" + p_color + ">" + result + "</font>";
+ }
+
this->insertHtml(result);
this->auto_scroll(old_cursor, old_scrollbar_value, is_scrolled_down);