game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
GameScannerService Class Reference

Scans for installed games from various sources. More...

#include <game_scanner_service.h>

Public Types

using CompletionCallback = std::function<void(const std::vector<ScannedGame>&)>
using ProgressCallback = std::function<void(const ScanProgress&)>

Static Public Member Functions

static std::string getSourceDisplayName (GameSource source)
 Get display name for a game source.
static std::string getSourceIcon (GameSource source)
 Get icon name for a game source.
static bool isBottlesInstalled ()
 Check if Bottles is installed.
static bool isHeroicInstalled ()
 Check if Heroic Launcher is installed.
static bool isLegendaryInstalled ()
 Check if Legendary is installed.
static bool isLutrisInstalled ()
 Check if Lutris is installed.
static void markAlreadyImported (std::vector< ScannedGame > &games, const std::vector< Game > &library)
 Mark games that are already in the library.
static std::vector< ScannedGame > removeDuplicates (std::vector< ScannedGame > games)
 Remove duplicate games from the list.
static std::vector< ScannedGame > scanAll (ProgressCallback progressCallback=nullptr)
 Scan all available sources for games.
static void scanAllAsync (const CompletionCallback &onComplete, const ProgressCallback &onProgress=nullptr)
 Scan all sources asynchronously.
static std::vector< ScannedGame > scanBottles ()
 Scan Bottles for installed games.
static std::vector< ScannedGame > scanHeroic ()
 Scan Heroic Launcher for Epic and GOG games.
static std::vector< ScannedGame > scanLegendary ()
 Scan Legendary (Epic Games CLI) for installed games.
static std::vector< ScannedGame > scanLutris ()
 Scan Lutris for installed games.
static std::vector< ScannedGame > scanNativeGames ()
 Scan for native Linux games.
static std::vector< ScannedGame > scanWinePrefixes ()
 Scan generic Wine prefixes for games.
static void setCustomScanDirectories (const std::vector< std::string > &dirs)
 Set custom scan directories for native game scanning.

Detailed Description

Scans for installed games from various sources.

This service detects games installed via Lutris, Bottles, Heroic Launcher, Legendary, and other common Linux gaming platforms. It can also scan for native Linux games and generic Wine prefixes.

Definition at line 134 of file game_scanner_service.h.

Member Typedef Documentation

◆ CompletionCallback

using GameScannerService::CompletionCallback = std::function<void(const std::vector<ScannedGame>&)>

Definition at line 138 of file game_scanner_service.h.

◆ ProgressCallback

using GameScannerService::ProgressCallback = std::function<void(const ScanProgress&)>

Definition at line 137 of file game_scanner_service.h.

Member Function Documentation

◆ getSourceDisplayName()

std::string GameScannerService::getSourceDisplayName ( GameSource source)
static

Get display name for a game source.

Parameters
sourceThe game source enum
Returns
Human-readable name

Definition at line 362 of file game_scanner_service.cpp.

References Epic, Flatpak, GOG, Itch, Local, Lutris, and Steam.

◆ getSourceIcon()

std::string GameScannerService::getSourceIcon ( GameSource source)
static

Get icon name for a game source.

Parameters
sourceThe game source enum
Returns
Icon/emoji for the source

Definition at line 385 of file game_scanner_service.cpp.

References Epic, Flatpak, GOG, Itch, Local, Lutris, and Steam.

◆ isBottlesInstalled()

bool GameScannerService::isBottlesInstalled ( )
static

Check if Bottles is installed.

Definition at line 340 of file game_scanner_service.cpp.

Referenced by GameImportDialog::GameImportDialog(), and scanAll().

◆ isHeroicInstalled()

bool GameScannerService::isHeroicInstalled ( )
static

Check if Heroic Launcher is installed.

Definition at line 346 of file game_scanner_service.cpp.

Referenced by GameImportDialog::GameImportDialog(), and scanAll().

◆ isLegendaryInstalled()

bool GameScannerService::isLegendaryInstalled ( )
static

Check if Legendary is installed.

Definition at line 352 of file game_scanner_service.cpp.

Referenced by GameImportDialog::GameImportDialog(), and scanAll().

◆ isLutrisInstalled()

bool GameScannerService::isLutrisInstalled ( )
static

Check if Lutris is installed.

Definition at line 334 of file game_scanner_service.cpp.

References LutrisConfigParser::getGamesDirectory().

Referenced by GameImportDialog::GameImportDialog(), and scanAll().

◆ markAlreadyImported()

void GameScannerService::markAlreadyImported ( std::vector< ScannedGame > & games,
const std::vector< Game > & library )
static

Mark games that are already in the library.

Parameters
gamesList of scanned games to check
libraryCurrent game library

Definition at line 1814 of file game_scanner_service.cpp.

References ScannedGame::alreadyImported, Logger::debug(), ScannedGame::executablePath, ScannedGame::existingGameId, ScannedGame::id, ScannedGame::installDir, ScannedGame::name, and ScannedGame::steamAppId.

◆ removeDuplicates()

std::vector< ScannedGame > GameScannerService::removeDuplicates ( std::vector< ScannedGame > games)
static

Remove duplicate games from the list.

Parameters
gamesList of scanned games
Returns
Deduplicated list

Definition at line 1744 of file game_scanner_service.cpp.

References Epic, ScannedGame::executablePath, GOG, Local, Lutris, ScannedGame::source, Steam, and ScannedGame::steamAppId.

Referenced by scanAll().

◆ scanAll()

◆ scanAllAsync()

void GameScannerService::scanAllAsync ( const CompletionCallback & onComplete,
const ProgressCallback & onProgress = nullptr )
static

Scan all sources asynchronously.

Parameters
onCompleteCallback with results
onProgressOptional progress callback

Definition at line 1726 of file game_scanner_service.cpp.

References scanAll().

◆ scanBottles()

std::vector< ScannedGame > GameScannerService::scanBottles ( )
static

Scan Bottles for installed games.

Returns
List of games found in Bottles

Definition at line 716 of file game_scanner_service.cpp.

References Logger::info(), and Logger::warn().

Referenced by scanAll().

◆ scanHeroic()

std::vector< ScannedGame > GameScannerService::scanHeroic ( )
static

Scan Heroic Launcher for Epic and GOG games.

Returns
List of games found in Heroic

Definition at line 885 of file game_scanner_service.cpp.

References Epic, GOG, and Logger::info().

Referenced by scanAll().

◆ scanLegendary()

std::vector< ScannedGame > GameScannerService::scanLegendary ( )
static

Scan Legendary (Epic Games CLI) for installed games.

Returns
List of games found via Legendary

Definition at line 1091 of file game_scanner_service.cpp.

References Logger::info().

Referenced by scanAll().

◆ scanLutris()

std::vector< ScannedGame > GameScannerService::scanLutris ( )
static

Scan Lutris for installed games.

Returns
List of games found in Lutris

Definition at line 412 of file game_scanner_service.cpp.

References LutrisConfigParser::getGamesDirectory(), Logger::info(), and Logger::warn().

Referenced by scanAll().

◆ scanNativeGames()

std::vector< ScannedGame > GameScannerService::scanNativeGames ( )
static

◆ scanWinePrefixes()

std::vector< ScannedGame > GameScannerService::scanWinePrefixes ( )
static

Scan generic Wine prefixes for games.

Returns
List of games found in Wine prefixes

Definition at line 1559 of file game_scanner_service.cpp.

References Logger::info(), Local, and ScannedGame::source.

Referenced by scanAll().

◆ setCustomScanDirectories()

void GameScannerService::setCustomScanDirectories ( const std::vector< std::string > & dirs)
static

Set custom scan directories for native game scanning.

Parameters
dirsList of directory paths to scan in addition to hardcoded defaults

Call this during app initialization (e.g., after loading settings). These directories are appended to the built-in scan list in scanNativeGames().

Definition at line 79 of file game_scanner_service.cpp.


The documentation for this class was generated from the following files: