mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-28 08:52:19 -07:00
Highlight not found but attempted tag
Took 6 minutes
This commit is contained in:
parent
2580d23a6f
commit
cd6ab95ed8
2 changed files with 14 additions and 7 deletions
|
|
@ -63,12 +63,14 @@ void ChatView::adjustColorsToPalette()
|
||||||
serverMessageColor = QColor(0xFF, 0x73, 0x83);
|
serverMessageColor = QColor(0xFF, 0x73, 0x83);
|
||||||
otherUserColor = otherUserColor.lighter(150);
|
otherUserColor = otherUserColor.lighter(150);
|
||||||
linkColor = QColor(71, 158, 252);
|
linkColor = QColor(71, 158, 252);
|
||||||
|
unresolvedCardTagColor = QColor(0xFF, 0x73, 0x83);
|
||||||
} else {
|
} else {
|
||||||
document()->setDefaultStyleSheet(R"(
|
document()->setDefaultStyleSheet(R"(
|
||||||
a { text-decoration: none; color: blue; }
|
a { text-decoration: none; color: blue; }
|
||||||
.blue { color: blue }
|
.blue { color: blue }
|
||||||
)");
|
)");
|
||||||
linkColor = palette().link().color();
|
linkColor = palette().link().color();
|
||||||
|
unresolvedCardTagColor = QColor(0x85, 0x15, 0x15);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTimer::singleShot(0, this, &ChatView::refreshBlockColors);
|
QTimer::singleShot(0, this, &ChatView::refreshBlockColors);
|
||||||
|
|
@ -173,19 +175,23 @@ void ChatView::appendHtmlServerMessage(const QString &html, bool optionalIsBold,
|
||||||
|
|
||||||
void ChatView::appendCardTag(QTextCursor &cursor, const QString &cardName)
|
void ChatView::appendCardTag(QTextCursor &cursor, const QString &cardName)
|
||||||
{
|
{
|
||||||
|
QTextCharFormat oldFormat = cursor.charFormat();
|
||||||
|
QTextCharFormat cardFormat = oldFormat;
|
||||||
|
cardFormat.setFontItalic(true);
|
||||||
|
|
||||||
if (!CardDatabaseManager::query()->lookupCardByName(cardName)) {
|
if (!CardDatabaseManager::query()->lookupCardByName(cardName)) {
|
||||||
|
cardFormat.setForeground(unresolvedCardTagColor);
|
||||||
|
cursor.setCharFormat(cardFormat);
|
||||||
cursor.insertText(cardName);
|
cursor.insertText(cardName);
|
||||||
|
cursor.setCharFormat(oldFormat);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextCharFormat oldFormat = cursor.charFormat();
|
cardFormat.setForeground(linkColor);
|
||||||
QTextCharFormat anchorFormat = oldFormat;
|
cardFormat.setAnchor(true);
|
||||||
anchorFormat.setForeground(linkColor);
|
cardFormat.setAnchorHref("card://" + cardName);
|
||||||
anchorFormat.setAnchor(true);
|
|
||||||
anchorFormat.setAnchorHref("card://" + cardName);
|
|
||||||
anchorFormat.setFontItalic(true);
|
|
||||||
|
|
||||||
cursor.setCharFormat(anchorFormat);
|
cursor.setCharFormat(cardFormat);
|
||||||
cursor.insertText(cardName);
|
cursor.insertText(cardName);
|
||||||
cursor.setCharFormat(oldFormat);
|
cursor.setCharFormat(oldFormat);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ private:
|
||||||
QColor otherUserColor = QColor(0, 65, 255); // dark blue
|
QColor otherUserColor = QColor(0, 65, 255); // dark blue
|
||||||
QColor serverMessageColor = QColor(0x85, 0x15, 0x15);
|
QColor serverMessageColor = QColor(0x85, 0x15, 0x15);
|
||||||
QColor linkColor;
|
QColor linkColor;
|
||||||
|
QColor unresolvedCardTagColor;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void openLink(const QUrl &link);
|
void openLink(const QUrl &link);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue