***************************************************************************/
#include "chatline-old.h"
+#include "client.h"
+#include "network.h"
#include "qtui.h"
//! Construct a ChatLine object from a message.
//bufferName = m.buffer.buffer();
msg = m;
selectionMode = None;
+ isHighlight = false;
formatMsg(msg);
}
}
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());
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);