game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
shortcuts_controller.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// ==============================================================================
3// ui/qt/shortcuts_controller.h
4// ==============================================================================
5// Owns the ShortcutManager + command-palette registration that used to
6// live in MainWindow::setupKeyboardShortcuts() and
7// MainWindow::registerPaletteCommands() — ~1,017 LoC of mostly-
8// declarative boilerplate. Extracted 2026-04-19.
9// ==============================================================================
10// Internal orchestration class with a back-pointer to MainWindow.
11// Declared `friend MainWindow` so its methods can call MainWindow
12// private slots and touch private members directly — the coupling is
13// inherent (every shortcut / palette command ultimately drives
14// MainWindow state). This is a file split, not a dependency
15// decoupling: its value is keeping mainwindow.cpp focused on window-
16// level composition rather than shortcut-registration data.
17// ==============================================================================
18
19#pragma once
20
21#include <QObject>
22
23class MainWindow;
24
25class ShortcutsController : public QObject
26{
27 Q_OBJECT
28
29 public:
30 explicit ShortcutsController(MainWindow* mainWindow, QObject* qparent = nullptr);
32
33 /// Register global / game / view keyboard shortcuts with
34 /// ShortcutManager::instance(). Call once.
36
37 /// Populate the command palette with every PaletteCommand. Requires
38 /// MainWindow::commandPalette_ to be non-null.
40
41 private:
42 MainWindow* mw_ = nullptr;
43};
ShortcutsController(MainWindow *mainWindow, QObject *qparent=nullptr)
void setupKeyboardShortcuts()
Register global / game / view keyboard shortcuts with ShortcutManager::instance().
void registerPaletteCommands()
Populate the command palette with every PaletteCommand.
~ShortcutsController() override