MythTV  master
keybindings.h
Go to the documentation of this file.
1 /* -*- myth -*- */
23 #ifndef KEYBINDINGS_H
24 #define KEYBINDINGS_H
25 
26 // MythControls headers
27 #include "action.h"
28 #include "actionset.h"
29 
37 {
38  public:
41 
42  explicit KeyBindings(QString hostname);
43 
44  // Commands
45  bool AddActionKey(const QString &context_name,
46  const QString &action_name,
47  const QString &key);
48  ActionID *GetConflict(const QString &context_name,
49  const QString &key, int &level) const;
50  void ReplaceActionKey(const QString &context_name,
51  const QString &action_name,
52  const QString &newkey,
53  const QString &oldkey);
54  bool RemoveActionKey(const QString &context_name,
55  const QString &action_name,
56  const QString &key);
57  void CommitChanges(void);
58 
59  // Gets
60  QStringList GetKeys(void) const;
61  QStringList GetContexts(void) const;
62  QStringList GetActions(const QString &context) const;
63  void GetKeyActions(const QString &key, ActionList &list) const;
64  QStringList GetActionKeys(const QString &context_name,
65  const QString &action_name) const;
66  QStringList GetContextKeys(const QString &context) const;
67  QStringList GetKeyContexts(const QString &key) const;
68  QString GetActionDescription(const QString &context_name,
69  const QString &action_name) const;
70  bool HasMandatoryBindings(void) const;
71  bool HasChanges(void) const { return m_actionSet.HasModified(); }
72 
73  protected:
74  void CommitJumppoint(const ActionID &id);
75  void CommitAction(const ActionID &id);
76 
77  void LoadMandatoryBindings(void);
78  void LoadContexts(void);
79  void LoadJumppoints(void);
80 
81  private:
82  QString m_hostname;
84  QStringList m_defaultKeys;
86 };
87 
88 #endif /* KEYBINDINGS_H */
QStringList m_defaultKeys
Definition: keybindings.h:84
bool HasChanges(void) const
Definition: keybindings.h:71
QString GetActionDescription(const QString &context_name, const QString &action_name) const
Get an action's description.
Main header for the action set class.
void CommitChanges(void)
Commit all changes made to the keybindings.
bool HasMandatoryBindings(void) const
Returns true iff all mandatory bindings are satisfied.
Encapsulates information about the current keybindings.
Definition: keybindings.h:36
void ReplaceActionKey(const QString &context_name, const QString &action_name, const QString &newkey, const QString &oldkey)
Replace a key in an action.
Maintains consistancy between actions and keybindings.
Definition: actionset.h:36
void LoadContexts(void)
Load the keybindings from the database.
KeyBindings(QString hostname)
Create a new KeyBindings instance.
Definition: keybindings.cpp:39
A class that uniquely identifies an action.
Definition: action.h:82
QStringList GetKeyContexts(const QString &key) const
Get the context names in which a key is bound.
QStringList GetActions(const QString &context) const
Get a list of the actions in a context.
Definition: keybindings.cpp:71
void LoadMandatoryBindings(void)
Load the mandatory bindings.
Main header for the action class.
void CommitAction(const ActionID &id)
Commit an action to the database, and reload its keybindings.
string hostname
Definition: caa.py:17
QStringList GetContextKeys(const QString &context) const
Get the keys within a context.
bool AddActionKey(const QString &context_name, const QString &action_name, const QString &key)
Add a key to an action.
QString m_hostname
Definition: keybindings.h:82
QStringList GetContexts(void) const
Returns a list of the context names.
Definition: keybindings.cpp:57
ActionSet m_actionSet
Definition: keybindings.h:85
ActionID * GetConflict(const QString &context_name, const QString &key, int &level) const
Determine if adding a key would cause a conflict.
ConflictLevels
Levels of conflict.
Definition: keybindings.h:40
QList< ActionID > ActionList
Definition: action.h:120
void GetKeyActions(const QString &key, ActionList &list) const
Get a list of the actions in a context.
Definition: keybindings.cpp:83
bool RemoveActionKey(const QString &context_name, const QString &action_name, const QString &key)
Unbind a key from an action.
QStringList GetKeys(void) const
Returns a list of all keys bound to an action.
Definition: keybindings.cpp:48
void LoadJumppoints(void)
Load the jumppoints from the database.
bool HasModified(void) const
Returns true iff changes have been made.
Definition: actionset.h:70
void CommitJumppoint(const ActionID &id)
Commit a jumppoint to the database.
ActionList m_mandatoryBindings
Definition: keybindings.h:83
QStringList GetActionKeys(const QString &context_name, const QString &action_name) const
Get an action's keys.
Definition: keybindings.cpp:94