From 473caaae1b2dbc3215d4dab1a37e9a53df618a7f Mon Sep 17 00:00:00 2001 From: RickyRister Date: Sat, 1 Feb 2025 18:39:25 -0800 Subject: [PATCH] clean up iconPath logic --- .../src/client/ui/pixel_map_generator.cpp | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/cockatrice/src/client/ui/pixel_map_generator.cpp b/cockatrice/src/client/ui/pixel_map_generator.cpp index a5d64f947..fd7818220 100644 --- a/cockatrice/src/client/ui/pixel_map_generator.cpp +++ b/cockatrice/src/client/ui/pixel_map_generator.cpp @@ -252,25 +252,19 @@ QIcon UserLevelPixmapGenerator::generateIconWithColorOverride(int height, return iconCache.value(key); } - QString iconPath; - if (colorRight.has_value()) { - if (isBuddy) { - iconPath = "theme:usericons/star_double.svg"; - } else if (privLevel.toLower() == "vip") { - iconPath = "theme:usericons/pawn_vip_double.svg"; - } else { - iconPath = "theme:usericons/pawn_double.svg"; - } + QString iconType; + if (isBuddy) { + iconType = "star"; + } else if (privLevel.toLower() == "vip") { + iconType = "pawn_vip"; } else { - if (isBuddy) { - iconPath = "theme:usericons/star_single.svg"; - } else if (privLevel.toLower() == "vip") { - iconPath = "theme:usericons/pawn_vip_single.svg"; - } else { - iconPath = "theme:usericons/pawn_single.svg"; - } + iconType = "pawn"; } + QString arity = colorRight.has_value() ? "double" : "single"; + + QString iconPath = QString("theme:usericons/%1_%2.svg").arg(iconType).arg(arity); + QIcon icon(changeSVGColor(iconPath, colorLeft.value(), colorRight)); iconCache.insert(key, icon); return icon;