MythTV master
osd.cpp
Go to the documentation of this file.
1// C++ headers
2#include <algorithm>
3#include <utility>
4
5// libmythbase
8
9// libmythui
21
22// libmythtv
25#include "channelutil.h"
26#include "osd.h"
27#include "tv_play.h"
28#include "mythplayerui.h"
29
30#define LOC QString("OSD: ")
31
33 : MythMediaOverlay(MainWindow, Tv, Player, Painter)
34{
35 connect(this, &OSD::HideOSD, m_tv, &TV::HandleOSDClosed);
36 connect(m_tv, &TV::IsOSDVisible, this, &OSD::IsOSDVisible);
37 connect(m_tv, &TV::ChangeOSDDialog, this, &OSD::ShowDialog);
38 connect(m_tv, &TV::ChangeOSDText, this, &OSD::SetText);
39}
40
42{
44}
45
47{
49 m_dialog = nullptr;
50}
51
52bool OSD::Init(QRect Rect, float FontAspect)
53{
54 int newstretch = static_cast<int>(lroundf(FontAspect * 100));
55 if ((Rect == m_rect) && (newstretch == m_fontStretch))
56 return true;
57
58 HideAll(false);
59 TearDown();
60 m_rect = Rect;
61 m_fontStretch = newstretch;
62
66
67 if (m_children.isEmpty())
68 {
69 LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to load any windows.");
70 return false;
71 }
72
73 LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Loaded OSD: size %1x%2 offset %3+%4")
74 .arg(m_rect.width()).arg(m_rect.height()).arg(m_rect.left()).arg(m_rect.top()));
75 HideAll(false);
76 return true;
77}
78
79void OSD::Embed(bool Embedding)
80{
81 m_embedded = Embedding;
82}
83
85{
87 {
88 Visible = true;
89 return;
90 }
91
92 Visible = std::ranges::any_of(std::as_const(m_children),
93 [](MythScreenType* child) { return child->IsVisible(); });
94}
95
96void OSD::HideAll(bool KeepSubs, MythScreenType* Except, bool DropNotification)
97{
98 if (DropNotification)
99 {
101 return; // we've removed the top window, don't process any further
102 }
103
104 for (auto it = m_children.cbegin(); it != m_children.cend(); ++it)
105 {
106 if (Except && Except->objectName() == OSD_DLG_NAVIGATE
107 && it.value()->objectName() == OSD_WIN_STATUS)
108 continue;
109 bool match1 = KeepSubs &&
110 (it.key() == OSD_WIN_SUBTITLE ||
111 it.key() == OSD_WIN_TELETEXT);
112 bool match2 = it.key() == OSD_WIN_BDOVERLAY ||
113 it.key() == OSD_WIN_INTERACT ||
114 it.value() == Except;
115 if (!(match1 || match2))
116 HideWindow(it.key());
117 }
118}
119
121{
122 static const std::array<const QString,7> s_defaultWindows {
125
126 for (const auto & window : s_defaultWindows)
127 {
128 auto * win = new MythOverlayWindow(nullptr, m_painter, window, true);
129 if (win->Create())
130 {
131 PositionWindow(win);
132 LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Loaded window %1").arg(window));
133 m_children.insert(window, win);
134
135 // Update player for window visibility
136 if (window == OSD_WIN_BROWSE)
138 if (window == OSD_WIN_PROGEDIT)
140 if (window == OSD_WIN_DEBUG)
142 }
143 else
144 {
145 delete win;
146 }
147 }
148}
149
150void OSD::SetValues(const QString &Window, const QHash<QString,int> &Map, OSDTimeout Timeout)
151{
152 MythScreenType *win = GetWindow(Window);
153 if (!win)
154 return;
155
156 bool found = false;
157 if (Map.contains("position"))
158 {
159 MythUIProgressBar *bar = dynamic_cast<MythUIProgressBar *> (win->GetChild("position"));
160 if (bar)
161 {
162 bar->SetVisible(true);
163 bar->SetStart(0);
164 bar->SetTotal(1000);
165 bar->SetUsed(Map.value("position"));
166 found = true;
167 }
168 }
169 if (Map.contains("relposition"))
170 {
171 MythUIProgressBar *bar = dynamic_cast<MythUIProgressBar *> (win->GetChild("relposition"));
172 if (bar)
173 {
174 bar->SetVisible(true);
175 bar->SetStart(0);
176 bar->SetTotal(1000);
177 bar->SetUsed(Map.value("relposition"));
178 found = true;
179 }
180 }
181
182 if (found)
183 SetExpiry(Window, Timeout);
184}
185
186void OSD::SetValues(const QString &Window, const QHash<QString,float> &Map,
187 OSDTimeout Timeout)
188{
189 MythScreenType *win = GetWindow(Window);
190 if (!win)
191 return;
192
193 bool found = false;
194 if (Map.contains("position"))
195 {
196 MythUIEditBar *edit = dynamic_cast<MythUIEditBar *> (win->GetChild("editbar"));
197 if (edit)
198 {
199 edit->SetEditPosition(static_cast<double>(Map.value("position")));
200 found = true;
201 }
202 }
203
204 if (found)
205 SetExpiry(Window, Timeout);
206}
207
208void OSD::SetText(const QString &Window, const InfoMap &Map, OSDTimeout Timeout)
209{
210 MythScreenType *win = GetWindow(Window);
211 if (!win)
212 return;
213
214 if (Map.contains("numstars"))
215 {
216 MythUIStateType *state = dynamic_cast<MythUIStateType *> (win->GetChild("ratingstate"));
217 if (state)
218 state->DisplayState(Map["numstars"]);
219 }
220 if (Map.contains("tvstate"))
221 {
222 MythUIStateType *state = dynamic_cast<MythUIStateType *> (win->GetChild("tvstate"));
223 if (state)
224 state->DisplayState(Map["tvstate"]);
225 }
226 if (Map.contains("videocodec"))
227 {
228 MythUIStateType *state = dynamic_cast<MythUIStateType *> (win->GetChild("videocodec"));
229 if (state)
230 state->DisplayState(Map["videocodec"]);
231 }
232 if (Map.contains("videodescrip"))
233 {
234 MythUIStateType *state = dynamic_cast<MythUIStateType *> (win->GetChild("videodescrip"));
235 if (state)
236 state->DisplayState(Map["videodescrip"]);
237 }
238 if (Map.contains("audiocodec"))
239 {
240 MythUIStateType *state = dynamic_cast<MythUIStateType *> (win->GetChild("audiocodec"));
241 if (state)
242 state->DisplayState(Map["audiocodec"]);
243 }
244 if (Map.contains("audiochannels"))
245 {
246 MythUIStateType *state = dynamic_cast<MythUIStateType *> (win->GetChild("audiochannels"));
247 if (state)
248 state->DisplayState(Map["audiochannels"]);
249 }
250 if (Map.contains("chanid"))
251 {
252 MythUIImage *icon = dynamic_cast<MythUIImage *> (win->GetChild("iconpath"));
253 if (icon)
254 {
255 icon->Reset();
256
257 uint chanid = Map["chanid"].toUInt();
258 QString iconpath;
259 if (Map.contains("iconpath"))
260 iconpath = Map["iconpath"];
261 else
262 iconpath = ChannelUtil::GetIcon(chanid);
263
264 if (!iconpath.isEmpty())
265 {
266 QString iconurl =
267 gCoreContext->GetMasterHostPrefix("ChannelIcons",
268 iconpath);
269
270 icon->SetFilename(iconurl);
271 icon->Load(false);
272 }
273 }
274 }
275
276 if (Map.contains("channelgroup"))
277 {
278 MythUIText *textArea = dynamic_cast<MythUIText *> (win->GetChild("channelgroup"));
279 if (textArea)
280 {
281 textArea->SetText(Map["channelgroup"]);
282 }
283 }
284
285 if (Map.contains("inetref"))
286 {
287 MythUIImage *cover = dynamic_cast<MythUIImage *> (win->GetChild("coverart"));
288 if (cover && Map.contains("coverartpath"))
289 {
290 QString coverpath = Map["coverartpath"];
291 cover->SetFilename(coverpath);
292 cover->Load(false);
293 }
294 MythUIImage *fanart = dynamic_cast<MythUIImage *> (win->GetChild("fanart"));
295 if (fanart && Map.contains("fanartpath"))
296 {
297 QString fanartpath = Map["fanartpath"];
298 fanart->SetFilename(fanartpath);
299 fanart->Load(false);
300 }
301 MythUIImage *banner = dynamic_cast<MythUIImage *> (win->GetChild("banner"));
302 if (banner && Map.contains("bannerpath"))
303 {
304 QString bannerpath = Map["bannerpath"];
305 banner->SetFilename(bannerpath);
306 banner->Load(false);
307 }
308 MythUIImage *screenshot = dynamic_cast<MythUIImage *> (win->GetChild("screenshot"));
309 if (screenshot && Map.contains("screenshotpath"))
310 {
311 QString screenshotpath = Map["screenshotpath"];
312 screenshot->SetFilename(screenshotpath);
313 screenshot->Load(false);
314 }
315 }
316 if (Map.contains("nightmode"))
317 {
318 MythUIStateType *state = dynamic_cast<MythUIStateType *> (win->GetChild("nightmode"));
319 if (state)
320 state->DisplayState(Map["nightmode"]);
321 }
322 if (Map.contains("mediatype"))
323 {
324 MythUIStateType *state = dynamic_cast<MythUIStateType *> (win->GetChild("mediatype"));
325 if (state)
326 state->DisplayState(Map["mediatype"]);
327 }
328
329 MythUIProgressBar *bar =
330 dynamic_cast<MythUIProgressBar *>(win->GetChild("elapsedpercent"));
331 if (bar)
332 {
333 qint64 startts = Map["startts"].toLongLong();
334 qint64 endts = Map["endts"].toLongLong();
335 qint64 nowts = MythDate::current().toSecsSinceEpoch();
336 if (startts > nowts)
337 {
338 bar->SetUsed(0);
339 }
340 else if (endts < nowts)
341 {
342 bar->SetUsed(1000);
343 }
344 else
345 {
346 qint64 duration = endts - startts;
347 if (duration > 0)
348 bar->SetUsed(static_cast<int>(1000 * (nowts - startts) / duration));
349 else
350 bar->SetUsed(0);
351 }
352 bar->SetVisible(startts > 0);
353 bar->SetStart(0);
354 bar->SetTotal(1000);
355 }
356
357 win->SetVisible(true);
358
359 if (win == m_dialog)
360 {
361 auto *edit = qobject_cast<MythChannelOverlay*>(m_dialog);
362 if (edit)
363 edit->SetText(Map);
364 else
365 win->SetTextFromMap(Map);
366 }
367 else
368 {
369 win->SetTextFromMap(Map);
370 }
371
372 SetExpiry(Window, Timeout);
373}
374
375void OSD::SetRegions(const QString &Window, frm_dir_map_t &Map, long long Total)
376{
377 MythScreenType *win = GetWindow(Window);
378 if (!win)
379 return;
380
381 MythUIEditBar *bar = dynamic_cast<MythUIEditBar*>(win->GetChild("editbar"));
382 if (!bar)
383 return;
384
385 bar->ClearRegions();
386 if (Map.empty() || Total < 1)
387 {
388 bar->Display();
389 return;
390 }
391
392 long long start = -1;
393 long long end = -1;
394 bool first = true;
395 for (auto it = Map.begin(); it != Map.end(); ++it)
396 {
397 bool error = false;
398 if (it.value() == MARK_CUT_START)
399 {
400 start = static_cast<long long>(it.key());
401 if (end > -1)
402 error = true;
403 }
404 else if (it.value() == MARK_CUT_END)
405 {
406 if (first)
407 start = 0;
408 if (start < 0)
409 error = true;
410 end = static_cast<long long>(it.key());
411 }
412 else if (it.value() == MARK_PLACEHOLDER)
413 {
414 start = end = static_cast<long long>(it.key());
415 }
416 first = false;
417
418 if (error)
419 {
420 LOG(VB_GENERAL, LOG_ERR, LOC + "deleteMap discontinuity");
421 start = -1;
422 end = -1;
423 }
424
425 if (start >=0 && end >= 0)
426 {
427 bar->AddRegion((static_cast<double>(start) / static_cast<double>(Total)),
428 (static_cast<double>(end) / static_cast<double>(Total)));
429 start = -1;
430 end = -1;
431 }
432 }
433 if (start > -1 && end < 0)
434 bar->AddRegion(static_cast<double>(start) / static_cast<double>(Total), 1.0);
435
436 bar->Display();
437}
438
439void OSD::SetGraph(const QString &Window, const QString &Graph, std::chrono::milliseconds Timecode)
440{
441 MythScreenType *win = GetWindow(Window);
442 if (!win)
443 return;
444
445 auto *image = dynamic_cast<MythUIImage* >(win->GetChild(Graph));
446 if (!image)
447 return;
448
449 MythImage* mi = m_player->GetAudioGraph().GetImage(Timecode);
450 if (mi)
451 image->SetImage(mi);
452}
453
455{
456 if (m_embedded)
457 return;
458
459 bool visible = false;
460 QTime now = MythDate::current().time();
461
462 CheckExpiry();
463 for (auto * screen : std::as_const(m_children))
464 {
465 if (screen->IsVisible())
466 {
467 visible = true;
468 screen->Pulse();
469 if (m_expireTimes.contains(screen))
470 {
471 QTime expires = m_expireTimes.value(screen).time();
472 auto left = std::chrono::milliseconds(now.msecsTo(expires));
473 if (left < m_fadeTime)
474 screen->SetAlpha((255 * left) / m_fadeTime);
475 }
476 }
477 }
478
479 QList<MythScreenType*> notifications;
481 QList<MythScreenType*>::iterator it2 = notifications.begin();
482 while (it2 != notifications.end())
483 {
485 {
486 LOG(VB_GUI, LOG_DEBUG, LOC + "Creating OSD Notification");
487
489 OverrideUIScale(false);
490 (*it2)->SetPainter(m_painter);
491 if (!(*it2)->Create())
492 {
493 it2 = notifications.erase(it2);
494 continue;
495 }
496 }
497
498 if ((*it2)->IsVisible())
499 {
501 OverrideUIScale(false);
502
503 (*it2)->SetPainter(m_painter);
504
506
507 visible = true;
508 (*it2)->Pulse();
509 QTime expires = MythNotificationCenter::ScreenExpiryTime(*it2).time();
510 auto left = std::chrono::milliseconds(now.msecsTo(expires));
511 if (left < 0ms)
512 left = 0ms;
513 if (expires.isValid() && left < m_fadeTime)
514 (*it2)->SetAlpha((255 * left) / m_fadeTime);
515 }
516 ++it2;
517 }
519
520 if (visible)
521 {
522 m_painter->Begin(nullptr);
523 for (auto * screen : std::as_const(m_children))
524 {
525 if (screen->IsVisible())
526 {
527 screen->Draw(m_painter, 0, 0, 255, m_rect);
528 screen->SetAlpha(255);
529 screen->ResetNeedsRedraw();
530 }
531 }
532 for (auto * notif : std::as_const(notifications))
533 {
534 if (notif->IsVisible())
535 {
536 notif->Draw(m_painter, 0, 0, 255, m_rect);
537 notif->SetAlpha(255);
538 notif->ResetNeedsRedraw();
539 }
540 }
541 m_painter->End();
542 }
543}
544
546{
547 QDateTime now = MythDate::current();
548 bool quitDialog = false;
549 QStringList hideWindows {};
550
551 for (auto it = m_expireTimes.begin(); it != m_expireTimes.end(); ++it)
552 {
553 // Both DialogQuit and HideWindow alter m_expireTimes. Do
554 // them after running the list is finished.
555 if (it.value() < now)
556 {
557 if (it.key() == m_dialog)
558 {
559 quitDialog = true;
560 continue;
561 }
562 hideWindows << m_children.key(it.key());
563 continue;
564 }
565 if (it.key() == m_dialog)
566 {
567 DoPulse(now, it.value());
568 }
569 }
570 if (quitDialog)
571 DialogQuit();
572 for (const auto& window : std::as_const(hideWindows))
573 HideWindow(window);
574}
575
576void OSD::SetExpiry(const QString &Window, enum OSDTimeout Timeout,
577 std::chrono::milliseconds CustomTimeout)
578{
579 SetExpiryPriv(Window, Timeout, CustomTimeout);
580 if (IsWindowVisible(Window))
581 {
582 // Keep status and nav timeouts in sync
583 if (Window == OSD_DLG_NAVIGATE)
584 SetExpiryPriv(OSD_WIN_STATUS, Timeout, CustomTimeout);
585 else if (Window == OSD_WIN_STATUS && IsWindowVisible(OSD_DLG_NAVIGATE))
586 SetExpiryPriv(OSD_DLG_NAVIGATE, Timeout, CustomTimeout);
587 }
588}
589
590void OSD::SetExpiryPriv(const QString &Window, enum OSDTimeout Timeout,
591 std::chrono::milliseconds CustomTimeout)
592{
593 std::chrono::milliseconds time { 0ms };
594 if (CustomTimeout != 0ms)
595 time = CustomTimeout;
596 else if ((Timeout > kOSDTimeout_Ignore) && (Timeout <= kOSDTimeout_Long))
597 time = m_timeouts[static_cast<size_t>(Timeout)];
598 else
599 return;
600
601 MythScreenType *win = GetWindow(Window);
602 if ((time > 0ms) && win)
603 {
604 QDateTime expires = MythDate::current().addMSecs(time.count());
605 m_expireTimes.insert(win, expires);
606 }
607 else if ((time < 0ms) && win)
608 {
609 if (m_expireTimes.contains(win))
610 m_expireTimes.remove(win);
611 }
612}
613
614void OSD::DoPulse(const QDateTime& now, const QDateTime& expire)
615{
616 if (m_pulsedDialogText.isEmpty() || (now <= m_nextPulseUpdate))
617 return;
618 m_nextPulseUpdate = now.addSecs(1);
619
620 uint64_t seconds = now.secsTo(expire);
621 QString newtext = m_pulsedDialogText;
622 auto *dialog = qobject_cast<MythDialogBox*>(m_dialog);
623 if (dialog)
624 {
625 // The disambiguation string must be an empty string
626 // and not a NULL to get extracted by the Qt tools.
627 QString replace = QCoreApplication::translate("(Common)",
628 "%n second(s)", "",
629 static_cast<int>(seconds));
630 dialog->SetText(newtext.replace("%d", replace));
631 return;
632 }
633
634 auto *cdialog = qobject_cast<MythConfirmationDialog*>(m_dialog);
635 if (cdialog)
636 {
637 QString replace = QString::number(seconds);
638 cdialog->SetMessage(newtext.replace("%d", replace));
639 return;
640 }
641}
642
643bool OSD::IsWindowVisible(const QString &Window)
644{
645 if (!m_children.contains(Window))
646 return false;
647
648 return m_children.value(Window)->IsVisible(/*true*/);
649}
650
651void OSD::ResetWindow(const QString &Window)
652{
653 if (!m_children.contains(Window))
654 return;
655
656 MythScreenType *screen = m_children.value(Window);
657 if (screen != nullptr)
658 screen->Reset();
659}
660
662{
663 if (!Window)
664 return;
665
666 MythRect rect = Window->GetArea();
667 rect.translate(m_rect.left(), m_rect.top());
668 Window->SetArea(rect);
669}
670
671void OSD::RemoveWindow(const QString &Window)
672{
673 if (!m_children.contains(Window))
674 return;
675
676 HideWindow(Window);
677 MythScreenType *child = m_children.value(Window);
678 m_children.remove(Window);
679 delete child;
680}
681
682void OSD::SetFunctionalWindow(const QString &window, enum OSDFunctionalType Type)
683{
684 if (m_functionalType != kOSDFunctionalType_Default && m_functionalType != Type)
685 emit HideOSD(m_functionalType);
686 m_functionalWindow = window;
687 m_functionalType = Type;
688}
689
690void OSD::HideWindow(const QString &Window)
691{
692 if (!m_children.contains(Window))
693 return;
694
696
698
699 MythScreenType* screen = m_children.value(Window);
700 if ((m_functionalType != kOSDFunctionalType_Default) && screen)
701 {
702 bool valid = m_children.contains(m_functionalWindow);
703 screen = m_children.value(m_functionalWindow);
704 bool visible = valid && screen && screen->IsVisible(false);
705 if (!valid || !visible)
706 {
707 emit HideOSD(m_functionalType);
708 m_functionalType = kOSDFunctionalType_Default;
709 m_functionalWindow = QString();
710 }
711 }
712}
713
714bool OSD::DialogVisible(const QString& Window)
715{
716 if (!m_dialog || Window.isEmpty())
717 return m_dialog;
718 return m_dialog->objectName() == Window;
719}
720
722{
723 if (!m_dialog)
724 return false;
726}
727
729{
730 if (!m_dialog)
731 return false;
732 return m_dialog->gestureEvent(Event);
733}
734
736{
737 if (!m_dialog)
738 return;
739
740 RemoveWindow(m_dialog->objectName());
741 m_dialog = nullptr;
742 m_pulsedDialogText = QString();
743}
744
753{
754 DialogShow(Data.m_dialogName, Data.m_message, Data.m_timeout);
755 std::ranges::for_each(Data.m_buttons,
757 DialogAddButton(B.m_text, B.m_data, B.m_menu, B.m_current); });
759}
760
761void OSD::DialogShow(const QString &Window, const QString &Text, std::chrono::milliseconds UpdateFor)
762{
763 if (m_dialog)
764 {
765 QString current = m_dialog->objectName();
766 if (current != Window)
767 {
768 DialogQuit();
769 }
770 else
771 {
772 auto *dialog = qobject_cast<MythDialogBox*>(m_dialog);
773 if (dialog)
774 {
775 dialog->Reset();
776 dialog->SetText(Text);
777 }
778 }
779 }
780
781 if (!m_dialog)
782 {
784 MythScreenType *dialog = nullptr;
785
786 if (Window == OSD_DLG_EDITOR)
787 dialog = new MythChannelOverlay(m_mainWindow, m_tv, Window.toLatin1());
788 else if (Window == OSD_DLG_CONFIRM)
789 dialog = new MythConfirmationDialog(nullptr, Text, false);
790 else if (Window == OSD_DLG_NAVIGATE)
791 dialog = new MythNavigationOverlay(m_mainWindow, m_tv, m_player, Window, this);
792 else
793 dialog = new MythDialogBox(Text, nullptr, Window.toLatin1().constData(), false, true);
794
795 dialog->SetPainter(m_painter);
796 if (dialog->Create())
797 {
798 PositionWindow(dialog);
799 m_dialog = dialog;
800 auto *dbox = qobject_cast<MythDialogBox*>(m_dialog);
801 if (dbox)
802 dbox->SetReturnEvent(m_tv, Window);
803 auto *cbox = qobject_cast<MythConfirmationDialog*>(m_dialog);
804 if (cbox)
805 {
806 cbox->SetReturnEvent(m_tv, Window);
807 cbox->SetData("DIALOG_CONFIRM_X_X");
808 }
809 m_children.insert(Window, m_dialog);
810 }
811 else
812 {
814 delete dialog;
815 return;
816 }
817
819 }
820
821 if (UpdateFor > 0ms)
822 {
824 m_pulsedDialogText = Text;
825 SetExpiry(Window, kOSDTimeout_None, UpdateFor);
826 }
827
828 DialogBack();
829 HideAll(true, m_dialog);
830 m_dialog->SetVisible(true);
831}
832
833void OSD::DialogBack(const QString& Text, const QVariant& Data, bool Exit)
834{
835 auto *dialog = qobject_cast<MythDialogBox*>(m_dialog);
836 if (dialog)
837 {
838 dialog->SetBackAction(Text, Data);
839 if (Exit)
840 dialog->SetExitAction(Text, Data);
841 }
842}
843
844void OSD::DialogAddButton(const QString& Text, QVariant Data, bool Menu, bool Current)
845{
846 auto *dialog = qobject_cast<MythDialogBox*>(m_dialog);
847 if (dialog)
848 dialog->AddButtonV(Text, std::move(Data), Menu, Current);
849}
850
852{
853 auto *edit = qobject_cast<MythChannelOverlay*>(m_dialog);
854 if (edit)
855 edit->GetText(Map);
856}
MythImage * GetImage(std::chrono::milliseconds Timecode) const
static QString GetIcon(uint chanid)
Event details.
Definition: zmdefines.h:28
Dialog asking for user confirmation.
QString GetMasterHostPrefix(const QString &storageGroup=QString(), const QString &path=QString())
Basic menu dialog, message and a list of options.
A custom event that represents a mouse gesture.
Definition: mythgesture.h:40
MythNotificationCenter * GetCurrentNotificationCenter()
MythPlayerUI * m_player
virtual void TearDown()
MythPainter * m_painter
QMap< QString, MythScreenType * > m_children
virtual MythScreenType * GetWindow(const QString &Window)
MythMainWindow * m_mainWindow
void OverrideUIScale(bool Log=true)
virtual void HideWindow(const QString &Window)
static void UpdateScreen(MythScreenType *screen)
Will call ::doInit() if the screen is a MythNotificationScreen and ::Create() has been called for it ...
static QDateTime ScreenExpiryTime(const MythScreenType *screen)
Return when the given screen is going to expire will return an invalid QDateTime if screen isn't a My...
static bool ScreenCreated(const MythScreenType *screen)
Return true if ::Create() has been called on screen.
void GetNotificationScreens(QList< MythScreenType * > &screens)
Return the list of notification screens being currently displayed.
int DisplayedNotifications(void) const
Returns number of notifications currently displayed.
bool RemoveFirst(void)
Will remove the oldest notification from the stack return true if a screen was removed; or false if n...
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
virtual void Begin(QPaintDevice *)
Definition: mythpainter.h:51
virtual void End()
Definition: mythpainter.h:52
const AudioOutputGraph & GetAudioGraph() const
void EditingChanged(bool Editing)
void BrowsingChanged(bool Browsing)
void OSDDebugVisibilityChanged(bool Visible)
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
Definition: mythrect.h:18
Screen in which all other widgets are contained and rendered.
bool gestureEvent(MythGestureEvent *event) override
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
virtual bool Create(void)
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
virtual void SetTextFromMap(const InfoMap &infoMap)
A narrow purpose widget used to represent cut positions and regions when editing a video.
Definition: mythuieditbar.h:17
void ClearRegions(void)
void SetEditPosition(double position)
void AddRegion(double start, double end)
void Display(void)
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:98
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
void SetFilename(const QString &filename)
Must be followed by a call to Load() to load the image.
void Reset(void) override
Reset the image back to the default defined in the theme.
Progress bar widget.
void SetUsed(int value)
void SetStart(int value)
void SetTotal(int value)
void SetVisible(bool visible) override
This widget is used for grouping other widgets for display when a particular named state is called.
bool DisplayState(const QString &name)
All purpose text widget, displays a text string.
Definition: mythuitext.h:29
virtual void SetText(const QString &text)
Definition: mythuitext.cpp:115
bool IsVisible(bool recurse=false) const
Definition: mythuitype.cpp:889
void VisibilityChanged(bool Visible)
virtual void SetVisible(bool visible)
virtual void SetArea(const MythRect &rect)
Definition: mythuitype.cpp:596
void SetPainter(MythPainter *painter)
Definition: mythuitype.h:205
virtual MythRect GetArea(void) const
If the object has a minimum area defined, return it, other wise return the default area.
Definition: mythuitype.cpp:871
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
Definition: mythuitype.cpp:130
virtual void Reset(void)
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuitype.cpp:71
void SetExpiryPriv(const QString &Window, enum OSDTimeout Timeout, std::chrono::milliseconds CustomTimeout)
Definition: osd.cpp:590
void SetValues(const QString &Window, const QHash< QString, int > &Map, OSDTimeout Timeout)
Definition: osd.cpp:150
QDateTime m_nextPulseUpdate
Definition: osd.h:150
QString m_functionalWindow
Definition: osd.h:153
bool DialogVisible(const QString &Window=QString())
Definition: osd.cpp:714
~OSD() override
Definition: osd.cpp:41
void ResetWindow(const QString &Window)
Definition: osd.cpp:651
void CheckExpiry()
Definition: osd.cpp:545
void DialogAddButton(const QString &Text, QVariant Data, bool Menu=false, bool Current=false)
Definition: osd.cpp:844
std::chrono::milliseconds m_fadeTime
Definition: osd.h:147
bool Init(QRect Rect, float FontAspect) override
Definition: osd.cpp:52
bool DialogHandleGesture(MythGestureEvent *Event)
Definition: osd.cpp:728
void TearDown() override
Definition: osd.cpp:46
void HideOSD(OSDFunctionalType Type)
void DialogGetText(InfoMap &Map)
Definition: osd.cpp:851
void LoadWindows()
Definition: osd.cpp:120
void RemoveWindow(const QString &Window)
Definition: osd.cpp:671
bool DialogHandleKeypress(QKeyEvent *Event)
Definition: osd.cpp:721
void Draw()
Definition: osd.cpp:454
void IsOSDVisible(bool &Visible)
Definition: osd.cpp:84
void SetExpiry(const QString &Window, enum OSDTimeout Timeout, std::chrono::milliseconds CustomTimeout=0ms)
Definition: osd.cpp:576
void SetRegions(const QString &Window, frm_dir_map_t &Map, long long Total)
Definition: osd.cpp:375
QString m_pulsedDialogText
Definition: osd.h:149
void ShowDialog(const MythOSDDialogData &Data)
Show a dialog menu, removing any existing dialog.
Definition: osd.cpp:752
void SetFunctionalWindow(const QString &Window, enum OSDFunctionalType Type)
Definition: osd.cpp:682
void PositionWindow(MythScreenType *Window)
Definition: osd.cpp:661
bool IsWindowVisible(const QString &Window)
Definition: osd.cpp:643
OSD(MythMainWindow *MainWindow, TV *Tv, MythPlayerUI *Player, MythPainter *Painter)
Definition: osd.cpp:32
bool m_embedded
Definition: osd.h:146
void DialogShow(const QString &Window, const QString &Text="", std::chrono::milliseconds UpdateFor=0ms)
Definition: osd.cpp:761
MythScreenType * m_dialog
Definition: osd.h:148
void Embed(bool Embedding)
Definition: osd.cpp:79
void DialogBack(const QString &Text="", const QVariant &Data=0, bool Exit=false)
Definition: osd.cpp:833
void HideWindow(const QString &Window) override
Definition: osd.cpp:690
std::array< std::chrono::milliseconds, 4 > m_timeouts
Definition: osd.h:151
void SetText(const QString &Window, const InfoMap &Map, OSDTimeout Timeout)
Definition: osd.cpp:208
void DoPulse(const QDateTime &now, const QDateTime &expire)
Definition: osd.cpp:614
void HideAll(bool KeepSubs=true, MythScreenType *Except=nullptr, bool DropNotification=false)
Definition: osd.cpp:96
void SetGraph(const QString &Window, const QString &Graph, std::chrono::milliseconds Timecode)
Definition: osd.cpp:439
QHash< MythScreenType *, QDateTime > m_expireTimes
Definition: osd.h:154
void DialogQuit()
Definition: osd.cpp:735
void ChangeOSDDialog(const MythOSDDialogData &Data)
void IsOSDVisible(bool &Visible)
void ChangeOSDText(const QString &Window, const InfoMap &Map, OSDTimeout Timeout)
Control TV playback.
Definition: tv_play.h:156
void HandleOSDClosed(int OSDType)
Definition: tv_play.cpp:7774
unsigned int uint
Definition: compat.h:60
static constexpr const char * OSD_WIN_SUBTITLE
static constexpr const char * OSD_WIN_TELETEXT
static constexpr const char * OSD_WIN_INTERACT
static constexpr const char * OSD_WIN_BDOVERLAY
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:15
def error(message)
Definition: smolt.py:409
#define LOC
Definition: osd.cpp:30
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_WIN_PROGINFO
Definition: osd.h:31
static constexpr const char * OSD_WIN_STATUS
Definition: osd.h:32
OSDFunctionalType
Definition: osd.h:45
@ kOSDFunctionalType_Default
Definition: osd.h:46
static constexpr const char * OSD_DLG_CONFIRM
Definition: osd.h:27
static constexpr const char * OSD_WIN_INPUT
Definition: osd.h:30
static constexpr const char * OSD_WIN_PROGEDIT
Definition: osd.h:35
OSDTimeout
Definition: osd.h:56
@ kOSDTimeout_Long
Definition: osd.h:61
@ kOSDTimeout_Ignore
Definition: osd.h:57
@ kOSDTimeout_None
Definition: osd.h:58
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_WIN_DEBUG
Definition: osd.h:33
@ MARK_CUT_START
Definition: programtypes.h:55
@ MARK_CUT_END
Definition: programtypes.h:54
@ MARK_PLACEHOLDER
Definition: programtypes.h:53
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
Definition: programtypes.h:117