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