mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 08:22:15 -07:00
Support database changes
This commit is contained in:
parent
1771ed68a4
commit
fb7d7b7750
2 changed files with 7 additions and 18 deletions
|
|
@ -329,6 +329,9 @@
|
|||
<file>resources/replay/fastforward.svg</file>
|
||||
<file>resources/replay/pause.svg</file>
|
||||
|
||||
<file>resources/usericons/pawn_single.svg</file>
|
||||
<file>resources/usericons/pawn_double.svg</file>
|
||||
|
||||
<file>resources/userlevels/normal.svg</file>
|
||||
<file>resources/userlevels/registered.svg</file>
|
||||
<file>resources/userlevels/registered_buddy.svg</file>
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ QIcon changeSVGColor(const QString &iconPath, const QString &colorLeft, const st
|
|||
{
|
||||
QFile file(iconPath);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
qWarning() << "Unable to open" << iconPath;
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
@ -139,8 +140,6 @@ QIcon changeSVGColor(const QString &iconPath, const QString &colorLeft, const st
|
|||
SetAttrRecur(docElem, "path", "fill", "right", colorRight.value());
|
||||
}
|
||||
|
||||
qDebug() << "ZACH" << doc.toString();
|
||||
|
||||
QSvgRenderer svgRenderer(doc.toByteArray());
|
||||
|
||||
QPixmap pix(svgRenderer.defaultSize());
|
||||
|
|
@ -168,19 +167,6 @@ QIcon UserLevelPixmapGenerator::generateIcon(int height,
|
|||
bool isBuddy,
|
||||
QString privLevel)
|
||||
{
|
||||
QString singlePawnPath =
|
||||
"C:\\Users\\ZaHal\\Documents\\Development\\cockatrice\\cockatrice\\resources\\usericons\\pawn_single.svg";
|
||||
QString doublePawnPath =
|
||||
"C:\\Users\\ZaHal\\Documents\\Development\\cockatrice\\cockatrice\\resources\\usericons\\pawn_double.svg";
|
||||
|
||||
const auto &r = rand() > (RAND_MAX / 2);
|
||||
|
||||
pawnColorsOverride.set_left_side("#ff0000");
|
||||
|
||||
if (r == 0) {
|
||||
pawnColorsOverride.set_right_side("#00ff00");
|
||||
}
|
||||
|
||||
std::optional<QString> colorLeft = std::nullopt;
|
||||
if (pawnColorsOverride.has_left_side()) {
|
||||
colorLeft = QString::fromStdString(pawnColorsOverride.left_side());
|
||||
|
|
@ -192,7 +178,7 @@ QIcon UserLevelPixmapGenerator::generateIcon(int height,
|
|||
}
|
||||
|
||||
// Has Color Override
|
||||
if (colorLeft.has_value() || colorRight.has_value()) {
|
||||
if (colorLeft.has_value()) {
|
||||
QString key = QString::number(height * 10000) + ":" + colorLeft.value_or("") + ":" + colorRight.value_or("");
|
||||
if (iconCache.contains(key)) {
|
||||
return iconCache.value(key);
|
||||
|
|
@ -200,9 +186,9 @@ QIcon UserLevelPixmapGenerator::generateIcon(int height,
|
|||
|
||||
QIcon icon;
|
||||
if (colorRight.has_value()) {
|
||||
icon = changeSVGColor(doublePawnPath, colorLeft.value(), colorRight);
|
||||
icon = changeSVGColor("theme:usericons/pawn_double.svg", colorLeft.value(), colorRight);
|
||||
} else {
|
||||
icon = changeSVGColor(singlePawnPath, colorLeft.value(), std::nullopt);
|
||||
icon = changeSVGColor("theme:usericons/pawn_single.svg", colorLeft.value(), colorRight);
|
||||
}
|
||||
|
||||
iconCache.insert(key, icon);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue