MythTV master
osd.h
Go to the documentation of this file.
1#ifndef OSD_H
2#define OSD_H
3
4// MythTV
10
11// Screen names are prepended with alphanumerics to force the correct ordering
12// when displayed. This is slightly complicated by the default windows
13// (e.g. osd_window) whose names are hard coded into existing themes.
14
15// menu dialogs should always be on top
16static constexpr const char* OSD_DLG_VIDEOEXIT { "xx_OSD_VIDEO_EXIT" };
17static constexpr const char* OSD_DLG_MENU { "xx_OSD_MENU" };
18static constexpr const char* OSD_DLG_SLEEP { "xx_OSD_SLEEP" };
19static constexpr const char* OSD_DLG_IDLE { "xx_OSD_IDLE" };
20static constexpr const char* OSD_DLG_INFO { "xx_OSD_INFO" };
21static constexpr const char* OSD_DLG_EDITING { "xx_OSD_EDITING" };
22static constexpr const char* OSD_DLG_ASKALLOW { "xx_OSD_ASKALLOW" };
23static constexpr const char* OSD_DLG_EDITOR { "xx_OSD_EDITOR" };
24static constexpr const char* OSD_DLG_CUTPOINT { "xx_OSD_CUTPOINT" };
25static constexpr const char* OSD_DLG_DELETE { "xx_OSD_DELETE" };
26static constexpr const char* OSD_DLG_NAVIGATE { "xx_OSD_NAVIGATE" };
27static constexpr const char* OSD_DLG_CONFIRM { "mythconfirmpopup" };
28
29static constexpr const char* OSD_WIN_MESSAGE { "osd_message" };
30static constexpr const char* OSD_WIN_INPUT { "osd_input" };
31static constexpr const char* OSD_WIN_PROGINFO { "program_info" };
32static constexpr const char* OSD_WIN_STATUS { "osd_status" };
33static constexpr const char* OSD_WIN_DEBUG { "osd_debug" };
34static constexpr const char* OSD_WIN_BROWSE { "browse_info" };
35static constexpr const char* OSD_WIN_PROGEDIT { "osd_program_editor" };
36
37static constexpr std::chrono::milliseconds kOSDFadeTime { 1s };
38
39class TV;
40class MythMainWindow;
41class MythPlayerUI;
42
43
44enum OSDFunctionalType : std::uint8_t
45{
53};
54
55enum OSDTimeout : std::int8_t
56{
57 kOSDTimeout_Ignore = -1, // Don't update existing timeout
58 kOSDTimeout_None = 0, // Don't timeout
62};
63
65{
66 public:
68 {
69 public:
70 QString m_text;
71 QVariant m_data;
72 bool m_menu { false };
73 bool m_current { false };
74 };
75
77 {
78 public:
79 QString m_text;
80 QVariant m_data { 0 };
81 bool m_exit { false };
82 };
83
84 QString m_dialogName;
85 QString m_message { }; //NOLINT(readability-redundant-member-init)
86 std::chrono::milliseconds m_timeout { 0ms };
87 std::vector<MythOSDDialogButton> m_buttons { }; //NOLINT(readability-redundant-member-init)
89};
90
92
93class OSD : public MythMediaOverlay
94{
95 Q_OBJECT
96
97 signals:
99
100 public slots:
101 void SetText(const QString& Window, const InfoMap& Map, OSDTimeout Timeout);
102 void DialogQuit();
103 void HideAll(bool KeepSubs = true, MythScreenType* Except = nullptr, bool DropNotification = false);
104 void Embed(bool Embedding);
105
106 protected slots:
107 void ShowDialog(const MythOSDDialogData& Data);
108 void IsOSDVisible(bool& Visible);
109
110 public:
111 OSD(MythMainWindow* MainWindow, TV* Tv, MythPlayerUI* Player, MythPainter* Painter);
112 ~OSD() override;
113
114 bool Init(QRect Rect, float FontAspect) override;
115 void HideWindow(const QString &Window) override;
116 void SetFunctionalWindow(const QString &Window, enum OSDFunctionalType Type);
117
118 void SetExpiry(const QString &Window, enum OSDTimeout Timeout, std::chrono::milliseconds CustomTimeout = 0ms);
119 void ResetWindow(const QString &Window);
120 void Draw();
121
122 void SetValues(const QString &Window, const QHash<QString,int> &Map, OSDTimeout Timeout);
123 void SetValues(const QString &Window, const QHash<QString,float> &Map, OSDTimeout Timeout);
124 void SetRegions(const QString &Window, frm_dir_map_t &Map, long long Total);
125 void SetGraph(const QString &Window, const QString &Graph, std::chrono::milliseconds Timecode);
126 bool IsWindowVisible(const QString &Window);
127
128 bool DialogVisible(const QString& Window = QString());
129 bool DialogHandleKeypress(QKeyEvent *Event);
130 bool DialogHandleGesture(MythGestureEvent *Event);
131 void DialogGetText(InfoMap &Map);
132
133 private:
134 void PositionWindow(MythScreenType* Window);
135 void RemoveWindow(const QString& Window);
136 void DialogShow(const QString& Window, const QString& Text = "", std::chrono::milliseconds UpdateFor = 0ms);
137 void DialogAddButton(const QString& Text, QVariant Data, bool Menu = false, bool Current = false);
138 void DialogBack(const QString& Text = "", const QVariant& Data = 0, bool Exit = false);
139 void TearDown() override;
140 void LoadWindows();
141 void CheckExpiry();
142 void SetExpiryPriv(const QString &Window, enum OSDTimeout Timeout, std::chrono::milliseconds CustomTimeout);
143
144 private:
145 bool m_embedded { false };
146 std::chrono::milliseconds m_fadeTime { kOSDFadeTime };
147 MythScreenType* m_dialog { nullptr };
150 std::array<std::chrono::milliseconds,4> m_timeouts { -1ms, 3s, 5s, 13s };
151 enum OSDFunctionalType m_functionalType { kOSDFunctionalType_Default };
153 QHash<MythScreenType*, QDateTime> m_expireTimes;
154};
155
156#endif
Event details.
Definition: zmdefines.h:28
A custom event that represents a mouse gesture.
Definition: mythgesture.h:40
QString m_dialogName
Definition: osd.h:84
MythOSDBackButton m_back
Definition: osd.h:88
std::vector< MythOSDDialogButton > m_buttons
Definition: osd.h:87
std::chrono::milliseconds m_timeout
Definition: osd.h:86
QString m_message
Definition: osd.h:85
Screen in which all other widgets are contained and rendered.
Definition: osd.h:94
QDateTime m_nextPulseUpdate
Definition: osd.h:149
QString m_functionalWindow
Definition: osd.h:152
void HideOSD(OSDFunctionalType Type)
QString m_pulsedDialogText
Definition: osd.h:148
QHash< MythScreenType *, QDateTime > m_expireTimes
Definition: osd.h:153
Control TV playback.
Definition: tv_play.h:155
Q_DECLARE_METATYPE(std::chrono::seconds)
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
static constexpr const char * OSD_WIN_BROWSE
Definition: osd.h:34
static constexpr const char * OSD_DLG_EDITOR
Definition: osd.h:23
static constexpr const char * OSD_DLG_INFO
Definition: osd.h:20
static constexpr const char * OSD_WIN_PROGINFO
Definition: osd.h:31
static constexpr const char * OSD_WIN_STATUS
Definition: osd.h:32
OSDFunctionalType
Definition: osd.h:45
@ kOSDFunctionalType_SubtitleZoomAdjust
Definition: osd.h:51
@ kOSDFunctionalType_AudioSyncAdjust
Definition: osd.h:50
@ kOSDFunctionalType_SubtitleDelayAdjust
Definition: osd.h:52
@ kOSDFunctionalType_SmartForward
Definition: osd.h:48
@ kOSDFunctionalType_Default
Definition: osd.h:46
@ kOSDFunctionalType_TimeStretchAdjust
Definition: osd.h:49
@ kOSDFunctionalType_PictureAdjust
Definition: osd.h:47
static constexpr const char * OSD_DLG_SLEEP
Definition: osd.h:18
static constexpr const char * OSD_DLG_CONFIRM
Definition: osd.h:27
static constexpr const char * OSD_DLG_VIDEOEXIT
Definition: osd.h:16
static constexpr const char * OSD_WIN_INPUT
Definition: osd.h:30
static constexpr const char * OSD_DLG_CUTPOINT
Definition: osd.h:24
static constexpr const char * OSD_DLG_EDITING
Definition: osd.h:21
static constexpr const char * OSD_WIN_PROGEDIT
Definition: osd.h:35
static constexpr const char * OSD_DLG_MENU
Definition: osd.h:17
static constexpr const char * OSD_DLG_IDLE
Definition: osd.h:19
OSDTimeout
Definition: osd.h:56
@ kOSDTimeout_Short
Definition: osd.h:59
@ kOSDTimeout_Long
Definition: osd.h:61
@ kOSDTimeout_Ignore
Definition: osd.h:57
@ kOSDTimeout_None
Definition: osd.h:58
@ kOSDTimeout_Med
Definition: osd.h:60
static constexpr const char * OSD_DLG_ASKALLOW
Definition: osd.h:22
static constexpr const char * OSD_DLG_NAVIGATE
Definition: osd.h:26
static constexpr const char * OSD_WIN_MESSAGE
Definition: osd.h:29
static constexpr const char * OSD_DLG_DELETE
Definition: osd.h:25
static constexpr std::chrono::milliseconds kOSDFadeTime
Definition: osd.h:37
static constexpr const char * OSD_WIN_DEBUG
Definition: osd.h:33
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
Definition: programtypes.h:117