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

#include <game_action_factory.h>

Inheritance diagram for GameActionFactory:
Collaboration diagram for GameActionFactory:

Classes

class  Impl

Public Member Functions

 GameActionFactory (QWidget *dialogParent, core::GameLibraryController *libraryController, core::LaunchController *launchController, DetailsPanelManager *detailsPanelManager, GameThumbnailCache *imageCache, ThemeManager *themeManager, QObject *qparent=nullptr)
 ~GameActionFactory () override
void addChangeArtworkAction (QMenu *menu, const std::string &gameId, const Game *game)
 "Change Artwork..." — opens SteamGridDBSelectorDialog if the game has a Steam App ID.
void addCollectionsSubmenu (QMenu *menu, const std::string &gameId, const Game *game)
 "Collections" submenu listing every collection as a checkmarked action, plus "Create New..." at the bottom.
void addConfigureAction (QMenu *menu, const std::string &gameId)
 Configure... — opens GameConfigDialog.
void addFavoriteAction (QMenu *menu, const std::string &gameId, const Game *game)
 Favorite toggle (text flips between Add/Remove based on current state).
void addLaunchActions (QMenu *menu, const std::string &gameId, const Game *game)
 Launch (if installed + not running), Stop (if running), or Install via Steam (if Steam game + not installed).
void addOpenFolderAction (QMenu *menu, const Game *game)
 "Open Game Folder" — opens the executable's parent directory in the file manager.
void addProtonDBAction (QMenu *menu, const Game *game)
 "View on ProtonDB" — opens https://www.protondb.com/app/{appId} in the default browser.
void addQuickSettingsSubmenu (QMenu *menu, const std::string &gameId, const Game *game, bool includeMoreSettings)
 "Quick Settings" submenu with MangoHud / GameMode / Gamescope / VkBasalt toggles.
void addRemoveAction (QMenu *menu, const std::string &gameId)
 "Remove from Library" with confirmation QMessageBox.
void addSteamActions (QMenu *menu, const Game *game)
 Steam actions — "Manage in Steam..." (if installed) and "View on Steam Store" (always for Steam games).
void artworkChanged (const std::string &gameId)
 Artwork was changed via SteamGridDBSelectorDialog.
void favoriteChanged (const std::string &gameId)
 Favorite state flipped. Caller should refresh the list.
void gameConfigUpdated (const std::string &gameId)
 Configure dialog closed Accepted OR a Quick Setting was toggled.
void gameListChanged ()
 Collections (add / remove / create+add) changed for gameId.
void launchRequested (const std::string &gameId)
 The Launch action was triggered. Caller runs the launch pipeline.
void removeGameRequested (const std::string &gameId)
 Remove from Library confirmed.
void stopRequested (const std::string &gameId)
 The Stop action was triggered. Caller calls launchController->kill.

Detailed Description

Definition at line 56 of file game_action_factory.h.

Constructor & Destructor Documentation

◆ GameActionFactory()

GameActionFactory::GameActionFactory ( QWidget * dialogParent,
core::GameLibraryController * libraryController,
core::LaunchController * launchController,
DetailsPanelManager * detailsPanelManager,
GameThumbnailCache * imageCache,
ThemeManager * themeManager,
QObject * qparent = nullptr )

◆ ~GameActionFactory()

GameActionFactory::~GameActionFactory ( )
overridedefault

Member Function Documentation

◆ addChangeArtworkAction()

void GameActionFactory::addChangeArtworkAction ( QMenu * menu,
const std::string & gameId,
const Game * game )

"Change Artwork..." — opens SteamGridDBSelectorDialog if the game has a Steam App ID.

No-op for non-Steam games.

Definition at line 305 of file game_action_factory.cpp.

References artworkChanged(), SteamGridDBSelectorDialog::hasSelection(), Game::metadata, Game::name, SteamGridDBSelectorDialog::setGame(), and GameMetadata::steamAppId.

Referenced by ContextMenuManager::install(), and MenuBarManager::setupMenus().

◆ addCollectionsSubmenu()

void GameActionFactory::addCollectionsSubmenu ( QMenu * menu,
const std::string & gameId,
const Game * game )

"Collections" submenu listing every collection as a checkmarked action, plus "Create New..." at the bottom.

Definition at line 253 of file game_action_factory.cpp.

References Game::collections, and gameListChanged().

Referenced by ContextMenuManager::install(), and MenuBarManager::setupMenus().

◆ addConfigureAction()

void GameActionFactory::addConfigureAction ( QMenu * menu,
const std::string & gameId )

Configure... — opens GameConfigDialog.

After Accepted, updates the game through libraryController and emits gameConfigUpdated so the caller can refresh the details panel / game-list row.

Definition at line 151 of file game_action_factory.cpp.

References gameConfigUpdated().

Referenced by ContextMenuManager::install(), and MenuBarManager::setupMenus().

◆ addFavoriteAction()

void GameActionFactory::addFavoriteAction ( QMenu * menu,
const std::string & gameId,
const Game * game )

Favorite toggle (text flips between Add/Remove based on current state).

Shortcut: F.

Definition at line 229 of file game_action_factory.cpp.

References favoriteChanged(), and Game::isFavorite.

Referenced by ContextMenuManager::install(), and MenuBarManager::setupMenus().

◆ addLaunchActions()

void GameActionFactory::addLaunchActions ( QMenu * menu,
const std::string & gameId,
const Game * game )

Launch (if installed + not running), Stop (if running), or Install via Steam (if Steam game + not installed).

Definition at line 115 of file game_action_factory.cpp.

References Game::isInstalled(), launchRequested(), Game::metadata, openSteamUrl(), Game::source, Steam, GameMetadata::steamAppId, and stopRequested().

Referenced by ContextMenuManager::install(), and MenuBarManager::setupMenus().

◆ addOpenFolderAction()

void GameActionFactory::addOpenFolderAction ( QMenu * menu,
const Game * game )

"Open Game Folder" — opens the executable's parent directory in the file manager.

No-op unless installed + executablePath is set.

Definition at line 355 of file game_action_factory.cpp.

References GameRunnerConfig::executablePath, Game::isInstalled(), and Game::runnerConfig.

Referenced by ContextMenuManager::install(), and MenuBarManager::setupMenus().

◆ addProtonDBAction()

void GameActionFactory::addProtonDBAction ( QMenu * menu,
const Game * game )

"View on ProtonDB" — opens https://www.protondb.com/app/{appId} in the default browser.

No-op for non-Steam games.

Definition at line 337 of file game_action_factory.cpp.

References Game::metadata, and GameMetadata::steamAppId.

Referenced by ContextMenuManager::install(), and MenuBarManager::setupMenus().

◆ addQuickSettingsSubmenu()

void GameActionFactory::addQuickSettingsSubmenu ( QMenu * menu,
const std::string & gameId,
const Game * game,
bool includeMoreSettings )

"Quick Settings" submenu with MangoHud / GameMode / Gamescope / VkBasalt toggles.

Each toggle mutates runnerConfig.enableXxx and emits gameConfigUpdated.

Parameters
menuParent menu the submenu is attached to.
gameIdIdentifier of the game whose runnerConfig is mutated.
gameBacking Game pointer used for the current toggle state.
includeMoreSettingswhen true, appends a "More settings..." entry that opens GameConfigDialog (used by the context menu).

Definition at line 178 of file game_action_factory.cpp.

References GameRunnerConfig::enableGameMode, GameRunnerConfig::enableGamescope, GameRunnerConfig::enableMangoHud, GameRunnerConfig::enableVkBasalt, gameConfigUpdated(), and Game::runnerConfig.

Referenced by ContextMenuManager::install(), and MenuBarManager::setupMenus().

◆ addRemoveAction()

void GameActionFactory::addRemoveAction ( QMenu * menu,
const std::string & gameId )

"Remove from Library" with confirmation QMessageBox.

Shortcut: Delete. Emits removeGameRequested after user confirms; the caller is responsible for calling libraryController->removeGame() + refresh cascades (so the caller can decide whether to remove multiple games in the multi-select path).

Definition at line 400 of file game_action_factory.cpp.

References removeGameRequested().

Referenced by ContextMenuManager::install(), and MenuBarManager::setupMenus().

◆ addSteamActions()

void GameActionFactory::addSteamActions ( QMenu * menu,
const Game * game )

Steam actions — "Manage in Steam..." (if installed) and "View on Steam Store" (always for Steam games).

No-op for non-Steam.

Definition at line 372 of file game_action_factory.cpp.

References Game::isInstalled(), Game::metadata, openSteamUrl(), Game::source, Steam, and GameMetadata::steamAppId.

Referenced by ContextMenuManager::install(), and MenuBarManager::setupMenus().

◆ artworkChanged()

void GameActionFactory::artworkChanged ( const std::string & gameId)

Artwork was changed via SteamGridDBSelectorDialog.

Caller should clear the image cache, refresh the list, and update the details panel.

Referenced by addChangeArtworkAction().

◆ favoriteChanged()

void GameActionFactory::favoriteChanged ( const std::string & gameId)

Favorite state flipped. Caller should refresh the list.

Referenced by addFavoriteAction().

◆ gameConfigUpdated()

void GameActionFactory::gameConfigUpdated ( const std::string & gameId)

Configure dialog closed Accepted OR a Quick Setting was toggled.

Caller should refresh the details panel + list row for gameId.

Referenced by addConfigureAction(), addQuickSettingsSubmenu(), and GameActionFactory::Impl::toggleRunnerConfigFlag().

◆ gameListChanged()

void GameActionFactory::gameListChanged ( )

Collections (add / remove / create+add) changed for gameId.

Caller should refresh the collections list + game list (sidebar counts depend on it).

Referenced by addCollectionsSubmenu().

◆ launchRequested()

void GameActionFactory::launchRequested ( const std::string & gameId)

The Launch action was triggered. Caller runs the launch pipeline.

Referenced by addLaunchActions().

◆ removeGameRequested()

void GameActionFactory::removeGameRequested ( const std::string & gameId)

Remove from Library confirmed.

Caller removes the game from the library controller + runs refresh cascades.

Referenced by addRemoveAction().

◆ stopRequested()

void GameActionFactory::stopRequested ( const std::string & gameId)

The Stop action was triggered. Caller calls launchController->kill.

Referenced by addLaunchActions().


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