Fix multiplayer player count color in dark themes | Temp fix until #12744: Add green color for counts > 0 and < max_players - 1 (#12930)
* fix intended player count color in dark themes * Refactor * Change to green color for white and dark themes * Add const to the colors and extra name for green color
This commit is contained in:
parent
52c8adc7ed
commit
fe6934593f
|
@ -202,12 +202,19 @@ public:
|
||||||
case Qt::ForegroundRole: {
|
case Qt::ForegroundRole: {
|
||||||
auto members = data(MemberListRole).toList();
|
auto members = data(MemberListRole).toList();
|
||||||
auto max_players = data(MaxPlayerRole).toInt();
|
auto max_players = data(MaxPlayerRole).toInt();
|
||||||
|
const QColor room_full_color(255, 48, 32);
|
||||||
|
const QColor room_almost_full_color(255, 140, 32);
|
||||||
|
const QColor room_has_players_color(32, 160, 32);
|
||||||
|
const QColor room_empty_color(128, 128, 128);
|
||||||
|
|
||||||
if (members.size() >= max_players) {
|
if (members.size() >= max_players) {
|
||||||
return QBrush(QColor(255, 48, 32));
|
return QBrush(room_full_color);
|
||||||
} else if (members.size() == (max_players - 1)) {
|
} else if (members.size() == (max_players - 1)) {
|
||||||
return QBrush(QColor(255, 140, 32));
|
return QBrush(room_almost_full_color);
|
||||||
} else if (members.size() == 0) {
|
} else if (members.size() == 0) {
|
||||||
return QBrush(QColor(128, 128, 128));
|
return QBrush(room_empty_color);
|
||||||
|
} else if (members.size() > 0 && members.size() < (max_players - 1)) {
|
||||||
|
return QBrush(room_has_players_color);
|
||||||
}
|
}
|
||||||
// FIXME: How to return a value that tells Qt not to modify the
|
// FIXME: How to return a value that tells Qt not to modify the
|
||||||
// text color from the default (as if Qt::ForegroundRole wasn't overridden)?
|
// text color from the default (as if Qt::ForegroundRole wasn't overridden)?
|
||||||
|
|
Reference in New Issue