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 &defaultShortcut)
 Shortcut. More...
 
 Shortcut (ShortcutIdentifier identifier, const QStringList &defaultShortcuts)
 Shortcut. More...
 
 Shortcut (const Shortcut &other)
 Copy constructor. More...
 
Shortcutoperator= (const Shortcut &other)
 
void changeShortcut (const QStringList &shortcuts)
 
QString name () const
 get the human-readable name of the shortcut More...
 
QStringList defaultShortcut () 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 databaseKey () const
 
bool isValid () 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 &  defaultShortcut 
)

Shortcut.

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

◆ Shortcut() [2/3]

Shortcut::Shortcut ( ShortcutIdentifier  identifier,
const QStringList &  defaultShortcuts 
)

Shortcut.

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

◆ Shortcut() [3/3]

Shortcut::Shortcut ( const Shortcut other)

Copy constructor.

Parameters
other

Member Function Documentation

◆ changeShortcut()

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

◆ connect() [1/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

◆ connect() [2/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

◆ defaultShortcut()

QStringList Shortcut::defaultShortcut ( ) 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

◆ isValid()

bool Shortcut::isValid ( ) 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