|
game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
|
Modal dialog providing fuzzy-searchable command list. More...
#include <command_palette.h>
Public Member Functions | |
| CommandPalette (MainWindow *parent, ThemeManager *themeManager=nullptr) | |
| ~CommandPalette () override | |
| void | clearCommands () |
| Clear all registered commands. | |
| QStringList | getRecentCommands (int limit=5) const |
| Get the list of recently used command IDs. | |
| void | registerCommand (const PaletteCommand &cmd) |
| Register a single command. | |
| void | registerCommands (const std::vector< PaletteCommand > &commands) |
| Register multiple commands at once. | |
| void | registerDynamicProvider (std::function< std::vector< PaletteCommand >()> provider) |
| Register a provider for dynamic commands. | |
| void | showPalette () |
| Show the palette and focus the search field. | |
| void | unregisterCategory (const QString &category) |
| Remove all commands in a category. | |
| void | unregisterCommand (const QString &id) |
| Remove a command by ID. | |
Protected Member Functions | |
| bool | eventFilter (QObject *obj, QEvent *event) override |
| void | keyPressEvent (QKeyEvent *event) override |
| void | showEvent (QShowEvent *event) override |
Modal dialog providing fuzzy-searchable command list.
Features:
Usage: auto palette = new CommandPalette(mainWindow); palette->registerCommands(commands); palette->show(); // Or connect to Ctrl+Shift+P shortcut
Definition at line 88 of file command_palette.h.
|
explicit |
Definition at line 250 of file command_palette.cpp.
References ThemeManager::themeChanged().
|
override |
Definition at line 268 of file command_palette.cpp.
| void CommandPalette::clearCommands | ( | ) |
Clear all registered commands.
Definition at line 428 of file command_palette.cpp.
|
overrideprotected |
Definition at line 494 of file command_palette.cpp.
| QStringList CommandPalette::getRecentCommands | ( | int | limit = 5 | ) | const |
Get the list of recently used command IDs.
| limit | Maximum number to return |
Definition at line 775 of file command_palette.cpp.
|
overrideprotected |
Definition at line 469 of file command_palette.cpp.
| void CommandPalette::registerCommand | ( | const PaletteCommand & | cmd | ) |
Register a single command.
| cmd | Command to register |
Definition at line 390 of file command_palette.cpp.
Referenced by registerCommands().
| void CommandPalette::registerCommands | ( | const std::vector< PaletteCommand > & | commands | ) |
Register multiple commands at once.
| commands | Vector of commands to register |
Definition at line 405 of file command_palette.cpp.
References registerCommand().
| void CommandPalette::registerDynamicProvider | ( | std::function< std::vector< PaletteCommand >()> | provider | ) |
Register a provider for dynamic commands.
| provider | Function that returns commands based on current state |
Dynamic providers are called each time the palette opens to add context-sensitive commands (e.g., "Stop [Game Name]" when a game is running).
Definition at line 433 of file command_palette.cpp.
|
overrideprotected |
Definition at line 463 of file command_palette.cpp.
| void CommandPalette::showPalette | ( | ) |
Show the palette and focus the search field.
Definition at line 438 of file command_palette.cpp.
| void CommandPalette::unregisterCategory | ( | const QString & | category | ) |
Remove all commands in a category.
| category | Category name |
Definition at line 420 of file command_palette.cpp.
| void CommandPalette::unregisterCommand | ( | const QString & | id | ) |
Remove a command by ID.
| id | Command ID to remove |
Definition at line 413 of file command_palette.cpp.