# HG changeset patch # User sheepluva # Date 1319411373 -7200 # Node ID 32b7e0ece99a88532d14ac1ae205ff3e96064d4d # Parent 4f234aa06182d2e0c772657d60734c03ab08dbaf improve and cash hilight regexp diff -r 4f234aa06182 -r 32b7e0ece99a QTfrontend/ui/widget/chatwidget.cpp --- a/QTfrontend/ui/widget/chatwidget.cpp Sun Oct 23 22:47:59 2011 +0200 +++ b/QTfrontend/ui/widget/chatwidget.cpp Mon Oct 24 01:09:33 2011 +0200 @@ -30,7 +30,6 @@ #include #include #include -#include #include "HWDataManager.h" @@ -468,10 +467,7 @@ bool isHL = (!nick.isEmpty() && (nick != m_userNick) && - str.toLower().contains( - QRegExp(QString("^(.* )?%1(( |: ).*)?$"). - arg(QRegExp::escape(m_userNick).toLower()))) - ); + str.toLower().contains(m_hlRegExp)); addLine(cssClass, formattedStr, isHL); } @@ -545,6 +541,8 @@ chatStrings.clear(); chatNicks->clear(); m_userNick = gameSettings->value("net/nick","").toString(); + m_hlRegExp = QRegExp(QString("^(.* )?%1(( |[^-a-z0-9_]( |$)).*)?$"). + arg(QRegExp::escape(m_userNick).toLower())); } void HWChatWidget::onKick() diff -r 4f234aa06182 -r 32b7e0ece99a QTfrontend/ui/widget/chatwidget.h --- a/QTfrontend/ui/widget/chatwidget.h Sun Oct 23 22:47:59 2011 +0200 +++ b/QTfrontend/ui/widget/chatwidget.h Mon Oct 24 01:09:33 2011 +0200 @@ -123,6 +123,7 @@ QString m_helloSound; QString m_hilightSound; QString m_userNick; + QRegExp m_hlRegExp; ///< regular expression used for highlighting messages bool notify; bool showReady;