mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Some checks failed
Build Desktop / Configure (push) Has been cancelled
Build Docker Image / amd64 & arm64 (push) Has been cancelled
Build Desktop / Debian 11 (push) Has been cancelled
Build Desktop / Debian 13 (push) Has been cancelled
Build Desktop / Debian 12 (push) Has been cancelled
Build Desktop / Fedora 43 (push) Has been cancelled
Build Desktop / Fedora 42 (push) Has been cancelled
Build Desktop / Servatrice_Debian 11 (push) Has been cancelled
Build Desktop / Ubuntu 24.04 (push) Has been cancelled
Build Desktop / Ubuntu 26.04 (push) Has been cancelled
Build Desktop / Ubuntu 22.04 (push) Has been cancelled
Build Desktop / Arch (push) Has been cancelled
Build Desktop / macOS 14 (push) Has been cancelled
Build Desktop / macOS 15 (push) Has been cancelled
Build Desktop / macOS 13 Intel (push) Has been cancelled
Build Desktop / macOS 15 Debug (push) Has been cancelled
Build Desktop / Windows 10 (push) Has been cancelled
* set the minimum qt6 version to 6.4 this will be separate from the qt5 removal after release * add include for optional
130 lines
3 KiB
C++
130 lines
3 KiB
C++
/**
|
|
* @file pixel_map_generator.h
|
|
* @ingroup UI
|
|
* @brief TODO: Document this.
|
|
*/
|
|
|
|
#ifndef PIXMAPGENERATOR_H
|
|
#define PIXMAPGENERATOR_H
|
|
|
|
#include <QIcon>
|
|
#include <QLoggingCategory>
|
|
#include <QMap>
|
|
#include <QPixmap>
|
|
#include <libcockatrice/network/server/remote/user_level.h>
|
|
#include <optional>
|
|
|
|
inline Q_LOGGING_CATEGORY(PixelMapGeneratorLog, "pixel_map_generator");
|
|
|
|
class PhasePixmapGenerator
|
|
{
|
|
private:
|
|
static QMap<QString, QPixmap> pmCache;
|
|
|
|
public:
|
|
static QPixmap generatePixmap(int size, QString name);
|
|
static void clear()
|
|
{
|
|
pmCache.clear();
|
|
}
|
|
};
|
|
|
|
class CounterPixmapGenerator
|
|
{
|
|
private:
|
|
static QMap<QString, QPixmap> pmCache;
|
|
|
|
public:
|
|
static QPixmap generatePixmap(int size, QString name, bool highlight);
|
|
static void clear()
|
|
{
|
|
pmCache.clear();
|
|
}
|
|
};
|
|
|
|
class PingPixmapGenerator
|
|
{
|
|
private:
|
|
static QMap<int, QPixmap> pmCache;
|
|
|
|
public:
|
|
static QPixmap generatePixmap(int size, int value, int max);
|
|
static void clear()
|
|
{
|
|
pmCache.clear();
|
|
}
|
|
};
|
|
|
|
class CountryPixmapGenerator
|
|
{
|
|
private:
|
|
static QMap<QString, QPixmap> pmCache;
|
|
|
|
public:
|
|
static QPixmap generatePixmap(int height, const QString &countryCode);
|
|
static void clear()
|
|
{
|
|
pmCache.clear();
|
|
}
|
|
};
|
|
|
|
class UserLevelPixmapGenerator
|
|
{
|
|
private:
|
|
static QMap<QString, QIcon> iconCache;
|
|
|
|
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<QString> &colorLeft,
|
|
const std::optional<QString> &colorRight);
|
|
|
|
public:
|
|
static QPixmap generatePixmap(int height,
|
|
UserLevelFlags userLevel,
|
|
ServerInfo_User::PawnColorsOverride pawnColors,
|
|
bool isBuddy,
|
|
const QString &privLevel);
|
|
|
|
static QIcon generateIcon(int minHeight,
|
|
UserLevelFlags userLevel,
|
|
ServerInfo_User::PawnColorsOverride pawnColors,
|
|
bool isBuddy,
|
|
const QString &privLevel);
|
|
static void clear()
|
|
{
|
|
iconCache.clear();
|
|
}
|
|
};
|
|
|
|
class LockPixmapGenerator
|
|
{
|
|
private:
|
|
static QMap<int, QPixmap> pmCache;
|
|
|
|
public:
|
|
static QPixmap generatePixmap(int height);
|
|
static void clear()
|
|
{
|
|
pmCache.clear();
|
|
}
|
|
};
|
|
|
|
class DropdownIconPixmapGenerator
|
|
{
|
|
private:
|
|
static QMap<QString, QPixmap> pmCache;
|
|
|
|
public:
|
|
static QPixmap generatePixmap(int height, bool expanded);
|
|
static void clear()
|
|
{
|
|
pmCache.clear();
|
|
}
|
|
};
|
|
|
|
QPixmap loadColorAdjustedPixmap(const QString &name);
|
|
|
|
#endif
|