X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatline-old.cpp;h=c26da15a7dc3067e1a75689fde407e19c359a4f0;hp=33b4d9ac5a90b53fa6af864eb6d4822e4e9d89fb;hb=cab361607b686847ee0df2e605f8f05598b65f99;hpb=3b29973a4fecd4658ced22aadc70555b86b8a0df diff --git a/src/qtui/chatline-old.cpp b/src/qtui/chatline-old.cpp index 33b4d9ac..c26da15a 100644 --- a/src/qtui/chatline-old.cpp +++ b/src/qtui/chatline-old.cpp @@ -19,6 +19,8 @@ ***************************************************************************/ #include "chatline-old.h" +#include "client.h" +#include "network.h" #include "qtui.h" //! Construct a ChatLine object from a message. @@ -31,6 +33,7 @@ ChatLine::ChatLine(Message m) { //bufferName = m.buffer.buffer(); msg = m; selectionMode = None; + isHighlight = false; formatMsg(msg); } @@ -39,6 +42,12 @@ ChatLine::~ChatLine() { } void ChatLine::formatMsg(Message msg) { + const Network *net = Client::network(msg.bufferInfo().networkId()); + if(net) { + QRegExp nickRegExp("^(.*\\W)?"+net->myNick()+"(\\W.*)?$"); + if((msg.type() == Message::Plain || msg.type() == Message::Notice || msg.type() == Message::Action) && nickRegExp.exactMatch(msg.text())) + isHighlight = true; + } QTextOption tsOption, senderOption, textOption; styledTimeStamp = QtUi::style()->styleString(msg.formattedTimestamp()); styledSender = QtUi::style()->styleString(msg.formattedSender()); @@ -314,8 +323,15 @@ void ChatLine::draw(QPainter *p, const QPointF &pos) { p->setPen(Qt::NoPen); p->setBrush(pal.brush(QPalette::Highlight)); p->drawRect(QRectF(pos, QSizeF(tsWidth + QtUi::style()->sepTsSender() + senderWidth + QtUi::style()->sepSenderText() + textWidth, height()))); - } else if(selectionMode == Partial) { + } else { + if(isHighlight) { + p->setPen(Qt::NoPen); + p->setBrush(pal.brush(QPalette::AlternateBase)); + p->drawRect(QRectF(pos, QSizeF(tsWidth + QtUi::style()->sepTsSender() + senderWidth + QtUi::style()->sepSenderText() + textWidth, height()))); + } + if(selectionMode == Partial) { + } } /* p->setClipRect(QRectF(pos, QSizeF(tsWidth, height()))); tsLayout.draw(p, pos, tsFormat);