aboutsummaryrefslogtreecommitdiff
path: root/src/aotextarea.cpp
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2021-12-25 22:57:51 -0600
committerGitHub <noreply@github.com>2021-12-25 22:57:51 -0600
commita180600bf4950cc547d11285a2ffbe46f7b63e9f (patch)
tree2d559417c88ed5ab28abf102694757cf5ae59448 /src/aotextarea.cpp
parentc57afe821e637fe08467848190a83553d913aaa6 (diff)
parentee1bcbe79240eb8bb50d0506028e9824b58e41f5 (diff)
Merge pull request #623 from AttorneyOnline/feature/debug-log
Remove MS chat and add debug log
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);