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:
39  enum Filter
40  {
44  };
45 
48 
49  explicit KeyBindings(QString hostname, Filter Filters = AllBindings);
50 
51  // Commands
52  bool AddActionKey(const QString &context_name,
53  const QString &action_name,
54  const QString &key);
55  ActionID *GetConflict(const QString &context_name,
56  const QString &key, int &level) const;
57  void ReplaceActionKey(const QString &context_name,
58  const QString &action_name,
59  const QString &newkey,
60  const QString &oldkey);
61  bool RemoveActionKey(const QString &context_name,
62  const QString &action_name,
63  const QString &key);
64  void CommitChanges(void);
65 
66  // Gets
67  QStringList GetKeys(void) const;
68  QStringList GetContexts(void) const;
69  QStringList GetActions(const QString &context) const;
70  void GetKeyActions(const QString &key, ActionList &list) const;
71  QStringList GetActionKeys(const QString &context_name,
72  const QString &action_name) const;
73  QStringList GetContextKeys(const QString &context) const;
74  QStringList GetKeyContexts(const QString &key) const;
75  QString GetActionDescription(const QString &context_name,
76  const QString &action_name) const;
77  bool HasMandatoryBindings(void) const;
78  bool HasChanges(void) const { return m_actionSet.HasModified(); }
79 
80  protected:
81  void CommitJumppoint(const ActionID &id);
82  void CommitAction(const ActionID &id);
83 
84  void LoadMandatoryBindings(void);
85  void LoadContexts(void);
86  void LoadJumppoints(void);
87 
88  private:
89  QString m_hostname;
91  QStringList m_defaultKeys;
94 };
95 
96 #endif /* KEYBINDINGS_H */
actionset.h
Main header for the action set class.
KeyBindings::GetKeys
QStringList GetKeys(void) const
Returns a list of all keys bound to an action.
Definition: keybindings.cpp:49
KeyBindings::kKeyBindingError
@ kKeyBindingError
Definition: keybindings.h:47
ActionSet
Maintains consistancy between actions and keybindings.
Definition: actionset.h:37
ActionList
QList< ActionID > ActionList
Definition: action.h:115
KeyBindings::LoadJumppoints
void LoadJumppoints(void)
Load the jumppoints from the database.
Definition: keybindings.cpp:350
KeyBindings::m_defaultKeys
QStringList m_defaultKeys
Definition: keybindings.h:91
KeyBindings::KeyBindings
KeyBindings(QString hostname, Filter Filters=AllBindings)
Create a new KeyBindings instance.
Definition: keybindings.cpp:39
KeyBindings::m_mandatoryBindings
ActionList m_mandatoryBindings
Definition: keybindings.h:90
KeyBindings::GetActions
QStringList GetActions(const QString &context) const
Get a list of the actions in a context.
Definition: keybindings.cpp:72
KeyBindings::kKeyBindingWarning
@ kKeyBindingWarning
Definition: keybindings.h:47
KeyBindings::HasMandatoryBindings
bool HasMandatoryBindings(void) const
Returns true iff all mandatory bindings are satisfied.
Definition: keybindings.cpp:457
action.h
Main header for the action class.
KeyBindings
Encapsulates information about the current keybindings.
Definition: keybindings.h:37
KeyBindings::CommitAction
void CommitAction(const ActionID &id)
Commit an action to the database, and reload its keybindings.
Definition: keybindings.cpp:262
KeyBindings::JustModifiers
@ JustModifiers
Definition: keybindings.h:43
KeyBindings::NoModifiers
@ NoModifiers
Definition: keybindings.h:42
KeyBindings::ReplaceActionKey
void ReplaceActionKey(const QString &context_name, const QString &action_name, const QString &newkey, const QString &oldkey)
Replace a key in an action.
Definition: keybindings.cpp:222
KeyBindings::CommitChanges
void CommitChanges(void)
Commit all changes made to the keybindings.
Definition: keybindings.cpp:324
KeyBindings::m_hostname
QString m_hostname
Definition: keybindings.h:89
KeyBindings::ConflictLevels
ConflictLevels
Levels of conflict.
Definition: keybindings.h:47
KeyBindings::LoadContexts
void LoadContexts(void)
Load the keybindings from the database.
Definition: keybindings.cpp:392
KeyBindings::GetKeyActions
void GetKeyActions(const QString &key, ActionList &list) const
Get a list of the actions in a context.
Definition: keybindings.cpp:84
ActionSet::HasModified
bool HasModified(void) const
Returns true iff changes have been made.
Definition: actionset.h:70
KeyBindings::LoadMandatoryBindings
void LoadMandatoryBindings(void)
Load the mandatory bindings.
Definition: keybindings.cpp:430
KeyBindings::GetKeyContexts
QStringList GetKeyContexts(const QString &key) const
Get the context names in which a key is bound.
Definition: keybindings.cpp:115
KeyBindings::RemoveActionKey
bool RemoveActionKey(const QString &context_name, const QString &action_name, const QString &key)
Unbind a key from an action.
Definition: keybindings.cpp:242
KeyBindings::GetActionKeys
QStringList GetActionKeys(const QString &context_name, const QString &action_name) const
Get an action's keys.
Definition: keybindings.cpp:95
KeyBindings::Filter
Filter
Definition: keybindings.h:40
KeyBindings::CommitJumppoint
void CommitJumppoint(const ActionID &id)
Commit a jumppoint to the database.
Definition: keybindings.cpp:293
KeyBindings::GetContexts
QStringList GetContexts(void) const
Returns a list of the context names.
Definition: keybindings.cpp:58
KeyBindings::GetContextKeys
QStringList GetContextKeys(const QString &context) const
Get the keys within a context.
Definition: keybindings.cpp:106
KeyBindings::m_actionSet
ActionSet m_actionSet
Definition: keybindings.h:92
ActionID
A class that uniquely identifies an action.
Definition: action.h:85
KeyBindings::GetActionDescription
QString GetActionDescription(const QString &context_name, const QString &action_name) const
Get an action's description.
Definition: keybindings.cpp:136
KeyBindings::AddActionKey
bool AddActionKey(const QString &context_name, const QString &action_name, const QString &key)
Add a key to an action.
Definition: keybindings.cpp:152
musicbrainzngs.caa.hostname
string hostname
Definition: caa.py:17
KeyBindings::m_filter
Filter m_filter
Definition: keybindings.h:93
KeyBindings::GetConflict
ActionID * GetConflict(const QString &context_name, const QString &key, int &level) const
Determine if adding a key would cause a conflict.
Definition: keybindings.cpp:179
KeyBindings::AllBindings
@ AllBindings
Definition: keybindings.h:41
KeyBindings::HasChanges
bool HasChanges(void) const
Definition: keybindings.h:78