mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-27 09:32:30 -06:00
multiplayer: minor UI fixes
Just two minor fixes: 1. Font color is black in dark theme. It is now only black for pings. 2. If a user is called `abc`, you can ping them by `@abc_`. Now a ping only takes effect when there are spaces around it.
This commit is contained in:
parent
4f23d5d69e
commit
5f0dcd52ae
1 changed files with 12 additions and 5 deletions
|
@ -42,8 +42,12 @@ public:
|
|||
cur_nickname = QString::fromStdString(room->GetNickname());
|
||||
cur_username = QString::fromStdString(room->GetUsername());
|
||||
}
|
||||
if (message.contains(QString("@").append(cur_nickname)) ||
|
||||
(!cur_username.isEmpty() && message.contains(QString("@").append(cur_username)))) {
|
||||
|
||||
// Handle pings at the beginning and end of message
|
||||
QString fixed_message = QString(" %1 ").arg(message);
|
||||
if (fixed_message.contains(QString(" @%1 ").arg(cur_nickname)) ||
|
||||
(!cur_username.isEmpty() &&
|
||||
fixed_message.contains(QString(" @%1 ").arg(cur_username)))) {
|
||||
|
||||
contains_ping = true;
|
||||
} else {
|
||||
|
@ -65,15 +69,18 @@ public:
|
|||
name = QString("%1 (%2)").arg(nickname, username);
|
||||
}
|
||||
|
||||
QString style;
|
||||
QString style, text_color;
|
||||
if (ContainsPing()) {
|
||||
// Add a background color to these messages
|
||||
style = QString("background-color: %1").arg(ping_color);
|
||||
// Add a font color
|
||||
text_color = "color='#000000'";
|
||||
}
|
||||
|
||||
return QString("[%1] <font color='%2'><%3></font> <font style='%4' "
|
||||
"color='#000000'>%5</font>")
|
||||
.arg(timestamp, color, name.toHtmlEscaped(), style, message.toHtmlEscaped());
|
||||
"%5>%6</font>")
|
||||
.arg(timestamp, color, name.toHtmlEscaped(), style, text_color,
|
||||
message.toHtmlEscaped());
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue