Sayonara Player
Public Member Functions | Static Public Member Functions | List of all members
Shortcut Class Reference

#include <Shortcut.h>

Detailed Description

A single shortcut managed by ShortcutHandler. This class holds information about the default shortcuts, the user defined shortcuts, a name attached to each shortcut an identifier which is written into the database and a list of the corresponding shortcuts in the Qt format.

Public Member Functions

 Shortcut (ShortcutWidget *parent, const QString &identifier, const QString &name, const QString &default_shortcut)
 Shortcut. More...
 
 Shortcut (ShortcutWidget *parent, const QString &identifier, const QString &name, const QStringList &default_shortcuts)
 Shortcut. More...
 
 Shortcut (const Shortcut &other)
 Copy constructor. More...
 
Shortcutoperator= (const Shortcut &other)
 
void change_shortcut (const QStringList &shortcuts)
 
QString get_name () const
 get the human-readable name of the shortcut More...
 
QStringList get_default () const
 get a human-readable list of mapped default shortcuts More...
 
QList< QKeySequence > get_sequences () const
 get a list key squences mapped to this shortcut More...
 
QStringList get_shortcuts () const
 get a human-readable list of mapped shortcuts More...
 
QString get_identifier () const
 get the unique identifier More...
 
bool is_valid () const
 Check if the shortcut is valid or if it was retrieved via getInvalid() More...
 
template<typename T >
void create_qt_shortcut (QWidget *parent, T func)
 create a qt shortcut for a widget More...
 
void create_qt_shortcut (QWidget *parent, QObject *receiver, const char *slot)
 create a qt shortcut for a widget More...
 

Static Public Member Functions

static Shortcut getInvalid ()
 get a raw and invalid shortcut. This function is used instead of the default constructor More...
 

Constructor & Destructor Documentation

◆ Shortcut() [1/3]

Shortcut::Shortcut ( ShortcutWidget parent,
const QString &  identifier,
const QString &  name,
const QString &  default_shortcut 
)

Shortcut.

Parameters
identifieran unique identifier used to write the shortcut into the database
namethe name displayed in the Shortcut configuration dialog
default_shortcutone default shortcut

◆ Shortcut() [2/3]

Shortcut::Shortcut ( ShortcutWidget parent,
const QString &  identifier,
const QString &  name,
const QStringList &  default_shortcuts 
)

Shortcut.

Parameters
identifieran unique identifier used to write the shortcut into the database
namethe name displayed in the Shortcut configuration dialog
default_shortcutsa list of default shortcuts

◆ Shortcut() [3/3]

Shortcut::Shortcut ( const Shortcut other)

Copy constructor.

Parameters
other

Member Function Documentation

◆ change_shortcut()

void Shortcut::change_shortcut ( const QStringList &  shortcuts)
Parameters
shortcutsmap new user-readable key sequences to this shortcut

◆ create_qt_shortcut() [1/2]

template<typename T >
void Shortcut::create_qt_shortcut ( QWidget *  parent,
func 
)
inline

create a qt shortcut for a widget

Parameters
parentthe widget the shortcut is attached to
funca lambda function which will be triggered when shortcut is pressed

◆ create_qt_shortcut() [2/2]

void Shortcut::create_qt_shortcut ( QWidget *  parent,
QObject *  receiver,
const char *  slot 
)

create a qt shortcut for a widget

Parameters
parentthe widget the shortcut is attached to
thereceiver object of the shortcut
theslot which is triggered when pressing that shortcut

◆ get_default()

QStringList Shortcut::get_default ( ) const

get a human-readable list of mapped default shortcuts

Returns

◆ get_identifier()

QString Shortcut::get_identifier ( ) const

get the unique identifier

Returns

◆ get_name()

QString Shortcut::get_name ( ) const

get the human-readable name of the shortcut

Returns

◆ get_sequences()

QList<QKeySequence> Shortcut::get_sequences ( ) const

get a list key squences mapped to this shortcut

Returns

◆ get_shortcuts()

QStringList Shortcut::get_shortcuts ( ) const

get a human-readable list of mapped shortcuts

Returns

◆ getInvalid()

static Shortcut Shortcut::getInvalid ( )
static

get a raw and invalid shortcut. This function is used instead of the default constructor

Returns
an uninitialized shortcut

◆ is_valid()

bool Shortcut::is_valid ( ) const

Check if the shortcut is valid or if it was retrieved via getInvalid()

Returns