From 4796cc6677710859d0732e47d8536704da2807ad Mon Sep 17 00:00:00 2001 From: OmniTroid Date: Fri, 16 Jun 2017 16:07:34 +0200 Subject: [PATCH] added bold OOC names and fixed the url regex --- aotextarea.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/aotextarea.cpp b/aotextarea.cpp index 8b83e54..d28ae4f 100644 --- a/aotextarea.cpp +++ b/aotextarea.cpp @@ -18,13 +18,16 @@ void AOTextArea::append_chatmessage(QString p_name, QString p_message) this->moveCursor(QTextCursor::End); - this->append(p_name + ": "); + this->append(""); + this->insertHtml("" + p_name.toHtmlEscaped() + ": "); - QRegExp regExp("((([A-Za-z]{3,9}:(?:\\/\\/)?)(?:[\\-;:&=\\+\\$,\\w]+@)?[A-Za-z0-9\\.\\-]+|(?:www\\.|[\\-;:&=\\+\\$,\\w]+@)[A-Za-z0-9\\.\\-]+)((?:\\/[\\+~%\\/\\.\\w\\-]*)?\\??(?:[\\-\\+=&;%@\\.\\w]*)#?(?:[\\.\\!\\/\\\\\\w]*))?)"); + //QRegExp regExp("((([A-Za-z]{3,9}:(?:\\/\\/)?)(?:[\\-;:&=\\+\\$,\\w]+@)?[A-Za-z0-9\\.\\-]+|(?:www\\.|[\\-;:&=\\+\\$,\\w]+@)[A-Za-z0-9\\.\\-]+)((?:\\/[\\+~%\\/\\.\\w\\-]*)?\\??(?:[\\-\\+=&;%@\\.\\w]*)#?(?:[\\.\\!\\/\\\\\\w]*))?)"); + + QRegExp omnis_dank_url_regex("\\b(https?://\\S+\\.\\S+)\\b"); //cheap workarounds ahoy p_message += " "; - QString result = p_message.toHtmlEscaped().replace("\n", "
").replace(regExp, "\\1" ); + QString result = p_message.toHtmlEscaped().replace("\n", "
").replace(omnis_dank_url_regex, "\\1" ); this->insertHtml(result);