MythTV
master
|
Encapsulates information about the current keybindings. More...
#include <mythfrontend/keybindings.h>
Public Types | |
enum | Filter : std::uint8_t { AllBindings, NoModifiers, JustModifiers } |
enum | ConflictLevels : std::uint8_t { kKeyBindingWarning, kKeyBindingError } |
Levels of conflict. More... | |
Public Member Functions | |
KeyBindings (QString hostname, Filter Filters=AllBindings) | |
Create a new KeyBindings instance. More... | |
bool | AddActionKey (const QString &context_name, const QString &action_name, const QString &key) |
Add a key to an action. More... | |
ActionID * | GetConflict (const QString &context_name, const QString &key, int &level) const |
Determine if adding a key would cause a conflict. More... | |
void | ReplaceActionKey (const QString &context_name, const QString &action_name, const QString &newkey, const QString &oldkey) |
Replace a key in an action. More... | |
bool | RemoveActionKey (const QString &context_name, const QString &action_name, const QString &key) |
Unbind a key from an action. More... | |
void | CommitChanges (void) |
Commit all changes made to the keybindings. More... | |
QStringList | GetKeys (void) const |
Returns a list of all keys bound to an action. More... | |
QStringList | GetContexts (void) const |
Returns a list of the context names. More... | |
QStringList | GetActions (const QString &context) const |
Get a list of the actions in a context. More... | |
void | GetKeyActions (const QString &key, ActionList &list) const |
Get a list of the actions in a context. More... | |
QStringList | GetActionKeys (const QString &context_name, const QString &action_name) const |
Get an action's keys. More... | |
QStringList | GetContextKeys (const QString &context) const |
Get the keys within a context. More... | |
QStringList | GetKeyContexts (const QString &key) const |
Get the context names in which a key is bound. More... | |
QString | GetActionDescription (const QString &context_name, const QString &action_name) const |
Get an action's description. More... | |
bool | HasMandatoryBindings (void) const |
Returns true iff all mandatory bindings are satisfied. More... | |
bool | HasChanges (void) const |
Protected Member Functions | |
void | CommitJumppoint (const ActionID &id) |
Commit a jumppoint to the database. More... | |
void | CommitAction (const ActionID &id) |
Commit an action to the database, and reload its keybindings. More... | |
void | LoadMandatoryBindings (void) |
Load the mandatory bindings. More... | |
void | LoadContexts (void) |
Load the keybindings from the database. More... | |
void | LoadJumppoints (void) |
Load the jumppoints from the database. More... | |
Private Attributes | |
QString | m_hostname |
ActionList | m_mandatoryBindings |
QStringList | m_defaultKeys |
ActionSet | m_actionSet |
Filter | m_filter { AllBindings } |
Encapsulates information about the current keybindings.
This class can retrieve, set, and modify the keybindings used by MythTV
Definition at line 36 of file keybindings.h.
enum KeyBindings::Filter : std::uint8_t |
Enumerator | |
---|---|
AllBindings | |
NoModifiers | |
JustModifiers |
Definition at line 39 of file keybindings.h.
enum KeyBindings::ConflictLevels : std::uint8_t |
Levels of conflict.
Enumerator | |
---|---|
kKeyBindingWarning | |
kKeyBindingError |
Definition at line 47 of file keybindings.h.
|
explicit |
Create a new KeyBindings instance.
hostname | The host for which to create the key bindings. |
Definition at line 39 of file keybindings.cpp.
bool KeyBindings::AddActionKey | ( | const QString & | context_name, |
const QString & | action_name, | ||
const QString & | key | ||
) |
Add a key to an action.
This does not take effect until CommitChanges() is called.
context_name | The name of the context. |
action_name | The name of the action. |
key | The key to add. |
Definition at line 152 of file keybindings.cpp.
Referenced by MythControls::AddKeyToAction().
ActionID * KeyBindings::GetConflict | ( | const QString & | context_name, |
const QString & | key, | ||
int & | level | ||
) | const |
Determine if adding a key would cause a conflict.
context_name | The name of the context. |
key | The key to add. |
level | The level of conflict if this returns an ActionID |
Conflicts occur if:
If the method does not return NULL, check the value given to level. Warnings can be ignored (at the users disgression), but errors should be prevented no matter what.
NOTE: If this returns a non-null pointer, the ActionID returned must be explicitly deleted with C++ "delete".
Definition at line 179 of file keybindings.cpp.
Referenced by MythControls::AddKeyToAction().
void KeyBindings::ReplaceActionKey | ( | const QString & | context_name, |
const QString & | action_name, | ||
const QString & | newkey, | ||
const QString & | oldkey | ||
) |
Replace a key in an action.
This does not take effect until CommitChanges() is called.
context_name | The name of the context. |
action_name | The name of the action. |
newkey | The key to add. |
oldkey | The index of the key to be replaced |
Definition at line 222 of file keybindings.cpp.
Referenced by MythControls::AddKeyToAction().
bool KeyBindings::RemoveActionKey | ( | const QString & | context_name, |
const QString & | action_name, | ||
const QString & | key | ||
) |
Unbind a key from an action.
Unless the action is Mandatory there is only one key in the action, this method should return true.
context_name | The name of the context. |
action_name | The name of the action. |
key | The key to remove. |
Definition at line 242 of file keybindings.cpp.
Referenced by MythControls::DeleteKey().
void KeyBindings::CommitChanges | ( | void | ) |
Commit all changes made to the keybindings.
This method will write the changes to the database, unbind MythTV's current bindings for those actions that changed, and setup the new bindings.
Definition at line 324 of file keybindings.cpp.
Referenced by MythControls::Save().
QStringList KeyBindings::GetKeys | ( | void | ) | const |
Returns a list of all keys bound to an action.
Definition at line 49 of file keybindings.cpp.
Referenced by MythControls::customEvent().
QStringList KeyBindings::GetContexts | ( | void | ) | const |
Returns a list of the context names.
Definition at line 58 of file keybindings.cpp.
Referenced by MythControls::Create(), MythControls::customEvent(), and MythControls::LoadData().
QStringList KeyBindings::GetActions | ( | const QString & | context | ) | const |
Get a list of the actions in a context.
context | The name of the context. |
Definition at line 72 of file keybindings.cpp.
Referenced by MythControls::LoadData().
void KeyBindings::GetKeyActions | ( | const QString & | key, |
ActionList & | list | ||
) | const |
Get a list of the actions in a context.
key | The name of the context. |
list | A list of action (names) for the target context. |
Definition at line 84 of file keybindings.cpp.
QStringList KeyBindings::GetActionKeys | ( | const QString & | context_name, |
const QString & | action_name | ||
) | const |
Get an action's keys.
context_name | The name of the context. |
action_name | The name of the action. |
Definition at line 95 of file keybindings.cpp.
Referenced by MythControls::AddKeyToAction(), MythControls::GetCurrentKey(), and MythControls::RefreshKeyInformation().
QStringList KeyBindings::GetContextKeys | ( | const QString & | context | ) | const |
Get the keys within a context.
context | The context name. |
Definition at line 106 of file keybindings.cpp.
Referenced by MythControls::UpdateRightList().
QStringList KeyBindings::GetKeyContexts | ( | const QString & | key | ) | const |
Get the context names in which a key is bound.
Definition at line 115 of file keybindings.cpp.
Referenced by MythControls::UpdateRightList().
QString KeyBindings::GetActionDescription | ( | const QString & | context_name, |
const QString & | action_name | ||
) | const |
Get an action's description.
context_name | The name of the context. |
action_name | The name of the action. |
Definition at line 136 of file keybindings.cpp.
Referenced by MythControls::RefreshKeyInformation().
bool KeyBindings::HasMandatoryBindings | ( | void | ) | const |
Returns true iff all mandatory bindings are satisfied.
Definition at line 457 of file keybindings.cpp.
|
inline |
Definition at line 78 of file keybindings.h.
Referenced by MythControls::Close().
|
protected |
Commit a jumppoint to the database.
TODO FIXME This does not reload the jumppoint.
Definition at line 293 of file keybindings.cpp.
Referenced by CommitChanges().
|
protected |
Commit an action to the database, and reload its keybindings.
Definition at line 262 of file keybindings.cpp.
Referenced by CommitChanges().
|
protected |
Load the mandatory bindings.
Definition at line 430 of file keybindings.cpp.
Referenced by KeyBindings().
|
protected |
Load the keybindings from the database.
This will load the keybindings which apply to the hostname specified to the constructor.
Definition at line 392 of file keybindings.cpp.
Referenced by KeyBindings().
|
protected |
Load the jumppoints from the database.
This method will load the keybindings for jump points.
Definition at line 350 of file keybindings.cpp.
Referenced by KeyBindings().
|
private |
Definition at line 89 of file keybindings.h.
Referenced by CommitAction(), CommitJumppoint(), LoadContexts(), and LoadJumppoints().
|
private |
Definition at line 90 of file keybindings.h.
Referenced by HasMandatoryBindings(), LoadMandatoryBindings(), and RemoveActionKey().
|
private |
Definition at line 91 of file keybindings.h.
Referenced by LoadMandatoryBindings().
|
private |
Definition at line 92 of file keybindings.h.
Referenced by AddActionKey(), CommitAction(), CommitChanges(), CommitJumppoint(), GetActionDescription(), GetActionKeys(), GetActions(), GetConflict(), GetContextKeys(), GetContexts(), GetKeyActions(), GetKeyContexts(), GetKeys(), HasChanges(), HasMandatoryBindings(), LoadContexts(), LoadJumppoints(), RemoveActionKey(), and ReplaceActionKey().
|
private |
Definition at line 93 of file keybindings.h.
Referenced by LoadContexts(), and LoadJumppoints().