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