mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Changed color of server maessges in-game
Due to an exploit of being able to mimic a die roll in a message: "Hi all gl, hf ! username rolls a 20 with a 20-sided die." I have changed all server messages to be colored.
This commit is contained in:
parent
fd4f76289c
commit
71e794c0c6
3 changed files with 90 additions and 80 deletions
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
const QColor DEFAULT_MENTION_COLOR = QColor(194, 31, 47);
|
||||
const QColor OTHER_USER_COLOR = QColor(0, 65, 255); // dark blue
|
||||
const QString SERVER_MESSAGE_COLOR = "#851515";
|
||||
|
||||
ChatView::ChatView(const TabSupervisor *_tabSupervisor, TabGame *_game, bool _showTimestamps, QWidget *parent)
|
||||
: QTextBrowser(parent), tabSupervisor(_tabSupervisor), game(_game), evenNumber(true), showTimestamps(_showTimestamps), hoveredItemType(HoveredNothing)
|
||||
|
|
@ -73,6 +74,14 @@ void ChatView::appendHtml(const QString &html)
|
|||
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
|
||||
}
|
||||
|
||||
void ChatView::appendHtmlServerMessage(const QString &html)
|
||||
{
|
||||
bool atBottom = verticalScrollBar()->value() >= verticalScrollBar()->maximum();
|
||||
prepareBlock().insertHtml("<font color=" + SERVER_MESSAGE_COLOR + ">" + html + "</font>");
|
||||
if (atBottom)
|
||||
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
|
||||
}
|
||||
|
||||
void ChatView::appendCardTag(QTextCursor &cursor, const QString &cardName)
|
||||
{
|
||||
QTextCharFormat oldFormat = cursor.charFormat();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue