summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2024-01-30 02:09:19 +0100
committerHugo Locurcio <hugo.locurcio@hugo.pro>2024-01-30 17:38:21 +0100
commit8e0f97ac968d559beb08d099fffc65cd9d785c15 (patch)
treed904620bb6b71a3beb058e4639174d4f8a9ced71 /src
parentMerge pull request #12846 from german77/mii_const (diff)
downloadyuzu-8e0f97ac968d559beb08d099fffc65cd9d785c15.tar
yuzu-8e0f97ac968d559beb08d099fffc65cd9d785c15.tar.gz
yuzu-8e0f97ac968d559beb08d099fffc65cd9d785c15.tar.bz2
yuzu-8e0f97ac968d559beb08d099fffc65cd9d785c15.tar.lz
yuzu-8e0f97ac968d559beb08d099fffc65cd9d785c15.tar.xz
yuzu-8e0f97ac968d559beb08d099fffc65cd9d785c15.tar.zst
yuzu-8e0f97ac968d559beb08d099fffc65cd9d785c15.zip
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/multiplayer/lobby_p.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/yuzu/multiplayer/lobby_p.h b/src/yuzu/multiplayer/lobby_p.h
index 068c95aca..398833e7a 100644
--- a/src/yuzu/multiplayer/lobby_p.h
+++ b/src/yuzu/multiplayer/lobby_p.h
@@ -193,12 +193,29 @@ public:
}
QVariant data(int role) const override {
- if (role != Qt::DisplayRole) {
+ switch (role) {
+ case Qt::DisplayRole: {
+ auto members = data(MemberListRole).toList();
+ return QStringLiteral("%1 / %2 ")
+ .arg(QString::number(members.size()), data(MaxPlayerRole).toString());
+ }
+ case Qt::ForegroundRole: {
+ auto members = data(MemberListRole).toList();
+ auto max_players = data(MaxPlayerRole).toInt();
+ if (members.size() >= max_players) {
+ return QBrush(QColor(255, 48, 32));
+ } else if (members.size() == (max_players - 1)) {
+ return QBrush(QColor(255, 140, 32));
+ } else if (members.size() == 0) {
+ return QBrush(QColor(128, 128, 128));
+ }
+ // 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)?
+ return QBrush(nullptr);
+ }
+ default:
return LobbyItem::data(role);
}
- auto members = data(MemberListRole).toList();
- return QStringLiteral("%1 / %2 ")
- .arg(QString::number(members.size()), data(MaxPlayerRole).toString());
}
bool operator<(const QStandardItem& other) const override {