MythTV
master
|
Maintains consistancy between actions and keybindings. More...
#include <mythfrontend/actionset.h>
Public Member Functions | |
ActionSet ()=default | |
Create a new, empty set of action bindings. More... | |
~ActionSet () | |
bool | AddAction (const ActionID &id, const QString &description, const QString &keys) |
Add an action. More... | |
bool | Add (const ActionID &id, const QString &key) |
Add a binding. More... | |
bool | Remove (const ActionID &id, const QString &key) |
Remove a key from an action identifier. More... | |
bool | Replace (const ActionID &id, const QString &newkey, const QString &oldkey) |
Replace a specific key in a specific action. More... | |
bool | SetModifiedFlag (const ActionID &id, bool modified) |
Mark an action as modified or unmodified by its identifier. More... | |
QStringList | GetContextStrings (void) const |
Returns a list of all contexts in the action set. More... | |
QStringList | GetActionStrings (const QString &context_name) const |
Returns a list of all action in the action set. More... | |
QString | GetKeyString (const ActionID &id) const |
Returns a string containing all the keys in bound to an action by its identifier. More... | |
QStringList | GetKeys (const ActionID &id) const |
Get the keys bound to an action by its identifier. More... | |
QStringList | GetContextKeys (const QString &context_name) const |
QStringList | GetAllKeys (void) const |
Get all keys (from every context) to which an action is bound. More... | |
QString | GetDescription (const ActionID &id) const |
Returns the description of an action by its identifier. More... | |
ActionList | GetActions (const QString &key) const |
Returns the actions bound to the specified key. More... | |
ActionList | GetModified (void) const |
Returns the appropriate container of modified actions. More... | |
bool | HasModified (void) const |
Returns true iff changes have been made. More... | |
bool | IsModified (const ActionID &id) const |
Returns true iff the action is modified. More... | |
Static Public Attributes | |
static const QString | kJumpContext = "JumpPoints" |
The statically assigned context for jump point actions. More... | |
static const QString | kGlobalContext = "Global" |
The name of global actions. More... | |
Protected Member Functions | |
Action * | GetAction (const ActionID &id) |
Returns a pointer to an action by its identifier. (note: result not thread-safe) More... | |
Private Types | |
using | ContextMap = QHash< QString, ActionContext > |
Private Attributes | |
QMap< QString, ActionList > | m_keyToActionMap |
ContextMap | m_contexts |
ActionList | m_modified |
Maintains consistancy between actions and keybindings.
This class handles adding a removing bindings to keys.
Definition at line 36 of file actionset.h.
|
private |
Definition at line 86 of file actionset.h.
|
default |
Create a new, empty set of action bindings.
ActionSet::~ActionSet | ( | ) |
Definition at line 33 of file actionset.cpp.
bool ActionSet::AddAction | ( | const ActionID & | id, |
const QString & | description, | ||
const QString & | keys | ||
) |
Add an action.
If the action has already been added, it will not be added again. There are no duplicate actions in the action set.
id | The action identifier. |
description | The action description. |
keys | The keys for this action. |
Definition at line 200 of file actionset.cpp.
Referenced by KeyBindings::LoadContexts(), and KeyBindings::LoadJumppoints().
Add a binding.
If the key is added, we mark this action as modified, and update the key map.
id | The action identifier. |
key | The symbolic name of the key. |
Definition at line 59 of file actionset.cpp.
Referenced by KeyBindings::AddActionKey().
Remove a key from an action identifier.
If the key is removed from the action, then we remove it from the key list, and mark the action id as modified.
id | The action identifier to remove from. |
key | The key to remove. |
Definition at line 91 of file actionset.cpp.
Referenced by KeyBindings::RemoveActionKey().
Replace a specific key in a specific action.
If the key is replaced, then we remove the old key from the key list and add the new key and mark the action as modified.
id | The action identifier. |
newkey | The new key. |
oldkey | The key to be replaced. |
Definition at line 122 of file actionset.cpp.
Referenced by KeyBindings::ReplaceActionKey().
Mark an action as modified or unmodified by its identifier.
Definition at line 145 of file actionset.cpp.
Referenced by Add(), KeyBindings::CommitChanges(), Remove(), and Replace().
QStringList ActionSet::GetContextStrings | ( | void | ) | const |
Returns a list of all contexts in the action set.
Definition at line 162 of file actionset.cpp.
Referenced by KeyBindings::GetContexts().
QStringList ActionSet::GetActionStrings | ( | const QString & | context_name | ) | const |
Returns a list of all action in the action set.
Definition at line 175 of file actionset.cpp.
Referenced by KeyBindings::GetActions().
QString ActionSet::GetKeyString | ( | const ActionID & | id | ) | const |
Returns a string containing all the keys in bound to an action by its identifier.
Definition at line 224 of file actionset.cpp.
Referenced by KeyBindings::CommitAction(), and KeyBindings::CommitJumppoint().
QStringList ActionSet::GetKeys | ( | const ActionID & | id | ) | const |
Get the keys bound to an action by its identifier.
Definition at line 240 of file actionset.cpp.
Referenced by KeyBindings::GetActionKeys(), KeyBindings::HasMandatoryBindings(), and KeyBindings::RemoveActionKey().
QStringList ActionSet::GetContextKeys | ( | const QString & | context_name | ) | const |
Definition at line 254 of file actionset.cpp.
Referenced by KeyBindings::GetContextKeys().
QStringList ActionSet::GetAllKeys | ( | void | ) | const |
Get all keys (from every context) to which an action is bound.
Definition at line 269 of file actionset.cpp.
Referenced by KeyBindings::GetKeys().
QString ActionSet::GetDescription | ( | const ActionID & | id | ) | const |
Returns the description of an action by its identifier.
Definition at line 284 of file actionset.cpp.
Referenced by KeyBindings::GetActionDescription().
|
inline |
Returns the actions bound to the specified key.
Definition at line 65 of file actionset.h.
Referenced by KeyBindings::GetConflict(), KeyBindings::GetKeyActions(), and KeyBindings::GetKeyContexts().
|
inline |
Returns the appropriate container of modified actions.
Definition at line 68 of file actionset.h.
Referenced by KeyBindings::CommitChanges().
|
inline |
Returns true iff changes have been made.
Definition at line 70 of file actionset.h.
Referenced by KeyBindings::HasChanges().
Returns true iff the action is modified.
Definition at line 72 of file actionset.h.
Referenced by SetModifiedFlag().
Returns a pointer to an action by its identifier. (note: result not thread-safe)
Definition at line 301 of file actionset.cpp.
Referenced by Add(), AddAction(), GetDescription(), GetKeys(), GetKeyString(), Remove(), and Replace().
|
static |
The statically assigned context for jump point actions.
Definition at line 80 of file actionset.h.
Referenced by KeyBindings::CommitChanges(), KeyBindings::GetConflict(), MythControls::LoadData(), and KeyBindings::LoadJumppoints().
|
static |
The name of global actions.
Definition at line 82 of file actionset.h.
Referenced by KeyBindings::GetConflict(), MythControls::LoadData(), and KeyBindings::LoadMandatoryBindings().
|
private |
Definition at line 85 of file actionset.h.
Referenced by Add(), AddAction(), GetActions(), GetAllKeys(), Remove(), and Replace().
|
private |
Definition at line 87 of file actionset.h.
Referenced by AddAction(), GetAction(), GetActionStrings(), GetContextKeys(), GetContextStrings(), GetDescription(), GetKeys(), GetKeyString(), and ~ActionSet().
|
private |
Definition at line 88 of file actionset.h.
Referenced by GetModified(), HasModified(), IsModified(), and SetModifiedFlag().