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) const;
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
e
QDomElement e
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:1417
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(GrabberScript *)
MythUIType::mediaEvent
virtual void mediaEvent(MythMediaEvent *event)
Media/Device status event handler, received from MythMediaMonitor.
Definition: mythuitype.cpp:1002
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
m_callback
static void(* m_callback)(void *, QString &)
Definition: mythplugins/mytharchive/mytharchive/main.cpp:256
mythdialogbox.h
MythScreenStack
Definition: mythscreenstack.h:16
MythScreenType::Create
virtual bool Create(void)
Definition: mythscreentype.cpp:282
MythUIType::customEvent
void customEvent(QEvent *event) override
Definition: mythuitype.cpp:983
slots
unsigned int slots[4]
Definition: element.cpp:38
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:34
ThemedButton::text
QString text
Definition: myththemedmenu.h:18
MythScreenType::CopyFrom
void CopyFrom(MythUIType *base) override
Copy this widgets state from another.
Definition: mythscreentype.cpp:521
mythuibuttonlist.h
MythUIButtonListItem
Definition: mythuibuttonlist.h:28
ThemedButton
Definition: myththemedmenu.h:15
MythThemedMenuState::~MythThemedMenuState
~MythThemedMenuState() override=default
MythDialogBox
Basic menu dialog, message and a list of options.
Definition: mythdialogbox.h:138
MythMediaEvent
Definition: mythmedia.h:184
addButton
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:11015
filename
QString filename
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:634
ThemedButton::password
QString password
Definition: myththemedmenu.h:23
MythThemedMenu::m_menumode
QString m_menumode
Definition: myththemedmenu.h:114
MythThemedMenu::m_selection
QString m_selection
Definition: myththemedmenu.h:109
ThemedButton::description
QString description
Definition: myththemedmenu.h:20
MythUIType
The base class on which all widgets and screens are based.
Definition: mythuitype.h:64
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:29
MythScreenType::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: mythscreentype.cpp:414
MythImage
Definition: mythimage.h:37
ThemedButton::active
bool active
Definition: myththemedmenu.h:22
MythScreenType::ShowMenu
virtual void ShowMenu(void)
Definition: mythscreentype.cpp:409
build_compdb.action
action
Definition: build_compdb.py:9
MythThemedMenuState
Definition: myththemedmenu.h:32
MythThemedMenu
Themed menu class, used for main menus in MythTV frontend.
Definition: myththemedmenu.h:57
MythScreenType::aboutToShow
virtual void aboutToShow(void)
Definition: mythscreentype.cpp:254
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:144
MythMainWindow
Definition: mythmainwindow.h:33
MythUIStateType
This widget is used for grouping other widgets for display when a particular named state is called....
Definition: mythuistatetype.h:23
mythscreentype.h
m_callbackdata
static void * m_callbackdata
Definition: mythplugins/mytharchive/mytharchive/main.cpp:257