Chatterino
Public Types | Public Member Functions | Public Attributes | Friends | List of all members
chatterino::HotkeyController Class Referencefinal

#include <HotkeyController.hpp>

Inheritance diagram for chatterino::HotkeyController:
[legend]
Collaboration diagram for chatterino::HotkeyController:
[legend]

Public Types

using HotkeyFunction = std::function< QString(std::vector< QString >)>
 
using HotkeyMap = std::map< QString, HotkeyFunction >
 

Public Member Functions

 HotkeyController ()
 
HotkeyModelcreateModel (QObject *parent)
 
std::vector< QShortcut * > shortcutsForCategory (HotkeyCategory category, HotkeyMap actionMap, QWidget *parent)
 
void save () override
 
std::shared_ptr< HotkeygetHotkeyByName (QString name)
 
QKeySequence getDisplaySequence (HotkeyCategory category, const QString &action, const std::optional< std::vector< QString >> &arguments={}) const
 returns a QKeySequence that perfoms the actions requested. Accepted if and only if the category matches, the action matches and arguments match. When arguments is present, contents of arguments must match the checked hotkey, otherwise arguments are ignored. For example: More...
 
int replaceHotkey (QString oldName, std::shared_ptr< Hotkey > newHotkey)
 removes the hotkey with the oldName and inserts newHotkey at the end More...
 
boost::optional< HotkeyCategoryhotkeyCategoryFromName (QString categoryName)
 
bool isDuplicate (std::shared_ptr< Hotkey > hotkey, QString ignoreNamed)
 checks if the hotkey is duplicate More...
 
QString categoryDisplayName (HotkeyCategory category) const
 Returns the display name of the given hotkey category. More...
 
QString categoryName (HotkeyCategory category) const
 Returns the name of the given hotkey category. More...
 
const std::map< HotkeyCategory, HotkeyCategoryData > & categories () const
 
- Public Member Functions inherited from chatterino::Singleton
virtual ~Singleton ()=default
 
virtual void initialize (Settings &settings, Paths &paths)
 

Public Attributes

pajlada::Signals::NoArgSignal onItemsUpdated
 

Friends

class KeyboardSettingsPage
 

Member Typedef Documentation

◆ HotkeyFunction

using chatterino::HotkeyController::HotkeyFunction = std::function<QString(std::vector<QString>)>

◆ HotkeyMap

Constructor & Destructor Documentation

◆ HotkeyController()

chatterino::HotkeyController::HotkeyController ( )

Member Function Documentation

◆ categories()

const std::map< HotkeyCategory, HotkeyCategoryData > & chatterino::HotkeyController::categories ( ) const
Returns
a const map with the HotkeyCategory enum as its key, and HotkeyCategoryData as the value.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ categoryDisplayName()

QString chatterino::HotkeyController::categoryDisplayName ( HotkeyCategory  category) const

Returns the display name of the given hotkey category.

Returns
the display name, or an empty string if an invalid hotkey category was given
Here is the caller graph for this function:

◆ categoryName()

QString chatterino::HotkeyController::categoryName ( HotkeyCategory  category) const

Returns the name of the given hotkey category.

Returns
the name, or an empty string if an invalid hotkey category was given
Here is the caller graph for this function:

◆ createModel()

HotkeyModel * chatterino::HotkeyController::createModel ( QObject *  parent)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDisplaySequence()

QKeySequence chatterino::HotkeyController::getDisplaySequence ( HotkeyCategory  category,
const QString &  action,
const std::optional< std::vector< QString >> &  arguments = {} 
) const

returns a QKeySequence that perfoms the actions requested. Accepted if and only if the category matches, the action matches and arguments match. When arguments is present, contents of arguments must match the checked hotkey, otherwise arguments are ignored. For example:

  • std::nullopt (or {}) will match any hotkey satisfying category, action values,
  • {{"foo", "bar"}} will only match a hotkey that has these arguments and these arguments only
Here is the caller graph for this function:

◆ getHotkeyByName()

std::shared_ptr< Hotkey > chatterino::HotkeyController::getHotkeyByName ( QString  name)
Here is the caller graph for this function:

◆ hotkeyCategoryFromName()

boost::optional< HotkeyCategory > chatterino::HotkeyController::hotkeyCategoryFromName ( QString  categoryName)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isDuplicate()

bool chatterino::HotkeyController::isDuplicate ( std::shared_ptr< Hotkey hotkey,
QString  ignoreNamed 
)

checks if the hotkey is duplicate

Parameters
hotkeythe hotkey to check
ignoreNamedname of hotkey to ignore. Useful for ensuring we don't fail if the hotkey's name is being edited
Returns
true if the given hotkey is a duplicate, false if it's not

◆ replaceHotkey()

int chatterino::HotkeyController::replaceHotkey ( QString  oldName,
std::shared_ptr< Hotkey newHotkey 
)

removes the hotkey with the oldName and inserts newHotkey at the end

Returns
the new index in the SignalVector
Here is the caller graph for this function:

◆ save()

void chatterino::HotkeyController::save ( )
overridevirtual

Reimplemented from chatterino::Singleton.

Here is the caller graph for this function:

◆ shortcutsForCategory()

std::vector< QShortcut * > chatterino::HotkeyController::shortcutsForCategory ( HotkeyCategory  category,
HotkeyMap  actionMap,
QWidget *  parent 
)
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ KeyboardSettingsPage

friend class KeyboardSettingsPage
friend

Member Data Documentation

◆ onItemsUpdated

pajlada::Signals::NoArgSignal chatterino::HotkeyController::onItemsUpdated

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