Merge pull request #559 from poixen/chatnamehighlight

Fixed #557
This commit is contained in:
poixen 2015-01-17 00:43:49 +01:00
commit 9b7f488bd7

View file

@ -171,16 +171,15 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
from = 1; from = 1;
} }
QTextCharFormat charFormat;
if (settingsCache->getChatMention()) { if (settingsCache->getChatMention()) {
if (message.toLower().contains("@" + QString::fromStdString(tabSupervisor->getUserInfo()->name()).toLower())) { if (message.toLower().contains("@" + QString::fromStdString(tabSupervisor->getUserInfo()->name()).toLower())) {
charFormat.setFontWeight(QFont::Bold); messageFormat.setFontWeight(QFont::Bold);
charFormat.setForeground(QBrush(QColor(255, 120, 0))); messageFormat.setForeground(QBrush(QColor(255, 120, 0)));
} }
} }
if (!message.isEmpty()) if (!message.isEmpty())
cursor.insertText(message, charFormat); cursor.insertText(message, messageFormat);
if (atBottom) if (atBottom)
verticalScrollBar()->setValue(verticalScrollBar()->maximum()); verticalScrollBar()->setValue(verticalScrollBar()->maximum());