#include <action.h>
On its own, the action cannot actually identify a particular action. This is a class to make the keybinding class easier to manage.
Definition at line 38 of file action.h.
Public Member Functions | |
| Action (const QString &description) | |
| Create a new empty action. | |
| Action (const QString &description, const QString &keys) | |
| Create a new action. | |
| bool | AddKey (const QString &key) |
| Add a key sequence to this action. | |
| bool | ReplaceKey (const QString &newkey, const QString &oldkey) |
| Replace a key. | |
| bool | RemoveKey (const QString &key) |
| Remove a key from this action. | |
| QString | GetDescription (void) const |
| Returns the action description. (note: not threadsafe). | |
| QStringList | GetKeys (void) const |
| Returns the key sequence(s) that trigger this action. | |
| QString | GetKeyString (void) const |
| Returns comma delimited string of key bindings. | |
| bool | IsEmpty (void) const |
| Returns true iff the action has no keys. | |
| bool | HasKey (const QString &key) const |
| Determine if the action already has a key. | |
Static Public Attributes | |
| static const unsigned int | kMaximumNumberOfBindings = 4 |
| The maximum number of keys that can be bound to an action. | |
Private Attributes | |
| QString | m_description |
| The actions description. | |
| QStringList | m_keys |
| The keys bound to the action. | |
| Action::Action | ( | const QString & | description | ) | [inline] |
| Action::Action | ( | const QString & | description, | |
| const QString & | keys | |||
| ) |
Create a new action.
The keys are parased by a QKeySequence, so they should be in "," or ", " delimeted format. Also, there should be no more than four keys in the string.
| description | The description of the action. | |
| keys | The key sequence (strings) that trigger the action. |
Definition at line 41 of file action.cpp.
| bool Action::AddKey | ( | const QString & | key | ) |
Add a key sequence to this action.
We don't add empty keys nor duplicates, and can not add more than kMaximumNumberOfBindings. If any of these restrictions are a problem we return false and do not add the binding.
| key | The key to add to the action. |
Definition at line 75 of file action.cpp.
Referenced by ActionSet::Add().
| bool Action::ReplaceKey | ( | const QString & | newkey, | |
| const QString & | oldkey | |||
| ) |
Replace a key.
| newkey | The new key. | |
| oldkey | The old key, which is being replaced. |
Definition at line 93 of file action.cpp.
Referenced by ActionSet::Replace().
| bool Action::RemoveKey | ( | const QString & | key | ) | [inline] |
Remove a key from this action.
Definition at line 50 of file action.h.
Referenced by ActionSet::Remove().
| QString Action::GetDescription | ( | void | ) | const [inline] |
Returns the action description. (note: not threadsafe).
Definition at line 54 of file action.h.
Referenced by ActionSet::GetDescription().
| QStringList Action::GetKeys | ( | void | ) | const [inline] |
Returns the key sequence(s) that trigger this action.
(note: not threadsafe)
Definition at line 57 of file action.h.
Referenced by ActionSet::AddAction(), AddKey(), ActionSet::GetKeys(), HasKey(), and ReplaceKey().
| QString Action::GetKeyString | ( | void | ) | const [inline] |
Returns comma delimited string of key bindings.
Definition at line 59 of file action.h.
Referenced by ActionSet::GetKeyString().
| bool Action::IsEmpty | ( | void | ) | const [inline] |
| bool Action::HasKey | ( | const QString & | key | ) | const |
Determine if the action already has a key.
| key | The key to check for. |
Definition at line 53 of file action.cpp.
const unsigned int Action::kMaximumNumberOfBindings = 4 [static] |
The maximum number of keys that can be bound to an action.
Definition at line 66 of file action.h.
Referenced by AddKey(), MythControls::AddKeyToAction(), MythControls::Create(), MythControls::GetCurrentButton(), and MythControls::RefreshKeyInformation().
QString Action::m_description [private] |
QStringList Action::m_keys [private] |
The keys bound to the action.
Definition at line 70 of file action.h.
Referenced by AddKey(), GetKeys(), GetKeyString(), IsEmpty(), RemoveKey(), and ReplaceKey().
1.5.5