Add custom server-side pawn colors (#5543)

This commit is contained in:
RickyRister 2025-02-01 19:25:25 -08:00 committed by GitHub
parent 0fc05e15cd
commit 95cea0f191
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 1748 additions and 49 deletions

View file

@ -191,8 +191,9 @@ void ChatView::appendMessage(QString message,
const int pixelSize = QFontInfo(cursor.charFormat().font()).pixelSize();
bool isBuddy = userListProxy->isUserBuddy(userName);
const QString privLevel = userInfo.has_privlevel() ? QString::fromStdString(userInfo.privlevel()) : "NONE";
cursor.insertImage(
UserLevelPixmapGenerator::generatePixmap(pixelSize, userLevel, isBuddy, privLevel).toImage());
cursor.insertImage(UserLevelPixmapGenerator::generatePixmap(pixelSize, userLevel, userInfo.pawn_colors(),
isBuddy, privLevel)
.toImage());
cursor.insertText(" ");
cursor.setCharFormat(senderFormat);
cursor.insertText(userName);

View file

@ -90,8 +90,8 @@ void UserInfoBox::updateInfo(const ServerInfo_User &user)
const std::string &bmp = user.avatar_bmp();
if (!avatarPixmap.loadFromData((const uchar *)bmp.data(), static_cast<uint>(bmp.size()))) {
avatarPixmap =
UserLevelPixmapGenerator::generatePixmap(64, userLevel, false, QString::fromStdString(user.privlevel()));
avatarPixmap = UserLevelPixmapGenerator::generatePixmap(64, userLevel, user.pawn_colors(), false,
QString::fromStdString(user.privlevel()));
}
nameLabel.setText(QString::fromStdString(user.name()));
@ -106,8 +106,8 @@ void UserInfoBox::updateInfo(const ServerInfo_User &user)
countryLabel3.setText("");
}
userLevelIcon.setPixmap(
UserLevelPixmapGenerator::generatePixmap(15, userLevel, false, QString::fromStdString(user.privlevel())));
userLevelIcon.setPixmap(UserLevelPixmapGenerator::generatePixmap(15, userLevel, user.pawn_colors(), false,
QString::fromStdString(user.privlevel())));
QString userLevelText;
if (userLevel.testFlag(ServerInfo_User::IsAdmin))
userLevelText = tr("Administrator");

View file

@ -344,8 +344,8 @@ void UserListTWI::setUserInfo(const ServerInfo_User &_userInfo)
userInfo = _userInfo;
setData(0, Qt::UserRole, userInfo.user_level());
setIcon(0, QIcon(UserLevelPixmapGenerator::generatePixmap(12, UserLevelFlags(userInfo.user_level()), false,
QString::fromStdString(userInfo.privlevel()))));
setIcon(0, UserLevelPixmapGenerator::generateIcon(12, UserLevelFlags(userInfo.user_level()), userInfo.pawn_colors(),
false, QString::fromStdString(userInfo.privlevel())));
setIcon(1, QIcon(CountryPixmapGenerator::generatePixmap(12, QString::fromStdString(userInfo.country()))));
setData(2, Qt::UserRole, QString::fromStdString(userInfo.name()));
setData(2, Qt::DisplayRole, QString::fromStdString(userInfo.name()));