|
game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
|
#include <game_thumbnail_cache.h>
Public Member Functions | |
| GameThumbnailCache (size_t maxThumbnails=300, size_t maxHeroImages=30, QObject *parent=nullptr) | |
| ~GameThumbnailCache () override | |
| void | buildImagePathCache (const std::vector< const Game * > &games) |
| Pre-populate the image-path validation cache by stat-ing every image file for every game. | |
| void | clearAll () |
| Clear all caches (thumbnails, hero images, path validation). | |
| 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 the preferred type is missing. | |
| QPixmap | getGameThumbnail (const Game *game, const QSize &logicalSize, ImageType preferred) |
| Get a logical-size thumbnail with DPR-aware backing store. | |
| QPixmap | getHeroImage (const Game *game, int targetWidth) |
| Get a hero image scaled to targetWidth logical pixels (preserving aspect ratio). | |
| bool | isShuttingDown () const |
| void | requestShutdown () |
| Mark shutdown — any in-flight buildImagePathCache() task will observe this and early-exit without touching the GUI thread. | |
Definition at line 40 of file game_thumbnail_cache.h.
| GameThumbnailCache::GameThumbnailCache | ( | size_t | maxThumbnails = 300, |
| size_t | maxHeroImages = 30, | ||
| QObject * | parent = nullptr ) |
Definition at line 24 of file game_thumbnail_cache.cpp.
|
overridedefault |
| void GameThumbnailCache::buildImagePathCache | ( | const std::vector< const Game * > & | games | ) |
Pre-populate the image-path validation cache by stat-ing every image file for every game.
Runs asynchronously on QThreadPool and marshals the result to the GUI thread. Call at startup with the full game list. Abort signal via isShuttingDown().
Definition at line 238 of file game_thumbnail_cache.cpp.
References Capsule, Header, HeroImage, Icon, and VerticalCover.
| void GameThumbnailCache::clearAll | ( | ) |
Clear all caches (thumbnails, hero images, path validation).
Called when new artwork is downloaded or a game is added.
Definition at line 35 of file game_thumbnail_cache.cpp.
Return the best-available image file path for game, falling back through a type-specific chain when the preferred type is missing.
Empty string if no image is available. Results are cached.
Definition at line 48 of file game_thumbnail_cache.cpp.
References Capsule, Game::getImagePath(), Header, HeroImage, Icon, Game::id, and VerticalCover.
Referenced by getGameThumbnail(), and getHeroImage().
| QPixmap GameThumbnailCache::getGameThumbnail | ( | const Game * | game, |
| const QSize & | logicalSize, | ||
| ImageType | preferred ) |
Get a logical-size thumbnail with DPR-aware backing store.
Cached. Size is quantised to 16px boundaries internally to raise hit rate during zoom/resize.
Definition at line 121 of file game_thumbnail_cache.cpp.
References findBestImage(), Game::id, and dpr::primaryRatio().
| QPixmap GameThumbnailCache::getHeroImage | ( | const Game * | game, |
| int | targetWidth ) |
Get a hero image scaled to targetWidth logical pixels (preserving aspect ratio).
Returns a null QPixmap if no image is available — the null result is still cached to avoid repeated lookups.
Definition at line 185 of file game_thumbnail_cache.cpp.
References findBestImage(), HeroImage, Game::id, and dpr::primaryRatio().
|
inline |
Definition at line 92 of file game_thumbnail_cache.h.
|
inline |
Mark shutdown — any in-flight buildImagePathCache() task will observe this and early-exit without touching the GUI thread.
Definition at line 88 of file game_thumbnail_cache.h.