game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
context_menu_manager.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// ==============================================================================
3// ui/qt/context_menu_manager.h
4// ==============================================================================
5// Owner of the game-list right-click context menu. Fifth in the MED-* /
6// manager family (after DetailsPanelManager, ToolbarManager,
7// SidebarManager, MenuBarManager). Extracted 2026-04-19, unblocked by
8// the GameActionFactory landing (shared per-game actions no longer
9// duplicate the menu-bar implementation).
10// ==============================================================================
11// Responsibilities:
12// - Own the customContextMenuRequested handler on the games QListView.
13// - Build the menu for both single- and multi-selection right-clicks.
14// - Delegate shared actions (Launch / Configure / Quick Settings /
15// Favorites / Collections / Artwork / ProtonDB / Open Folder /
16// Steam / Remove) to GameActionFactory — the single source of
17// truth shared with MenuBarManager's Game menu.
18// - Handle context-menu-unique actions inline:
19// * Multi-select "Select All" + "Remove N Games"
20// * Steam Uninstall (thread-pooled with QPointer guard)
21// * Verify Game Files (GameVerificationDialog)
22// * Copy to Clipboard (Game Name / Executable Path / Steam App ID)
23//
24// Signal surface (the two truly context-menu-specific signals —
25// factory-originated signals flow through MenuBarManager's existing
26// relay, so MainWindow only needs one place to wire them):
27// - gamesBatchRemoveRequested(ids) — multi-select remove confirmed
28// - steamUninstallCompleted(gameId,
29// success,
30// gameName,
31// appId) — Steam uninstall finished on
32// the UI thread; MainWindow
33// drives the post-success
34// refresh + Steam URL open
35// ==============================================================================
36
37#pragma once
38
39#include <QObject>
40#include <cstdint>
41#include <memory>
42#include <string>
43#include <vector>
44
45class ThemeManager;
46class QMainWindow;
47class QListView;
51
52namespace core
53{
55}
56
57class ContextMenuManager : public QObject
58{
59 Q_OBJECT
60
61 public:
62 ContextMenuManager(QMainWindow* mainWindow, core::GameLibraryController* libraryController,
63 DetailsPanelManager* detailsPanelManager, GameActionFactory* actionFactory,
64 std::shared_ptr<QtNotificationService> notificationService,
65 ThemeManager* themeManager, QObject* qparent = nullptr);
67
68 /// Hook the manager's right-click handler onto `gameList`. Call once
69 /// after setupGameList() has created the view. Uses `this` as the
70 /// receiver for the `customContextMenuRequested` connection so the
71 /// lambda is automatically disconnected when the manager is destroyed.
72 void install(QListView* gameList);
73
74 signals:
75 /// Multi-select "Remove N Games" confirmed; caller should loop
76 /// libraryController->removeGame + run updateSourceFilters,
77 /// updateCategoryCounts, refreshGameList.
78 void gamesBatchRemoveRequested(const std::vector<std::string>& gameIds);
79
80 /// Steam Uninstall worker completed on the UI thread. MainWindow
81 /// handles the refresh cascade + opens steam:// nav URL on success.
82 void steamUninstallCompleted(const std::string& gameId, bool success,
83 const std::string& gameName, std::uint32_t appId);
84
85 private:
86 class Impl;
87 std::unique_ptr<Impl> impl_;
88};
void gamesBatchRemoveRequested(const std::vector< std::string > &gameIds)
Multi-select "Remove N Games" confirmed; caller should loop libraryController->removeGame + run updat...
void install(QListView *gameList)
Hook the manager's right-click handler onto gameList.
void steamUninstallCompleted(const std::string &gameId, bool success, const std::string &gameName, std::uint32_t appId)
Steam Uninstall worker completed on the UI thread.
ContextMenuManager(QMainWindow *mainWindow, core::GameLibraryController *libraryController, DetailsPanelManager *detailsPanelManager, GameActionFactory *actionFactory, std::shared_ptr< QtNotificationService > notificationService, ThemeManager *themeManager, QObject *qparent=nullptr)
~ContextMenuManager() override