mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 08:52:15 -07:00
do it in a way that doesn't cause warnings to be logged
This commit is contained in:
parent
2f9bd0f11c
commit
0cc75879ce
1 changed files with 7 additions and 0 deletions
|
|
@ -61,6 +61,11 @@ QMap<QString, QPixmap> CounterPixmapGenerator::pmCache;
|
||||||
|
|
||||||
QPixmap CounterPixmapGenerator::generatePixmap(int height, QString name, bool highlight)
|
QPixmap CounterPixmapGenerator::generatePixmap(int height, QString name, bool highlight)
|
||||||
{
|
{
|
||||||
|
// The colorless counter is named "x" by the server but the file is named "general.svg"
|
||||||
|
if (name == "x") {
|
||||||
|
name = "general";
|
||||||
|
}
|
||||||
|
|
||||||
if (highlight)
|
if (highlight)
|
||||||
name.append("_highlight");
|
name.append("_highlight");
|
||||||
QString key = name + QString::number(height);
|
QString key = name + QString::number(height);
|
||||||
|
|
@ -68,6 +73,8 @@ QPixmap CounterPixmapGenerator::generatePixmap(int height, QString name, bool hi
|
||||||
return pmCache.value(key);
|
return pmCache.value(key);
|
||||||
|
|
||||||
QPixmap pixmap = loadSvg("theme:counters/" + name, QSize(height, height));
|
QPixmap pixmap = loadSvg("theme:counters/" + name, QSize(height, height));
|
||||||
|
|
||||||
|
// fall back to colorless counter if the name can't be found
|
||||||
if (pixmap.isNull()) {
|
if (pixmap.isNull()) {
|
||||||
name = "general";
|
name = "general";
|
||||||
if (highlight)
|
if (highlight)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue