MythTV  master
mythcontrols.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
23 #ifndef MYTHCONTROLS_H
24 #define MYTHCONTROLS_H
25 
26 // QT
27 #include <QList>
28 #include <QHash>
29 
30 // MythUI
31 #include "mythscreentype.h"
32 
33 #include "keybindings.h"
34 
35 class MythUIText;
36 class MythUIButtonList;
37 class MythUIButton;
38 class MythUIImage;
39 class MythDialogBox;
40 
42 
49 {
50  Q_OBJECT
51 
52  public:
53 
59  MythControls(MythScreenStack *parent, const char *name)
60  : MythScreenType (parent, name) {}
61  ~MythControls() override;
62 
63  bool Create(void) override; // MythScreenType
64  void customEvent(QEvent *event) override; // MythUIType
65 
66  enum ListType
67  {
71  };
72 
73  // Gets
74  QString GetCurrentContext(void);
75  QString GetCurrentAction(void);
76  QString GetCurrentKey(void);
77 
78  protected:
79  void Teardown(void);
80 
81  // Commands
82  bool LoadUI(void);
83  void LoadData(const QString &hostname);
84  void ChangeButtonFocus(int direction);
85  void ChangeView(void);
86  static void SetListContents(MythUIButtonList *uilist,
87  const QStringList & contents,
88  bool arrows = false);
89  void UpdateRightList(void);
90 
91  void GrabKey(void);
92  void DeleteKey(void);
93  void Save(void) { m_bindings->CommitChanges(); }
94 
95  // Gets
96  uint GetCurrentButton(void);
97 
98  // Functions
99  void ResolveConflict(ActionID *conflict, int error_level,
100  const QString &key);
101  QString GetTypeDesc(ListType type) const;
102 
103  private slots:
106  void LeftPressed(MythUIButtonListItem *item);
108  void ActionButtonPressed();
109  void RefreshKeyInformation(void);
110  void AddKeyToAction(const QString& key, bool ignoreconflict = false);
111 
112  private:
113  void ShowMenu(void) override; // MythScreenType
114  void Close(void) override; // MythScreenType
115 
122  QList<MythUIButton*> m_actionButtons;
124 
126  QStringList m_sortedContexts;
127  QHash<QString, QStringList> m_contexts;
131 };
132 
133 
134 #endif /* MYTHCONTROLS_H */
Screen for managing and configuring keyboard input bindings.
Definition: mythcontrols.h:48
unsigned int slots[4]
Definition: element.c:38
void Save(void)
Definition: mythcontrols.h:93
void GrabKey(void)
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
ViewType
Definition: mythcontrols.h:41
void RefreshKeyInformation(void)
Updates the list of keys that are shown and the description of the action.
void CommitChanges(void)
Commit all changes made to the keybindings.
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
void RightSelected(MythUIButtonListItem *item)
Refreshes key information when an item in the right list is selected.
Basic menu dialog, message and a list of options.
bool LoadUI(void)
Encapsulates information about the current keybindings.
Definition: keybindings.h:36
MythUIButtonList * m_rightList
Definition: mythcontrols.h:118
QString GetTypeDesc(ListType type) const
A class that uniquely identifies an action.
Definition: action.h:84
KeyBindings * m_bindings
Definition: mythcontrols.h:125
ViewType m_currentView
Definition: mythcontrols.h:116
void customEvent(QEvent *event) override
void LeftSelected(MythUIButtonListItem *item)
Refreshes the right list when an item in the left list is selected.
void Close(void) override
void AddKeyToAction(const QString &key, bool ignoreconflict=false)
Add a key to the currently selected action.
MythUIButtonList * m_leftList
Definition: mythcontrols.h:117
MythUIText * m_description
Definition: mythcontrols.h:119
void ChangeView(void)
Change the view.
void ActionButtonPressed()
Slot handling a button being pressed in the left list.
MythUIText * m_rightDescription
Definition: mythcontrols.h:121
QList< MythUIButton * > m_actionButtons
Definition: mythcontrols.h:122
ListType m_rightListType
Definition: mythcontrols.h:130
void ShowMenu(void) override
QHash< QString, QStringList > m_contexts
actions for a given context
Definition: mythcontrols.h:128
string hostname
Definition: caa.py:17
unsigned int uint
Definition: compat.h:140
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
void LeftPressed(MythUIButtonListItem *item)
Slot handling a button being pressed in the left list.
uint GetCurrentButton(void)
Returns the focused button, or Action::kMaximumNumberOfBindings if no buttons are focued.
void Teardown(void)
bool Create(void) override
Loads UI elements from theme.
A single button widget.
Definition: mythuibutton.h:21
MythDialogBox * m_menuPopup
Definition: mythcontrols.h:123
QString GetCurrentContext(void)
Get the currently selected context string.
MythControls(MythScreenStack *parent, const char *name)
Creates a new MythControls wizard.
Definition: mythcontrols.h:59
Main header for keybinding classes.
void ResolveConflict(ActionID *conflict, int error_level, const QString &key)
Resolve a potential conflict.
QString GetCurrentKey(void)
Get the currently selected key string.
void DeleteKey(void)
Delete the currently active key to action mapping.
void ChangeButtonFocus(int direction)
Change button focus in a particular direction.
void RightPressed(MythUIButtonListItem *item)
Slot handling a button being pressed in the left list.
ListType m_leftListType
Definition: mythcontrols.h:129
static void SetListContents(MythUIButtonList *uilist, const QStringList &contents, bool arrows=false)
Set the contents of a list.
QString GetCurrentAction(void)
Get the currently selected action string.
void LoadData(const QString &hostname)
Load the settings for a particular host.
Screen in which all other widgets are contained and rendered.
void UpdateRightList(void)
Update the right list.
~MythControls() override
MythUIText * m_leftDescription
Definition: mythcontrols.h:120
QStringList m_sortedContexts
sorted list of contexts
Definition: mythcontrols.h:126