34#include <unordered_map>
46 QObject* parent =
nullptr);
90 shuttingDown_.store(
true);
94 return shuttingDown_.load();
106 void touchThumbEntry(
const std::string& key);
107 void touchHeroEntry(
const std::string& key);
110 size_t maxThumbnails_;
111 std::unordered_map<std::string, QPixmap> thumbnailCache_;
112 std::deque<std::string> thumbnailLRU_;
115 size_t maxHeroImages_;
116 std::unordered_map<std::string, QPixmap> heroCache_;
117 std::deque<std::string> heroLRU_;
120 mutable std::unordered_map<std::string, QString> imagePathCache_;
122 std::atomic<bool> shuttingDown_{
false};
QPixmap getGameThumbnail(const Game *game, const QSize &logicalSize, ImageType preferred)
Get a logical-size thumbnail with DPR-aware backing store.
~GameThumbnailCache() override
QPixmap getHeroImage(const Game *game, int targetWidth)
Get a hero image scaled to targetWidth logical pixels (preserving aspect ratio).
void clearAll()
Clear all caches (thumbnails, hero images, path validation).
void requestShutdown()
Mark shutdown — any in-flight buildImagePathCache() task will observe this and early-exit without tou...
bool isShuttingDown() const
GameThumbnailCache(size_t maxThumbnails=300, size_t maxHeroImages=30, QObject *parent=nullptr)
void buildImagePathCache(const std::vector< const Game * > &games)
Pre-populate the image-path validation cache by stat-ing every image file for every game.
QString findBestImage(const Game *game, ImageType preferred) const
Return the best-available image file path for game, falling back through a type-specific chain when t...
Complete representation of a game in the library.
ImageType
Types of game images available.