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

Fluent builder for creating PaletteCommand objects. More...

#include <command_palette.h>

Public Member Functions

 CommandBuilder (const QString &id)
CommandBuilder & action (std::function< void()> fn)
PaletteCommand build () const
CommandBuilder & category (const QString &cat)
CommandBuilder & description (const QString &desc)
CommandBuilder & enabledWhen (std::function< bool()> fn)
CommandBuilder & icon (const QString &icon)
CommandBuilder & label (const QString &label)
CommandBuilder & priority (int p)
CommandBuilder & shortcut (const QString &sc)
CommandBuilder & visibleWhen (std::function< bool()> fn)

Detailed Description

Fluent builder for creating PaletteCommand objects.

Usage: auto cmd = CommandBuilder("game.launch") .label("Launch Game") .category("Games") .shortcut("Enter") .icon("...") .action([this]() { launchSelectedGame(); }) .enabledWhen([this]() { return hasSelectedGame(); }) .build();

Definition at line 219 of file command_palette.h.

Constructor & Destructor Documentation

◆ CommandBuilder()

CommandBuilder::CommandBuilder ( const QString & id)
inlineexplicit

Member Function Documentation

◆ action()

CommandBuilder & CommandBuilder::action ( std::function< void()> fn)
inline

Definition at line 257 of file command_palette.h.

References CommandBuilder(), and action().

Referenced by action(), and ShortcutsController::registerPaletteCommands().

◆ build()

PaletteCommand CommandBuilder::build ( ) const
inline

Definition at line 273 of file command_palette.h.

Referenced by ShortcutsController::registerPaletteCommands().

◆ category()

CommandBuilder & CommandBuilder::category ( const QString & cat)
inline

Definition at line 232 of file command_palette.h.

References CommandBuilder(), and category().

Referenced by category(), and ShortcutsController::registerPaletteCommands().

◆ description()

CommandBuilder & CommandBuilder::description ( const QString & desc)
inline

Definition at line 247 of file command_palette.h.

References CommandBuilder(), and description().

Referenced by description(), and ShortcutsController::registerPaletteCommands().

◆ enabledWhen()

CommandBuilder & CommandBuilder::enabledWhen ( std::function< bool()> fn)
inline

Definition at line 262 of file command_palette.h.

References CommandBuilder().

Referenced by ShortcutsController::registerPaletteCommands().

◆ icon()

CommandBuilder & CommandBuilder::icon ( const QString & icon)
inline

Definition at line 242 of file command_palette.h.

References CommandBuilder(), and icon().

Referenced by icon(), and ShortcutsController::registerPaletteCommands().

◆ label()

CommandBuilder & CommandBuilder::label ( const QString & label)
inline

Definition at line 227 of file command_palette.h.

References CommandBuilder(), and label().

Referenced by label().

◆ priority()

CommandBuilder & CommandBuilder::priority ( int p)
inline

Definition at line 252 of file command_palette.h.

References CommandBuilder(), and priority().

Referenced by priority(), and ShortcutsController::registerPaletteCommands().

◆ shortcut()

CommandBuilder & CommandBuilder::shortcut ( const QString & sc)
inline

Definition at line 237 of file command_palette.h.

References CommandBuilder(), and shortcut().

Referenced by shortcut().

◆ visibleWhen()

CommandBuilder & CommandBuilder::visibleWhen ( std::function< bool()> fn)
inline

Definition at line 267 of file command_palette.h.

References CommandBuilder().

Referenced by ShortcutsController::registerPaletteCommands().


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