MythTV  master
myththemedmenu.h
Go to the documentation of this file.
1 #ifndef MYTHTHEMEDMENU_H_
2 #define MYTHTHEMEDMENU_H_
3 
4 #include "mythscreentype.h"
5 #include "mythdialogbox.h"
6 #include "mythuistatetype.h"
7 #include "mythuibuttonlist.h"
8 
9 class MythMainWindow;
11 
12 class QKeyEvent;
13 
15 {
16  QString type;
17  QStringList action;
18  QString text;
19  QString alttext;
20  QString description;
21  MythImage *icon {nullptr};
22  bool active {false};
23  QString password;
24 };
25 
26 
32 {
33  public:
34  MythThemedMenuState(MythScreenStack *parent, const QString &name)
35  : MythScreenType(parent, name) {}
36  ~MythThemedMenuState() override = default;
37 
38  bool Create(void) override; // MythScreenType
39 
40  void (*m_callback)(void *, QString &) {nullptr};
41  void *m_callbackdata {nullptr};
42 
43  bool m_killable {false};
44 
45  bool m_loaded {false};
46  MythUIStateType *m_titleState {nullptr};
47  MythUIStateType *m_watermarkState {nullptr};
48  MythUIButtonList *m_buttonList {nullptr};
49  MythUIText *m_descriptionText {nullptr};
50 
51  protected:
52  void CopyFrom(MythUIType *base) override; // MythScreenType
53 };
54 
57 {
58  Q_OBJECT
59  public:
60  MythThemedMenu(const QString &cdir, const QString &menufile,
61  MythScreenStack *parent, const QString &name,
62  bool allowreorder = false, MythThemedMenuState *state = nullptr);
63  ~MythThemedMenu() override;
64 
65  bool foundTheme(void);
66 
67  void getCallback(void (**lcallback)(void *, QString &), void **data);
68  void setCallback(void (*lcallback)(void *, QString &), void *data);
69  void setKillable(void);
70 
71  QString getSelection(void);
72 
73  void aboutToShow(void) override; // MythScreenType
74 
75  void ShowMenu() override; // MythScreenType
76  void aboutScreen();
77  void customEvent(QEvent *event) override; // MythUIType
78  void mediaEvent(MythMediaEvent *event) override; // MythUIType
79 
80  protected:
81  bool keyPressEvent(QKeyEvent *e) override; // MythScreenType
82 
83  private slots:
84  void setButtonActive(MythUIButtonListItem* item);
85  void buttonAction(MythUIButtonListItem* item, bool skipPass = false);
86 
87  private:
88  void SetMenuTheme(const QString &menufile);
89 
90  bool parseMenu(const QString &menuname);
91  void parseThemeButton(QDomElement &element);
92 
93  void addButton(const QString &type, const QString &text,
94  const QString &alttext, const QStringList &action,
95  const QString &description, const QString &password);
96 
97  bool handleAction(const QString &action, const QString &password = QString());
98  static bool findDepends(const QString &fileList);
99  static bool findDependsExec(const QString &filename);
100  static QString findMenuFile(const QString &menuname);
101 
102  bool checkPinCode(const QString &password_setting);
103 
104  MythThemedMenu *m_parent {nullptr};
105 
106  MythThemedMenuState *m_state {nullptr};
107  bool m_allocedstate {false};
108 
109  QString m_selection;
110  bool m_foundtheme {false};
111  bool m_ignorekeys {false};
112  bool m_wantpop {false};
113 
114  QString m_menumode;
115 
116  MythDialogBox* m_menuPopup {nullptr};
117 };
118 
120 
121 #endif
This widget is used for grouping other widgets for display when a particular named state is called.
virtual void aboutToShow(void)
unsigned int slots[4]
Definition: element.c:38
virtual void ShowMenu(void)
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
void customEvent(QEvent *event) override
Definition: mythuitype.cpp:978
MythThemedMenuState(MythScreenStack *parent, const QString &name)
virtual bool Create(void)
Basic menu dialog, message and a list of options.
QString alttext
Q_DECLARE_METATYPE(GrabberScript *)
The base class on which all widgets and screens are based.
Definition: mythuitype.h:63
void CopyFrom(MythUIType *base) override
Copy this widgets state from another.
static void(* m_callback)(void *, QString &)
virtual void mediaEvent(MythMediaEvent *event)
Media/Device status event handler, received from MythMediaMonitor.
Definition: mythuitype.cpp:997
QString password
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Themed menu class, used for main menus in MythTV frontend.
#define MUI_PUBLIC
Definition: mythuiexp.h:9
QString description
MythImage * icon
QStringList action
Screen in which all other widgets are contained and rendered.
static void addButton(const MenuItemContext &c, OSD *osd, bool active, bool &result, const QString &action, const QString &defaultTextActive, const QString &defaultTextInactive, bool isMenu, const QString &textArg)
Definition: tv_play.cpp:11023