134 const
Game*
getGame(const std::
string& gameId) const;
145 void executeWithGame(const std::
string& gameId, const std::function<
void(
Game&)>& updater);
157 bool updateGame(const std::
string& gameId, const
Game& updatedGame);
165 std::
string duplicateGame(const std::
string& sourceGameId, const std::
string& newName);
203 bool renameCollection(const std::
string& oldName, const std::
string& newName);
219 bool isFavorite(const std::
string& gameId) const;
274 std::unique_ptr<
Impl> impl_;
Central database for managing all games in the launcher.
Complete representation of a game in the library.
void setOnGameRemoved(OnGameRemoved callback)
bool updateGame(const std::string &gameId, const Game &updatedGame)
Update an existing game Returns true on success.
std::vector< PlaySession > getRecentSessions(const std::string &gameId, int limit=20) const
Get recent play sessions for a game from the database.
void setOnFilteredListChanged(OnFilteredListChanged callback)
std::string addGame(const Game &game)
Add a new game to the library Returns the assigned game ID, or empty string on failure.
std::vector< const Game * > getGamesByRunner(GameRunner runner) const
Get games by runner.
std::string duplicateGame(const std::string &sourceGameId, const std::string &newName)
Duplicate a game with a new name Returns the new game's ID, or empty string on failure.
std::vector< std::string > getCollections() const
Get all collection names.
GameLibraryController(GameLibraryController &&) noexcept
int discoverMissingImages()
Discover and update image paths for games that are missing cover art This should be called in a backg...
bool removeGame(const std::string &gameId)
Remove a game from the library Returns true on success.
bool discoverImagesForGame(const std::string &gameId)
Discover images for a specific game (by Steam App ID) Returns true if images were found and updated.
FilterOptions getFilter() const
Get current filter options (returns copy for thread safety).
void refreshFilteredList()
Force refresh of filtered list (e.g., after external game state change).
const Game * getGame(const std::string &gameId) const
Get a game by ID (returns nullptr if not found).
void loadLibrary()
Load library from disk.
Game * getGameForEdit(const std::string &gameId)
Get mutable game for editing (returns nullptr if not found).
bool removeGameFromCollection(const std::string &gameId, const std::string &collection)
Remove a game from a collection.
std::vector< const Game * > searchGames(const std::string &query) const
Search games by name (substring match).
bool addCollection(const std::string &name)
Add a new collection.
void setSort(const SortOptions &options)
Set sort options and refresh filtered list.
GameLibraryController(const GameLibraryController &)=delete
void toggleFavorite(const std::string &gameId)
Toggle favorite status.
std::function< void(const GameRemovedEvent &)> OnGameRemoved
void setOnGameAdded(OnGameAdded callback)
void setFilter(const FilterOptions &options)
Set filter options and refresh filtered list.
bool renameCollection(const std::string &oldName, const std::string &newName)
Rename a collection.
std::vector< const Game * > getFilteredGames() const
Get the currently filtered and sorted game list (returns copy for thread safety).
std::function< void(const GameUpdatedEvent &)> OnGameUpdated
void executeWithGame(const std::string &gameId, const std::function< void(Game &)> &updater)
Execute an update function on a game while holding the library's internal lock.
void saveLibrary()
Save library to disk.
std::vector< Game * > getAllGames()
Get all games (non-const for process tracking).
std::function< void(const GameAddedEvent &)> OnGameAdded
size_t getGameCount() const
Get total game count.
std::vector< const Game * > getRecentlyPlayed(int count=10) const
Get recently played games.
bool removeCollection(const std::string &name)
Remove a collection.
std::function< void(const LibraryLoadedEvent &)> OnLibraryLoaded
std::function< void(const std::vector< const Game * > &)> OnFilteredListChanged
GameLibraryController & operator=(const GameLibraryController &)=delete
void setOnLibraryLoaded(OnLibraryLoaded callback)
int refreshStaleImages()
Refresh images for games with stale/missing image files Checks if stored paths still exist and re-dis...
SortOptions getSort() const
Get current sort options (returns copy for thread safety).
bool addGameToCollection(const std::string &gameId, const std::string &collection)
Add a game to a collection.
void setOnGameUpdated(OnGameUpdated callback)
std::vector< const Game * > getGamesByPlatform(GamePlatform platform) const
Get games by platform.
bool isFavorite(const std::string &gameId) const
Check if a game is favorited.
GameSource
Where the game was acquired from (store/service/local).
GamePlatform
Platform/runner type for executing the game.
GameStatus
Current installation and execution status of the game.
GameRunner
Runner/compatibility layer for executing the game.
Record of a single game play session.
std::optional< GameStatus > status
std::optional< GameRunner > runner
std::optional< std::string > collection
std::optional< GameSource > source