aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmniTroid <davidskoland@gmail.com>2017-06-16 16:07:34 +0200
committerOmniTroid <davidskoland@gmail.com>2017-06-16 16:07:34 +0200
commit4796cc6677710859d0732e47d8536704da2807ad (patch)
tree62573550ca1757c270512f5ee08b7528db7d48d9
parentdc79673bee14efc6ed422dc37b231490686d8b5b (diff)
added bold OOC names and fixed the url regex
-rw-r--r--aotextarea.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/aotextarea.cpp b/aotextarea.cpp
index 8b83e540..d28ae4f4 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("<b>" + p_name.toHtmlEscaped() + "</b>:&nbsp;");
- 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", "<br>").replace(regExp, "<a href='\\1'>\\1</a>" );
+ QString result = p_message.toHtmlEscaped().replace("\n", "<br>").replace(omnis_dank_url_regex, "<a href='\\1'>\\1</a>" );
this->insertHtml(result);