From a6649d5401ab23f160c06b5aaa85d44fde4b11f2 Mon Sep 17 00:00:00 2001 From: Zach H Date: Thu, 6 Feb 2025 00:51:01 -0500 Subject: [PATCH] Add Judge Pawns (+ Resize Donator Pawns) (#5566) --- cockatrice/cockatrice.qrc | 2 + .../usericons/pawn_donator_double.svg | 16 +- .../usericons/pawn_donator_single.svg | 14 +- .../resources/usericons/pawn_judge_double.svg | 337 ++++++++++++++++++ .../resources/usericons/pawn_judge_single.svg | 212 +++++++++++ .../src/client/ui/pixel_map_generator.cpp | 13 +- .../src/client/ui/pixel_map_generator.h | 1 + 7 files changed, 576 insertions(+), 19 deletions(-) create mode 100644 cockatrice/resources/usericons/pawn_judge_double.svg create mode 100644 cockatrice/resources/usericons/pawn_judge_single.svg diff --git a/cockatrice/cockatrice.qrc b/cockatrice/cockatrice.qrc index 47fe135ea..32dbdd61c 100644 --- a/cockatrice/cockatrice.qrc +++ b/cockatrice/cockatrice.qrc @@ -333,6 +333,8 @@ resources/usericons/pawn_double.svg resources/usericons/pawn_donator_single.svg resources/usericons/pawn_donator_double.svg + resources/usericons/pawn_judge_single.svg + resources/usericons/pawn_judge_double.svg resources/usericons/pawn_vip_single.svg resources/usericons/pawn_vip_double.svg resources/usericons/star_single.svg diff --git a/cockatrice/resources/usericons/pawn_donator_double.svg b/cockatrice/resources/usericons/pawn_donator_double.svg index 22ebc98e5..f0dba08b2 100644 --- a/cockatrice/resources/usericons/pawn_donator_double.svg +++ b/cockatrice/resources/usericons/pawn_donator_double.svg @@ -310,15 +310,15 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="6.0735294" - inkscape:cx="53.75787" - inkscape:cy="53.922519" + inkscape:cx="53.675545" + inkscape:cy="53.922518" inkscape:current-layer="layer1" showgrid="false" - inkscape:window-width="2560" - inkscape:window-height="1369" - inkscape:window-x="2552" - inkscape:window-y="-8" - inkscape:window-maximized="1" + inkscape:window-width="1147" + inkscape:window-height="1211" + inkscape:window-x="2678" + inkscape:window-y="120" + inkscape:window-maximized="0" inkscape:showpageshadow="2" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" @@ -357,7 +357,7 @@ id="left" inkscape:connector-curvature="0" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/cockatrice/resources/usericons/pawn_judge_single.svg b/cockatrice/resources/usericons/pawn_judge_single.svg new file mode 100644 index 000000000..10246d42d --- /dev/null +++ b/cockatrice/resources/usericons/pawn_judge_single.svg @@ -0,0 +1,212 @@ + + + +image/svg+xml + + diff --git a/cockatrice/src/client/ui/pixel_map_generator.cpp b/cockatrice/src/client/ui/pixel_map_generator.cpp index 8cf2b3298..187068aa3 100644 --- a/cockatrice/src/client/ui/pixel_map_generator.cpp +++ b/cockatrice/src/client/ui/pixel_map_generator.cpp @@ -259,19 +259,23 @@ QIcon UserLevelPixmapGenerator::generateIcon(int minHeight, } QIcon icon = colorLeft.has_value() - ? generateIconWithColorOverride(minHeight, isBuddy, privLevel, colorLeft, colorRight) + ? generateIconWithColorOverride(minHeight, isBuddy, userLevel, privLevel, colorLeft, colorRight) : generateIconDefault(minHeight, userLevel, isBuddy, privLevel); iconCache.insert(key, icon); return icon; } -static QString getIconType(const bool isBuddy, const QString &privLevel) +static QString getIconType(const bool isBuddy, const UserLevelFlags &userLevelFlags, const QString &privLevel) { if (isBuddy) { return "star"; } + if (userLevelFlags.testFlag(ServerInfo_User_UserLevelFlag_IsJudge)) { + return "pawn_judge"; + } + if (!privLevel.isEmpty() && privLevel.toLower() != "none") { return QString("pawn_%1").arg(privLevel.toLower()); } @@ -284,7 +288,7 @@ QIcon UserLevelPixmapGenerator::generateIconDefault(int height, bool isBuddy, const QString &privLevel) { - const auto &iconType = getIconType(isBuddy, privLevel); + const auto &iconType = getIconType(isBuddy, userLevel, privLevel); QString arity = "single"; QString colorLeft; @@ -308,11 +312,12 @@ QIcon UserLevelPixmapGenerator::generateIconDefault(int height, QIcon UserLevelPixmapGenerator::generateIconWithColorOverride(int height, bool isBuddy, + const UserLevelFlags &userLevelFlags, const QString &privLevel, const std::optional &colorLeft, const std::optional &colorRight) { - const auto &iconType = getIconType(isBuddy, privLevel); + const auto &iconType = getIconType(isBuddy, userLevelFlags, privLevel); const QString &arity = colorRight.has_value() ? "double" : "single"; const auto &iconPath = QString("theme:usericons/%1_%2.svg").arg(iconType, arity); return loadAndColorSvg(iconPath, colorLeft.value(), colorRight, height); diff --git a/cockatrice/src/client/ui/pixel_map_generator.h b/cockatrice/src/client/ui/pixel_map_generator.h index 1fc49ef36..f35596bc8 100644 --- a/cockatrice/src/client/ui/pixel_map_generator.h +++ b/cockatrice/src/client/ui/pixel_map_generator.h @@ -70,6 +70,7 @@ private: static QIcon generateIconDefault(int height, UserLevelFlags userLevel, bool isBuddy, const QString &privLevel); static QIcon generateIconWithColorOverride(int height, bool isBuddy, + const UserLevelFlags &userLevelFlags, const QString &privLevel, const std::optional &colorLeft, const std::optional &colorRight);