MythTV  master
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
26 // QT
27 #include <QList>
28 #include <QHash>
30 // MythUI
31 #include "mythscreentype.h"
33 #include "keybindings.h"
35 class MythUIText;
36 class MythUIButtonList;
37 class MythUIButton;
38 class MythUIImage;
39 class MythDialogBox;
49 {
52  public:
59  MythControls(MythScreenStack *parent, const char *name)
60  : MythScreenType (parent, name) {}
61  ~MythControls() override;
63  bool Create(void) override; // MythScreenType
64  void customEvent(QEvent *event) override; // MythUIType
66  enum ListType
67  {
71  };
73  // Gets
74  QString GetCurrentContext(void);
75  QString GetCurrentAction(void);
76  QString GetCurrentKey(void);
78  protected:
79  void Teardown(void);
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);
91  void GrabKey(void);
92  void DeleteKey(void);
93  void Save(void) { m_bindings->CommitChanges(); }
95  // Gets
96  uint GetCurrentButton(void);
98  // Functions
99  void ResolveConflict(ActionID *conflict, int error_level,
100  const QString &key);
101  QString GetTypeDesc(ListType type) const;
103  private slots:
106  void LeftPressed(MythUIButtonListItem *item);
108  void ActionButtonPressed();
109  void RefreshKeyInformation(void);
110  void AddKeyToAction(const QString& key, bool ignoreconflict = false);
112  private:
113  void ShowMenu(void) override; // MythScreenType
114  void Close(void) override; // MythScreenType
122  QList<MythUIButton*> m_actionButtons;
126  QStringList m_sortedContexts;
127  QHash<QString, QStringList> m_contexts;
131 };
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
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
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