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  Q_OBJECT
34  public:
35  MythThemedMenuState(MythScreenStack *parent, const QString &name)
36  : MythScreenType(parent, name) {}
37  ~MythThemedMenuState() override = default;
38 
39  bool Create(void) override; // MythScreenType
40 
41  void (*m_callback)(void *, QString &) {nullptr};
42  void *m_callbackdata {nullptr};
43 
44  bool m_killable {false};
45 
46  bool m_loaded {false};
47  MythUIStateType *m_titleState {nullptr};
48  MythUIStateType *m_watermarkState {nullptr};
49  MythUIButtonList *m_buttonList {nullptr};
50  MythUIText *m_descriptionText {nullptr};
51 
52  protected:
53  void CopyFrom(MythUIType *base) override; // MythScreenType
54 };
55 
58 {
59  Q_OBJECT
60  public:
61  MythThemedMenu(const QString &cdir, const QString &menufile,
62  MythScreenStack *parent, const QString &name,
63  bool allowreorder = false, MythThemedMenuState *state = nullptr);
64  ~MythThemedMenu() override;
65 
66  bool foundTheme(void) const;
67 
68  void getCallback(void (**lcallback)(void *, QString &), void **data);
69  void setCallback(void (*lcallback)(void *, QString &), void *data);
70  void setKillable(void);
71 
72  QString getSelection(void);
73 
74  void aboutToShow(void) override; // MythScreenType
75 
76  void ShowMenu() override; // MythScreenType
77  void aboutScreen();
78  void customEvent(QEvent *event) override; // MythUIType
79  void mediaEvent(MythMediaEvent *event) override; // MythUIType
80 
81  protected:
82  bool keyPressEvent(QKeyEvent *e) override; // MythScreenType
83 
84  private slots:
85  void setButtonActive(MythUIButtonListItem* item);
86  void buttonAction(MythUIButtonListItem* item, bool skipPass);
87  void buttonAction(MythUIButtonListItem* item);
88 
89  private:
90  void SetMenuTheme(const QString &menufile);
91 
92  bool parseMenu(const QString &menuname);
93  void parseThemeButton(QDomElement &element);
94 
95  void addButton(const QString &type, const QString &text,
96  const QString &alttext, const QStringList &action,
97  const QString &description, const QString &password);
98 
99  bool handleAction(const QString &action, const QString &password = QString());
100  static bool findDepends(const QString &fileList);
101  static bool findDependsExec(const QString &filename);
102  static QString findMenuFile(const QString &menuname);
103 
104  bool checkPinCode(const QString &password_setting);
105 
106  MythThemedMenu *m_parent {nullptr};
107 
108  MythThemedMenuState *m_state {nullptr};
109  bool m_allocedstate {false};
110 
111  QString m_selection;
112  bool m_foundtheme {false};
113  bool m_ignorekeys {false};
114  bool m_wantpop {false};
115 
116  QString m_menumode;
117 
118  MythDialogBox* m_menuPopup {nullptr};
119 };
120 
122 
123 #endif
MythUIType::mediaEvent
virtual void mediaEvent(MythMediaEvent *event)
Media/Device status event handler, received from MythMediaMonitor.
Definition: mythuitype.cpp:1027
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
ThemedButton::alttext
QString alttext
Definition: myththemedmenu.h:19
ThemedButton::icon
MythImage * icon
Definition: myththemedmenu.h:21
ThemedButton::action
QStringList action
Definition: myththemedmenu.h:17
ThemedButton::type
QString type
Definition: myththemedmenu.h:16
mythdialogbox.h
MythScreenStack
Definition: mythscreenstack.h:16
MythScreenType::Create
virtual bool Create(void)
Definition: mythscreentype.cpp:266
MythUIType::customEvent
void customEvent(QEvent *event) override
Definition: mythuitype.cpp:1008
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
mythuistatetype.h
MythThemedMenuState::MythThemedMenuState
MythThemedMenuState(MythScreenStack *parent, const QString &name)
Definition: myththemedmenu.h:35
ThemedButton::text
QString text
Definition: myththemedmenu.h:18
MythScreenType::CopyFrom
void CopyFrom(MythUIType *base) override
Copy this widgets state from another.
Definition: mythscreentype.cpp:511
mythuibuttonlist.h
m_callback
static void(* m_callback)(void *, QString &)
Definition: mytharchive.cpp:252
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(StandardSetting *)
MythUIButtonListItem
Definition: mythuibuttonlist.h:41
ThemedButton
Definition: myththemedmenu.h:14
MythDialogBox
Basic menu dialog, message and a list of options.
Definition: mythdialogbox.h:166
MythMediaEvent
Definition: mythmedia.h:183
m_callbackdata
static void * m_callbackdata
Definition: mytharchive.cpp:253
ThemedButton::password
QString password
Definition: myththemedmenu.h:23
MythThemedMenu::m_menumode
QString m_menumode
Definition: myththemedmenu.h:116
MythThemedMenu::m_selection
QString m_selection
Definition: myththemedmenu.h:111
ThemedButton::description
QString description
Definition: myththemedmenu.h:20
MythUIType
The base class on which all widgets and screens are based.
Definition: mythuitype.h:85
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
MythScreenType::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: mythscreentype.cpp:404
MythImage
Definition: mythimage.h:36
ThemedButton::active
bool active
Definition: myththemedmenu.h:22
MythScreenType::ShowMenu
virtual void ShowMenu(void)
Definition: mythscreentype.cpp:393
build_compdb.action
action
Definition: build_compdb.py:9
MythThemedMenuState
Definition: myththemedmenu.h:31
MythThemedMenu
Themed menu class, used for main menus in MythTV frontend.
Definition: myththemedmenu.h:57
MythScreenType::aboutToShow
virtual void aboutToShow(void)
Definition: mythscreentype.cpp:238
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:191
build_compdb.filename
filename
Definition: build_compdb.py:21
MythMainWindow
Definition: mythmainwindow.h:28
MythUIStateType
This widget is used for grouping other widgets for display when a particular named state is called....
Definition: mythuistatetype.h:22
mythscreentype.h