mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 00:04:48 -07:00
Updated color setting
+ live preview added + will now only store the color if valid
This commit is contained in:
parent
ec8a2de2eb
commit
de38a294b5
4 changed files with 39 additions and 17 deletions
|
|
@ -116,9 +116,7 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
|
|||
|
||||
QTextCharFormat senderFormat;
|
||||
if (tabSupervisor && tabSupervisor->getUserInfo() && (sender == QString::fromStdString(tabSupervisor->getUserInfo()->name()))) {
|
||||
QColor customColor;
|
||||
customColor.setNamedColor("#" + settingsCache->getChatMentionColor());
|
||||
senderFormat.setForeground(customColor.isValid() ? QBrush(customColor) : QBrush(DEFAULT_MENTION_COLOR));
|
||||
senderFormat.setForeground(QBrush(getCustomMentionColor()));
|
||||
senderFormat.setFontWeight(QFont::Bold);
|
||||
} else {
|
||||
senderFormat.setForeground(QBrush(OTHER_USER_COLOR));
|
||||
|
|
@ -195,9 +193,7 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
|
|||
break;
|
||||
// you have been mentioned
|
||||
if (message.toLower().startsWith(mention)) {
|
||||
QColor customColor;
|
||||
customColor.setNamedColor("#" + settingsCache->getChatMentionColor());
|
||||
mentionFormat.setBackground(customColor.isValid() ? QBrush(customColor) : QBrush(DEFAULT_MENTION_COLOR));
|
||||
mentionFormat.setBackground(QBrush(getCustomMentionColor()));
|
||||
mentionFormat.setForeground(settingsCache->getChatMentionForeground() ? QBrush(Qt::white):QBrush(Qt::black));
|
||||
cursor.insertText("@" + userName, mentionFormat);
|
||||
message = message.mid(mention.size());
|
||||
|
|
@ -231,6 +227,12 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
|
|||
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
|
||||
}
|
||||
|
||||
QColor ChatView::getCustomMentionColor() {
|
||||
QColor customColor;
|
||||
customColor.setNamedColor("#" + settingsCache->getChatMentionColor());
|
||||
return customColor.isValid() ? customColor : DEFAULT_MENTION_COLOR;
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the correct case version of the provided username, if no correct casing version
|
||||
was found then the provided name is not available and will return an empty QString.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue