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