mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
context menu for a message sender's name in chat; also display the user level icon next to the name; minor consistency and type-safety changes
This commit is contained in:
parent
f9e0b6fe9e
commit
95cd293b9c
30 changed files with 283 additions and 195 deletions
|
|
@ -110,7 +110,7 @@ void PlayerListWidget::updatePlayerProperties(const ServerInfo_PlayerProperties
|
|||
player->setIcon(2, gameStarted ? (prop.conceded() ? concededIcon : QIcon()) : (prop.ready_start() ? readyIcon : notReadyIcon));
|
||||
if (prop.has_user_info()) {
|
||||
player->setData(3, Qt::UserRole, prop.user_info().user_level());
|
||||
player->setIcon(3, QIcon(UserLevelPixmapGenerator::generatePixmap(12, prop.user_info().user_level())));
|
||||
player->setIcon(3, QIcon(UserLevelPixmapGenerator::generatePixmap(12, UserLevelFlags(prop.user_info().user_level()))));
|
||||
player->setText(4, QString::fromStdString(prop.user_info().name()));
|
||||
const QString country = QString::fromStdString(prop.user_info().country());
|
||||
if (!country.isEmpty())
|
||||
|
|
@ -172,7 +172,7 @@ void PlayerListWidget::showContextMenu(const QPoint &pos, const QModelIndex &ind
|
|||
|
||||
const QString &userName = index.sibling(index.row(), 4).data(Qt::UserRole).toString();
|
||||
int playerId = index.sibling(index.row(), 4).data(Qt::UserRole + 1).toInt();
|
||||
ServerInfo_User::UserLevelFlags userLevel = static_cast<ServerInfo_User::UserLevelFlags>(index.sibling(index.row(), 3).data(Qt::UserRole).toInt());
|
||||
UserLevelFlags userLevel(index.sibling(index.row(), 3).data(Qt::UserRole).toInt());
|
||||
|
||||
userContextMenu->showContextMenu(pos, userName, userLevel, playerId);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue