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 
61  : MythScreenType (parent, name),
62  m_filters(Filters)
63  {}
64  ~MythControls() override;
65 
66  bool Create(void) override; // MythScreenType
67  void customEvent(QEvent *event) override; // MythUIType
68 
69  enum ListType
70  {
74  };
75 
76  // Gets
77  QString GetCurrentContext(void);
78  QString GetCurrentAction(void);
79  QString GetCurrentKey(void);
80 
81  protected:
82  void Teardown(void);
83 
84  // Commands
85  bool LoadUI(void);
86  void LoadData(const QString &hostname);
87  void ChangeButtonFocus(int direction);
88  void ChangeView(void);
89  static void SetListContents(MythUIButtonList *uilist,
90  const QStringList & contents,
91  bool arrows = false);
92  void UpdateRightList(void);
93 
94  void GrabKey(void) const;
95  void DeleteKey(void);
96  void Save(void) { m_bindings->CommitChanges(); }
97 
98  // Gets
99  uint GetCurrentButton(void);
100 
101  // Functions
102  void ResolveConflict(ActionID *conflict, int error_level,
103  const QString &key);
104  QString GetTypeDesc(ListType type) const;
105 
106  private slots:
109  void LeftPressed(MythUIButtonListItem *item);
111  void ActionButtonPressed();
112  void RefreshKeyInformation(void);
113  void AddKeyToAction(const QString& key, bool ignoreconflict);
114  void AddKeyToAction(const QString& key);
115 
116  private:
117  void ShowMenu(void) override; // MythScreenType
118  void Close(void) override; // MythScreenType
119 
126  QList<MythUIButton*> m_actionButtons;
128 
130  QStringList m_sortedContexts;
131  QHash<QString, QStringList> m_contexts;
136 };
137 
138 
139 #endif /* MYTHCONTROLS_H */
MythControls::m_rightListType
ListType m_rightListType
Definition: mythcontrols.h:134
MythUIImage
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
MythControls::m_contexts
QHash< QString, QStringList > m_contexts
actions for a given context
Definition: mythcontrols.h:132
MythControls::m_leftListType
ListType m_leftListType
Definition: mythcontrols.h:133
MythControls::m_actionButtons
QList< MythUIButton * > m_actionButtons
Definition: mythcontrols.h:126
MythControls::Teardown
void Teardown(void)
Definition: mythcontrols.cpp:55
ViewType
ViewType
Definition: mythcontrols.h:41
MythScreenStack
Definition: mythscreenstack.h:16
MythControls::DeleteKey
void DeleteKey(void)
Delete the currently active key to action mapping.
Definition: mythcontrols.cpp:524
MythControls::ChangeView
void ChangeView(void)
Change the view.
Definition: mythcontrols.cpp:197
keybindings.h
Main header for keybinding classes.
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:44
MythControls::SetListContents
static void SetListContents(MythUIButtonList *uilist, const QStringList &contents, bool arrows=false)
Set the contents of a list.
Definition: mythcontrols.cpp:284
MythControls::GetCurrentContext
QString GetCurrentContext(void)
Get the currently selected context string.
Definition: mythcontrols.cpp:362
MythControls::ResolveConflict
void ResolveConflict(ActionID *conflict, int error_level, const QString &key)
Resolve a potential conflict.
Definition: mythcontrols.cpp:564
MythControls::ListType
ListType
Definition: mythcontrols.h:69
MythControls::ChangeButtonFocus
void ChangeButtonFocus(int direction)
Change button focus in a particular direction.
Definition: mythcontrols.cpp:138
KeyBindings
Encapsulates information about the current keybindings.
Definition: keybindings.h:36
MythControls::GetCurrentKey
QString GetCurrentKey(void)
Get the currently selected key string.
Definition: mythcontrols.cpp:450
MythUIButtonListItem
Definition: mythuibuttonlist.h:27
MythControls::kKeyList
@ kKeyList
Definition: mythcontrols.h:72
KeyBindings::CommitChanges
void CommitChanges(void)
Commit all changes made to the keybindings.
Definition: keybindings.cpp:324
MythControls::kActionList
@ kActionList
Definition: mythcontrols.h:73
MythControls::m_menuPopup
MythDialogBox * m_menuPopup
Definition: mythcontrols.h:127
MythControls::RefreshKeyInformation
void RefreshKeyInformation(void)
Updates the list of keys that are shown and the description of the action.
Definition: mythcontrols.cpp:329
MythControls::~MythControls
~MythControls() override
Definition: mythcontrols.cpp:50
MythDialogBox
Basic menu dialog, message and a list of options.
Definition: mythdialogbox.h:166
MythControls::LeftPressed
void LeftPressed(MythUIButtonListItem *item)
Slot handling a button being pressed in the left list.
Definition: mythcontrols.cpp:150
MythControls::m_filters
KeyBindings::Filter m_filters
Definition: mythcontrols.h:135
MythUIButton
A single button widget.
Definition: mythuibutton.h:21
MythControls::kContextList
@ kContextList
Definition: mythcontrols.h:71
uint
unsigned int uint
Definition: compat.h:140
kActionsByContext
@ kActionsByContext
Definition: mythcontrols.h:41
MythControls::m_leftDescription
MythUIText * m_leftDescription
Definition: mythcontrols.h:124
MythControls::Save
void Save(void)
Definition: mythcontrols.h:96
MythControls::m_description
MythUIText * m_description
Definition: mythcontrols.h:123
MythControls::AddKeyToAction
void AddKeyToAction(const QString &key, bool ignoreconflict)
Add a key to the currently selected action.
Definition: mythcontrols.cpp:628
MythControls::GetTypeDesc
QString GetTypeDesc(ListType type) const
MythControls::GetCurrentButton
uint GetCurrentButton(void)
Returns the focused button, or Action::kMaximumNumberOfBindings if no buttons are focued.
Definition: mythcontrols.cpp:430
MythControls::m_bindings
KeyBindings * m_bindings
Definition: mythcontrols.h:129
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:30
MythControls::LoadUI
bool LoadUI(void)
MythControls::GetCurrentAction
QString GetCurrentAction(void)
Get the currently selected action string.
Definition: mythcontrols.cpp:388
MythControls::RightSelected
void RightSelected(MythUIButtonListItem *item)
Refreshes key information when an item in the right list is selected.
Definition: mythcontrols.cpp:272
MythControls::GrabKey
void GrabKey(void) const
Definition: mythcontrols.cpp:604
MythControls::m_sortedContexts
QStringList m_sortedContexts
sorted list of contexts
Definition: mythcontrols.h:130
kKeysByContext
@ kKeysByContext
Definition: mythcontrols.h:41
MythControls::RightPressed
void RightPressed(MythUIButtonListItem *item)
Slot handling a button being pressed in the left list.
Definition: mythcontrols.cpp:159
KeyBindings::Filter
Filter
Definition: keybindings.h:39
MythControls::m_currentView
ViewType m_currentView
Definition: mythcontrols.h:120
MythControls::Create
bool Create(void) override
Loads UI elements from theme.
Definition: mythcontrols.cpp:71
ActionID
A class that uniquely identifies an action.
Definition: action.h:84
MythControls
Screen for managing and configuring keyboard input bindings.
Definition: mythcontrols.h:48
MythControls::UpdateRightList
void UpdateRightList(void)
Update the right list.
Definition: mythcontrols.cpp:301
musicbrainzngs.caa.hostname
string hostname
Definition: caa.py:17
MythControls::customEvent
void customEvent(QEvent *event) override
Definition: mythcontrols.cpp:673
MythControls::m_rightList
MythUIButtonList * m_rightList
Definition: mythcontrols.h:122
MythControls::ShowMenu
void ShowMenu(void) override
Definition: mythcontrols.cpp:218
MythControls::LeftSelected
void LeftSelected(MythUIButtonListItem *item)
Refreshes the right list when an item in the left list is selected.
Definition: mythcontrols.cpp:263
MythControls::MythControls
MythControls(MythScreenStack *parent, const char *name, KeyBindings::Filter Filters=KeyBindings::AllBindings)
Creates a new MythControls wizard.
Definition: mythcontrols.h:60
kContextsByKey
@ kContextsByKey
Definition: mythcontrols.h:41
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:151
MythControls::LoadData
void LoadData(const QString &hostname)
Load the settings for a particular host.
Definition: mythcontrols.cpp:495
MythControls::m_leftList
MythUIButtonList * m_leftList
Definition: mythcontrols.h:121
KeyBindings::AllBindings
@ AllBindings
Definition: keybindings.h:41
MythControls::ActionButtonPressed
void ActionButtonPressed()
Slot handling a button being pressed in the left list.
Definition: mythcontrols.cpp:169
MythControls::m_rightDescription
MythUIText * m_rightDescription
Definition: mythcontrols.h:125
mythscreentype.h
MythControls::Close
void Close(void) override
Definition: mythcontrols.cpp:238