Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
KODI::KEYMAP::CButtonTranslator Class Reference

Singleton class to map from buttons to actions. More...

#include <ButtonTranslator.h>

Public Member Functions

 CButtonTranslator ()=default
 
 CButtonTranslator (const CButtonTranslator &)=delete
 
CButtonTranslator const & operator= (CButtonTranslator const &)=delete
 
virtual ~CButtonTranslator ()=default
 
bool AddDevice (const std::string &strDevice)
 
bool RemoveDevice (const std::string &strDevice)
 
bool Load ()
 loads Keymap.xml
 
void Clear ()
 clears the maps
 
bool HasLongpressMapping (int window, const CKey &key)
 Finds out if a longpress mapping exists for this key.
 
CAction GetAction (int window, const CKey &key, bool fallback=true)
 Obtain the action configured for a given window and key.
 
void RegisterMapper (const std::string &device, IKeyMapper *mapper)
 
void UnregisterMapper (const IKeyMapper *mapper)
 

Static Public Member Functions

static uint32_t TranslateString (const std::string &strMap, const std::string &strButton)
 

Friends

class EVENTCLIENT::CEventButtonState
 

Detailed Description

Singleton class to map from buttons to actions.

Warning: not threadsafe!

Constructor & Destructor Documentation

◆ CButtonTranslator() [1/2]

KODI::KEYMAP::CButtonTranslator::CButtonTranslator ( )
default

◆ CButtonTranslator() [2/2]

KODI::KEYMAP::CButtonTranslator::CButtonTranslator ( const CButtonTranslator & )
delete

◆ ~CButtonTranslator()

virtual KODI::KEYMAP::CButtonTranslator::~CButtonTranslator ( )
virtualdefault

Member Function Documentation

◆ AddDevice()

bool CButtonTranslator::AddDevice ( const std::string & strDevice)

◆ Clear()

void CButtonTranslator::Clear ( )

clears the maps

◆ GetAction()

CAction CButtonTranslator::GetAction ( int window,
const CKey & key,
bool fallback = true )

Obtain the action configured for a given window and key.

Parameters
windowthe window id
keythe key to query the action for
fallbackif no action is directly configured for the given window, obtain the action from fallback window, if exists or from global config as last resort
Returns
the action matching the key

◆ HasLongpressMapping()

bool CButtonTranslator::HasLongpressMapping ( int window,
const CKey & key )

Finds out if a longpress mapping exists for this key.

Parameters
windowid of the current window
keyto search a mapping for
Returns
true if a longpress mapping exists

◆ Load()

bool CButtonTranslator::Load ( )

loads Keymap.xml

◆ operator=()

CButtonTranslator const & KODI::KEYMAP::CButtonTranslator::operator= ( CButtonTranslator const & )
delete

◆ RegisterMapper()

void CButtonTranslator::RegisterMapper ( const std::string & device,
IKeyMapper * mapper )

◆ RemoveDevice()

bool CButtonTranslator::RemoveDevice ( const std::string & strDevice)

◆ TranslateString()

uint32_t CButtonTranslator::TranslateString ( const std::string & strMap,
const std::string & strButton )
static

◆ UnregisterMapper()

void CButtonTranslator::UnregisterMapper ( const IKeyMapper * mapper)

Friends And Related Symbol Documentation

◆ EVENTCLIENT::CEventButtonState

friend class EVENTCLIENT::CEventButtonState
friend

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