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

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. More...

#include <Shortcut.h>

Public Member Functions

 Shortcut (ShortcutIdentifier identifier, const QString &default_shortcut)
 Shortcut. More...
 
 Shortcut (ShortcutIdentifier identifier, const QStringList &default_shortcuts)
 Shortcut. More...
 
 Shortcut (const Shortcut &other)
 Copy constructor. More...
 
Shortcutoperator= (const Shortcut &other)
 
void change_shortcut (const QStringList &shortcuts)
 
QString name () const
 get the human-readable name of the shortcut More...
 
QStringList default_shorcut () const
 get a human-readable list of mapped default shortcuts More...
 
QList< QKeySequence > sequences () const
 get a list key squences mapped to this shortcut More...
 
QKeySequence sequence () const
 
const QStringList & shortcuts () const
 get a human-readable list of mapped shortcuts More...
 
ShortcutIdentifier identifier () const
 get the unique identifier More...
 
QString db_key () const
 
bool is_valid () const
 Check if the shortcut is valid or if it was retrieved via getInvalid() More...
 
template<typename T >
void connect (QWidget *parent, T func, Qt::ShortcutContext context=Qt::WindowShortcut)
 create a qt shortcut for a widget More...
 
void connect (QWidget *parent, QObject *receiver, const char *slot, Qt::ShortcutContext context=Qt::WindowShortcut)
 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...
 

Friends

class ShortcutHandler
 

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.

Constructor & Destructor Documentation

◆ Shortcut() [1/3]

Shortcut::Shortcut ( ShortcutIdentifier  identifier,
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 ( ShortcutIdentifier  identifier,
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

◆ connect() [1/2]

template<typename T >
void Shortcut::connect ( QWidget *  parent,
func,
Qt::ShortcutContext  context = Qt::WindowShortcut 
)
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

◆ connect() [2/2]

void Shortcut::connect ( QWidget *  parent,
QObject *  receiver,
const char *  slot,
Qt::ShortcutContext  context = Qt::WindowShortcut 
)

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

◆ default_shorcut()

QStringList Shortcut::default_shorcut ( ) const

get a human-readable list of mapped default 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

◆ identifier()

ShortcutIdentifier Shortcut::identifier ( ) const

get the unique identifier

Returns

◆ is_valid()

bool Shortcut::is_valid ( ) const

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

Returns

◆ name()

QString Shortcut::name ( ) const

get the human-readable name of the shortcut

Returns

◆ sequences()

QList<QKeySequence> Shortcut::sequences ( ) const

get a list key squences mapped to this shortcut

Returns

◆ shortcuts()

const QStringList& Shortcut::shortcuts ( ) const

get a human-readable list of mapped shortcuts

Returns