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
11
12class 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
Basic menu dialog, message and a list of options.
Screen in which all other widgets are contained and rendered.
virtual void ShowMenu(void)
virtual bool Create(void)
virtual void aboutToShow(void)
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
void CopyFrom(MythUIType *base) override
Copy this widgets state from another.
MythThemedMenuState(MythScreenStack *parent, const QString &name)
~MythThemedMenuState() override=default
Themed menu class, used for main menus in MythTV frontend.
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
This widget is used for grouping other widgets for display when a particular named state is called.
All purpose text widget, displays a text string.
Definition: mythuitext.h:29
The base class on which all widgets and screens are based.
Definition: mythuitype.h:86
virtual void mediaEvent(MythMediaEvent *event)
Media/Device status event handler, received from MythMediaMonitor.
void customEvent(QEvent *event) override
static void(* m_callback)(void *, QString &)
static void * m_callbackdata
Q_DECLARE_METATYPE(std::chrono::seconds)
#define MUI_PUBLIC
Definition: mythuiexp.h:9
QStringList action
QString description
QString alttext
MythImage * icon
QString password