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