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
32
33#include "keybindings.h"
34
35class MythUIText;
37class MythUIButton;
38class MythUIImage;
39class 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 : std::uint8_t
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
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:
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;
132 QHash<QString, QStringList> m_contexts;
136};
137
138
139#endif /* MYTHCONTROLS_H */
A class that uniquely identifies an action.
Definition: action.h:85
Encapsulates information about the current keybindings.
Definition: keybindings.h:37
void CommitChanges(void)
Commit all changes made to the keybindings.
Screen for managing and configuring keyboard input bindings.
Definition: mythcontrols.h:49
void DeleteKey(void)
Delete the currently active key to action mapping.
void ActionButtonPressed()
Slot handling a button being pressed in the left list.
MythUIButtonList * m_leftList
Definition: mythcontrols.h:121
QList< MythUIButton * > m_actionButtons
Definition: mythcontrols.h:126
ListType m_leftListType
Definition: mythcontrols.h:133
MythControls(MythScreenStack *parent, const char *name, KeyBindings::Filter Filters=KeyBindings::AllBindings)
Creates a new MythControls wizard.
Definition: mythcontrols.h:60
KeyBindings * m_bindings
Definition: mythcontrols.h:129
void Teardown(void)
KeyBindings::Filter m_filters
Definition: mythcontrols.h:135
MythUIText * m_leftDescription
Definition: mythcontrols.h:124
void UpdateRightList(void)
Update the right list.
QString GetCurrentAction(void)
Get the currently selected action string.
QString GetTypeDesc(ListType type) const
ListType m_rightListType
Definition: mythcontrols.h:134
MythDialogBox * m_menuPopup
Definition: mythcontrols.h:127
void GrabKey(void) const
void ResolveConflict(ActionID *conflict, int error_level, const QString &key)
Resolve a potential conflict.
ViewType m_currentView
Definition: mythcontrols.h:120
static void SetListContents(MythUIButtonList *uilist, const QStringList &contents, bool arrows=false)
Set the contents of a list.
MythUIButtonList * m_rightList
Definition: mythcontrols.h:122
uint GetCurrentButton(void)
Returns the focused button, or Action::kMaximumNumberOfBindings if no buttons are focued.
void RefreshKeyInformation(void)
Updates the list of keys that are shown and the description of the action.
void LeftSelected(MythUIButtonListItem *item)
Refreshes the right list when an item in the left list is selected.
~MythControls() override
void customEvent(QEvent *event) override
QStringList m_sortedContexts
sorted list of contexts
Definition: mythcontrols.h:130
void Close(void) override
void ChangeView(void)
Change the view.
bool Create(void) override
Loads UI elements from theme.
void RightPressed(MythUIButtonListItem *item)
Slot handling a button being pressed in the left list.
void AddKeyToAction(const QString &key, bool ignoreconflict)
Add a key to the currently selected action.
void Save(void)
Definition: mythcontrols.h:96
void RightSelected(MythUIButtonListItem *item)
Refreshes key information when an item in the right list is selected.
void ChangeButtonFocus(int direction)
Change button focus in a particular direction.
QHash< QString, QStringList > m_contexts
actions for a given context
Definition: mythcontrols.h:132
bool LoadUI(void)
MythUIText * m_rightDescription
Definition: mythcontrols.h:125
QString GetCurrentKey(void)
Get the currently selected key string.
void LeftPressed(MythUIButtonListItem *item)
Slot handling a button being pressed in the left list.
QString GetCurrentContext(void)
Get the currently selected context string.
void ShowMenu(void) override
void LoadData(const QString &hostname)
Load the settings for a particular host.
MythUIText * m_description
Definition: mythcontrols.h:123
Basic menu dialog, message and a list of options.
Screen in which all other widgets are contained and rendered.
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
A single button widget.
Definition: mythuibutton.h:22
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:98
All purpose text widget, displays a text string.
Definition: mythuitext.h:29
unsigned int uint
Definition: freesurround.h:24
Main header for keybinding classes.
ViewType
Definition: mythcontrols.h:41
@ kActionsByContext
Definition: mythcontrols.h:41
@ kKeysByContext
Definition: mythcontrols.h:41
@ kContextsByKey
Definition: mythcontrols.h:41
string hostname
Definition: caa.py:17