MythTV  master
mythtvmenu.h
Go to the documentation of this file.
1 #ifndef MYTHTVMENU_H
2 #define MYTHTVMENU_H
3 
4 // Qt
5 #include <QMetaType>
6 #include <QDomDocument>
7 
8 // MythTV
9 #include "mythtvexp.h"
10 
12 {
16 };
17 
19 {
23 };
24 
26 {
30 };
31 
32 // These correlate to the four MythTVMenu objects that are allocated
33 // and stashed inside of a TV object. They are used to find the
34 // original menu again, instead of serializing/deserializing the
35 // entire MythTVMenu object to/from a QVariant.
37 {
43 };
44 
45 class OSD;
46 class MythOSDDialogData;
47 class MythTVMenu;
48 
50 {
51  public:
52  bool AddButton(MythOSDDialogData* Menu, bool Active,const QString& Action,
53  const QString& DefaultTextActive, const QString& DefaultTextInactive,
54  bool IsMenu, const QString& TextArg) const;
55 
56  MythTVMenuItemContext(const MythTVMenu& Menu, const QDomNode& Node,
57  QString Name, MenuCurrentContext Current, bool Visible);
58  MythTVMenuItemContext(const MythTVMenu& Menu, const QDomNode& Node,
59  MenuShowContext Context, MenuCurrentContext Current,
60  QString Action, QString ActionText, bool Visible);
61  MythTVMenuItemContext(const MythTVMenu& Menu, const QDomNode& Node,
62  MenuShowContext Context, MenuCurrentContext Current,
63  QString Action, bool Visible);
64 
66  const QDomNode& m_node;
68  const QString m_menuName;
71  const QString m_action;
72  const QString m_actionText;
73  bool m_visible { false };
74 };
75 
77 {
78  public:
79  virtual ~MythTVMenuItemDisplayer() = default;
80  virtual bool MenuItemDisplay(const MythTVMenuItemContext& Context, MythOSDDialogData* Menu) = 0;
81 };
82 
84 {
85  public:
86  MythTVMenu() = default;
87  ~MythTVMenu();
88  static bool MatchesGroup(const QString& Name, const QString& Prefix,
89  MenuCategory Category, QString& OutPrefix);
90  bool LoadFromFile(MenuTypeId id, const QString& Filename, const QString& Menuname,
91  const char * TranslationContext, const QString& KeyBindingContext,
92  int IncludeLevel = 0);
93  bool LoadFromString(MenuTypeId id, const QString& Text, const QString& Menuname,
94  const char * TranslationContext, const QString& KeyBindingContext,
95  int IncludeLevel = 0);
96  bool IsLoaded() const;
97  QDomElement GetRoot() const;
98  QString Translate(const QString& Text) const;
99  bool Show(const QDomNode& Node, const QDomNode& Selected,
100  MythTVMenuItemDisplayer& Displayer, MythOSDDialogData* Menu,
101  bool Visible = true) const;
102  QString GetName() const;
103  const char* GetTranslationContext() const;
104  const QString& GetKeyBindingContext() const;
105  static QString GetPathFromNode(QDomNode Node);
106  QDomNode GetNodeFromPath(const QString& path) const;
107  friend class TV;
108 
109  private:
110  void ProcessIncludes(QDomElement& Root, int IncludeLevel);
111 
113  QDomDocument* m_document { nullptr };
114  const char* m_translationContext { "" };
115  QString m_menuName;
117 };
118 
120 
122 {
123  public:
124  MythTVMenuNodeTuple(MenuTypeId Id, QString Path);
125  MythTVMenuNodeTuple() = default;
126 
128  QString m_path;
129 };
130 
132 
133 #endif
kMenuShowInactive
@ kMenuShowInactive
Definition: mythtvmenu.h:21
MythTVMenuItemDisplayer
Definition: mythtvmenu.h:76
kMenuIdCutlistCompact
@ kMenuIdCutlistCompact
Definition: mythtvmenu.h:42
MythTVMenuNodeTuple
Definition: mythtvmenu.h:121
kMenuCategoryItemlist
@ kMenuCategoryItemlist
Definition: mythtvmenu.h:14
MythTVMenuItemContext
Definition: mythtvmenu.h:49
mythtvexp.h
kMenuCategoryItem
@ kMenuCategoryItem
Definition: mythtvmenu.h:13
MythTVMenuItemContext::m_visible
bool m_visible
Definition: mythtvmenu.h:73
MythTVMenuItemContext::m_currentContext
MenuCurrentContext m_currentContext
Definition: mythtvmenu.h:70
MythTVMenuItemContext::m_menuName
const QString m_menuName
Definition: mythtvmenu.h:68
Visible
Definition: channelsettings.cpp:416
Action
An action (for this plugin) consists of a description, and a set of key sequences.
Definition: action.h:40
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(StandardSetting *)
MythTVMenu::m_keyBindingContext
QString m_keyBindingContext
Definition: mythtvmenu.h:116
MythTVMenuItemContext::m_actionText
const QString m_actionText
Definition: mythtvmenu.h:72
MythOSDDialogData
Definition: osd.h:64
kMenuIdUnknown
@ kMenuIdUnknown
Definition: mythtvmenu.h:38
Root
static FRACTAL * Root
Definition: ifs.cpp:102
MenuShowContext
MenuShowContext
Definition: mythtvmenu.h:18
kMenuCategoryMenu
@ kMenuCategoryMenu
Definition: mythtvmenu.h:15
kMenuIdPlaybackCompact
@ kMenuIdPlaybackCompact
Definition: mythtvmenu.h:40
MenuTypeId
MenuTypeId
Definition: mythtvmenu.h:36
MenuCurrentContext
MenuCurrentContext
Definition: mythtvmenu.h:25
kMenuShowAlways
@ kMenuShowAlways
Definition: mythtvmenu.h:22
kMenuShowActive
@ kMenuShowActive
Definition: mythtvmenu.h:20
MythTVMenuItemDisplayer::~MythTVMenuItemDisplayer
virtual ~MythTVMenuItemDisplayer()=default
MTV_PUBLIC
#define MTV_PUBLIC
Definition: mythtvexp.h:15
MenuCategory
MenuCategory
Definition: mythtvmenu.h:11
MythTVMenuItemContext::AddButton
bool AddButton(MythOSDDialogData *Menu, bool Active, const QString &Action, const QString &DefaultTextActive, const QString &DefaultTextInactive, bool IsMenu, const QString &TextArg) const
Definition: mythtvmenu.cpp:14
MythTVMenuItemContext::m_menu
const MythTVMenu & m_menu
Definition: mythtvmenu.h:65
MythTVMenuItemDisplayer::MenuItemDisplay
virtual bool MenuItemDisplay(const MythTVMenuItemContext &Context, MythOSDDialogData *Menu)=0
kMenuIdCutlist
@ kMenuIdCutlist
Definition: mythtvmenu.h:41
Name
Definition: channelsettings.cpp:71
kMenuIdPlayback
@ kMenuIdPlayback
Definition: mythtvmenu.h:39
MythTVMenuNodeTuple::MythTVMenuNodeTuple
MythTVMenuNodeTuple()=default
MythTVMenu
Definition: mythtvmenu.h:83
kMenuCurrentDefault
@ kMenuCurrentDefault
Definition: mythtvmenu.h:27
MythTVMenuItemContext::m_category
MenuCategory m_category
Definition: mythtvmenu.h:67
MythTVMenuItemContext::MythTVMenuItemContext
MythTVMenuItemContext(const MythTVMenu &Menu, const QDomNode &Node, QString Name, MenuCurrentContext Current, bool Visible)
Definition: mythtvmenu.cpp:48
MythTVMenuNodeTuple::m_id
MenuTypeId m_id
Definition: mythtvmenu.h:127
kMenuCurrentAlways
@ kMenuCurrentAlways
Definition: mythtvmenu.h:29
MythTVMenuNodeTuple::m_path
QString m_path
Definition: mythtvmenu.h:128
MythTVMenu::m_menuName
QString m_menuName
Definition: mythtvmenu.h:115
dummy_menubase
static const MythTVMenu dummy_menubase
Definition: mythtvmenu.h:119
MythTVMenuItemContext::m_node
const QDomNode & m_node
Definition: mythtvmenu.h:66
OSD
Definition: osd.h:93
MythTVMenuItemContext::m_showContext
MenuShowContext m_showContext
Definition: mythtvmenu.h:69
kMenuCurrentActive
@ kMenuCurrentActive
Definition: mythtvmenu.h:28
MythTVMenuItemContext::m_action
const QString m_action
Definition: mythtvmenu.h:71
TV
Control TV playback.
Definition: tv_play.h:152