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  {
370  win->SetTextFromMap(Map);
371  }
372 
373  SetExpiry(Window, Timeout);
374 }
375 
376 void OSD::SetRegions(const QString &Window, frm_dir_map_t &Map, long long Total)
377 {
378  MythScreenType *win = GetWindow(Window);
379  if (!win)
380  return;
381 
382  MythUIEditBar *bar = dynamic_cast<MythUIEditBar*>(win->GetChild("editbar"));
383  if (!bar)
384  return;
385 
386  bar->ClearRegions();
387  if (Map.empty() || Total < 1)
388  {
389  bar->Display();
390  return;
391  }
392 
393  long long start = -1;
394  long long end = -1;
395  bool first = true;
396  QMapIterator<uint64_t, MarkTypes> it(Map);
397  while (it.hasNext())
398  {
399  bool error = false;
400  it.next();
401  if (it.value() == MARK_CUT_START)
402  {
403  start = static_cast<long long>(it.key());
404  if (end > -1)
405  error = true;
406  }
407  else if (it.value() == MARK_CUT_END)
408  {
409  if (first)
410  start = 0;
411  if (start < 0)
412  error = true;
413  end = static_cast<long long>(it.key());
414  }
415  else if (it.value() == MARK_PLACEHOLDER)
416  {
417  start = end = static_cast<long long>(it.key());
418  }
419  first = false;
420 
421  if (error)
422  {
423  LOG(VB_GENERAL, LOG_ERR, LOC + "deleteMap discontinuity");
424  start = -1;
425  end = -1;
426  }
427 
428  if (start >=0 && end >= 0)
429  {
430  bar->AddRegion((static_cast<double>(start) / static_cast<double>(Total)),
431  (static_cast<double>(end) / static_cast<double>(Total)));
432  start = -1;
433  end = -1;
434  }
435  }
436  if (start > -1 && end < 0)
437  bar->AddRegion(static_cast<double>(start) / static_cast<double>(Total), 1.0);
438 
439  bar->Display();
440 }
441 
442 void OSD::SetGraph(const QString &Window, const QString &Graph, std::chrono::milliseconds Timecode)
443 {
444  MythScreenType *win = GetWindow(Window);
445  if (!win)
446  return;
447 
448  auto *image = dynamic_cast<MythUIImage* >(win->GetChild(Graph));
449  if (!image)
450  return;
451 
452  MythImage* mi = m_player->GetAudioGraph().GetImage(Timecode);
453  if (mi)
454  image->SetImage(mi);
455 }
456 
457 void OSD::Draw()
458 {
459  if (m_embedded)
460  return;
461 
462  bool visible = false;
463  QTime now = MythDate::current().time();
464 
465  CheckExpiry();
466  for (auto * screen : std::as_const(m_children))
467  {
468  if (screen->IsVisible())
469  {
470  visible = true;
471  screen->Pulse();
472  if (m_expireTimes.contains(screen))
473  {
474  QTime expires = m_expireTimes.value(screen).time();
475  auto left = std::chrono::milliseconds(now.msecsTo(expires));
476  if (left < m_fadeTime)
477  screen->SetAlpha((255 * left) / m_fadeTime);
478  }
479  }
480  }
481 
482  QList<MythScreenType*> notifications;
484  QList<MythScreenType*>::iterator it2 = notifications.begin();
485  while (it2 != notifications.end())
486  {
488  {
489  LOG(VB_GUI, LOG_DEBUG, LOC + "Creating OSD Notification");
490 
491  if (!m_uiScaleOverride)
492  OverrideUIScale(false);
493  (*it2)->SetPainter(m_painter);
494  if (!(*it2)->Create())
495  {
496  it2 = notifications.erase(it2);
497  continue;
498  }
499  }
500 
501  if ((*it2)->IsVisible())
502  {
503  if (!m_uiScaleOverride)
504  OverrideUIScale(false);
505 
506  (*it2)->SetPainter(m_painter);
507 
509 
510  visible = true;
511  (*it2)->Pulse();
512  QTime expires = MythNotificationCenter::ScreenExpiryTime(*it2).time();
513  auto left = std::chrono::milliseconds(now.msecsTo(expires));
514  if (left < 0ms)
515  left = 0ms;
516  if (expires.isValid() && left < m_fadeTime)
517  (*it2)->SetAlpha((255 * left) / m_fadeTime);
518  }
519  ++it2;
520  }
521  RevertUIScale();
522 
523  if (visible)
524  {
525  m_painter->Begin(nullptr);
526  for (auto * screen : std::as_const(m_children))
527  {
528  if (screen->IsVisible())
529  {
530  screen->Draw(m_painter, 0, 0, 255, m_rect);
531  screen->SetAlpha(255);
532  screen->ResetNeedsRedraw();
533  }
534  }
535  for (auto * notif : std::as_const(notifications))
536  {
537  if (notif->IsVisible())
538  {
539  notif->Draw(m_painter, 0, 0, 255, m_rect);
540  notif->SetAlpha(255);
541  notif->ResetNeedsRedraw();
542  }
543  }
544  m_painter->End();
545  }
546 }
547 
549 {
550  QDateTime now = MythDate::current();
551  QMutableHashIterator<MythScreenType*, QDateTime> it(m_expireTimes);
552  while (it.hasNext())
553  {
554  it.next();
555  if (it.value() < now)
556  {
557  if (it.key() == m_dialog)
558  DialogQuit();
559  else
560  HideWindow(m_children.key(it.key()));
561  }
562  else if (it.key() == m_dialog)
563  {
564  if (!m_pulsedDialogText.isEmpty() && now > m_nextPulseUpdate)
565  {
566  QString newtext = m_pulsedDialogText;
567  auto *dialog = qobject_cast<MythDialogBox*>(m_dialog);
568  if (dialog)
569  {
570  // The disambiguation string must be an empty string
571  // and not a NULL to get extracted by the Qt tools.
572  QString replace = QCoreApplication::translate("(Common)",
573  "%n second(s)", "",
574  static_cast<int>(now.secsTo(it.value())));
575  dialog->SetText(newtext.replace("%d", replace));
576  }
577  auto *cdialog = qobject_cast<MythConfirmationDialog*>(m_dialog);
578  if (cdialog)
579  {
580  QString replace = QString::number(now.secsTo(it.value()));
581  cdialog->SetMessage(newtext.replace("%d", replace));
582  }
583  m_nextPulseUpdate = now.addSecs(1);
584  }
585  }
586  }
587 }
588 
589 void OSD::SetExpiry(const QString &Window, enum OSDTimeout Timeout,
590  std::chrono::milliseconds CustomTimeout)
591 {
592  SetExpiryPriv(Window, Timeout, CustomTimeout);
593  if (IsWindowVisible(Window))
594  {
595  // Keep status and nav timeouts in sync
596  if (Window == OSD_DLG_NAVIGATE)
597  SetExpiryPriv(OSD_WIN_STATUS, Timeout, CustomTimeout);
598  else if (Window == OSD_WIN_STATUS && IsWindowVisible(OSD_DLG_NAVIGATE))
599  SetExpiryPriv(OSD_DLG_NAVIGATE, Timeout, CustomTimeout);
600  }
601 }
602 
603 void OSD::SetExpiryPriv(const QString &Window, enum OSDTimeout Timeout,
604  std::chrono::milliseconds CustomTimeout)
605 {
606  std::chrono::milliseconds time { 0ms };
607  if (CustomTimeout != 0ms)
608  time = CustomTimeout;
609  else if ((Timeout > kOSDTimeout_Ignore) && (Timeout <= kOSDTimeout_Long))
610  time = m_timeouts[static_cast<size_t>(Timeout)];
611  else
612  return;
613 
614  MythScreenType *win = GetWindow(Window);
615  if ((time > 0ms) && win)
616  {
617  QDateTime expires = MythDate::current().addMSecs(time.count());
618  m_expireTimes.insert(win, expires);
619  }
620  else if ((time < 0ms) && win)
621  {
622  if (m_expireTimes.contains(win))
623  m_expireTimes.remove(win);
624  }
625 }
626 
627 bool OSD::IsWindowVisible(const QString &Window)
628 {
629  if (!m_children.contains(Window))
630  return false;
631 
632  return m_children.value(Window)->IsVisible(/*true*/);
633 }
634 
635 void OSD::ResetWindow(const QString &Window)
636 {
637  if (!m_children.contains(Window))
638  return;
639 
640  MythScreenType *screen = m_children.value(Window);
641  if (screen != nullptr)
642  screen->Reset();
643 }
644 
646 {
647  if (!Window)
648  return;
649 
650  MythRect rect = Window->GetArea();
651  rect.translate(m_rect.left(), m_rect.top());
652  Window->SetArea(rect);
653 }
654 
655 void OSD::RemoveWindow(const QString &Window)
656 {
657  if (!m_children.contains(Window))
658  return;
659 
660  HideWindow(Window);
661  MythScreenType *child = m_children.value(Window);
662  m_children.remove(Window);
663  delete child;
664 }
665 
666 void OSD::SetFunctionalWindow(const QString &window, enum OSDFunctionalType Type)
667 {
668  if (m_functionalType != kOSDFunctionalType_Default && m_functionalType != Type)
669  emit HideOSD(m_functionalType);
670  m_functionalWindow = window;
671  m_functionalType = Type;
672 }
673 
674 void OSD::HideWindow(const QString &Window)
675 {
676  if (!m_children.contains(Window))
677  return;
678 
680 
681  SetExpiry(Window, kOSDTimeout_None);
682 
683  MythScreenType* screen = m_children.value(Window);
684  if ((m_functionalType != kOSDFunctionalType_Default) && screen)
685  {
686  bool valid = m_children.contains(m_functionalWindow);
687  screen = m_children.value(m_functionalWindow);
688  bool visible = valid && screen && screen->IsVisible(false);
689  if (!valid || !visible)
690  {
691  emit HideOSD(m_functionalType);
692  m_functionalType = kOSDFunctionalType_Default;
693  m_functionalWindow = QString();
694  }
695  }
696 }
697 
698 bool OSD::DialogVisible(const QString& Window)
699 {
700  if (!m_dialog || Window.isEmpty())
701  return m_dialog;
702  return m_dialog->objectName() == Window;
703 }
704 
706 {
707  if (!m_dialog)
708  return false;
709  return m_dialog->keyPressEvent(Event);
710 }
711 
713 {
714  if (!m_dialog)
715  return false;
716  return m_dialog->gestureEvent(Event);
717 }
718 
720 {
721  if (!m_dialog)
722  return;
723 
724  RemoveWindow(m_dialog->objectName());
725  m_dialog = nullptr;
726  m_pulsedDialogText = QString();
727 }
728 
737 {
738  DialogShow(Data.m_dialogName, Data.m_message, Data.m_timeout);
739  std::for_each(Data.m_buttons.cbegin(), Data.m_buttons.cend(),
740  [this](const MythOSDDialogData::MythOSDDialogButton& B) {
741  DialogAddButton(B.m_text, B.m_data, B.m_menu, B.m_current); });
742  DialogBack(Data.m_back.m_text, Data.m_back.m_data, Data.m_back.m_exit);
743 }
744 
745 void OSD::DialogShow(const QString &Window, const QString &Text, std::chrono::milliseconds UpdateFor)
746 {
747  if (m_dialog)
748  {
749  QString current = m_dialog->objectName();
750  if (current != Window)
751  {
752  DialogQuit();
753  }
754  else
755  {
756  auto *dialog = qobject_cast<MythDialogBox*>(m_dialog);
757  if (dialog)
758  {
759  dialog->Reset();
760  dialog->SetText(Text);
761  }
762  }
763  }
764 
765  if (!m_dialog)
766  {
767  OverrideUIScale();
768  MythScreenType *dialog = nullptr;
769 
770  if (Window == OSD_DLG_EDITOR)
771  dialog = new MythChannelOverlay(m_mainWindow, m_tv, Window.toLatin1());
772  else if (Window == OSD_DLG_CONFIRM)
773  dialog = new MythConfirmationDialog(nullptr, Text, false);
774  else if (Window == OSD_DLG_NAVIGATE)
775  dialog = new MythNavigationOverlay(m_mainWindow, m_tv, m_player, Window, this);
776  else
777  dialog = new MythDialogBox(Text, nullptr, Window.toLatin1(), false, true);
778 
779  dialog->SetPainter(m_painter);
780  if (dialog->Create())
781  {
782  PositionWindow(dialog);
783  m_dialog = dialog;
784  auto *dbox = qobject_cast<MythDialogBox*>(m_dialog);
785  if (dbox)
786  dbox->SetReturnEvent(m_tv, Window);
787  auto *cbox = qobject_cast<MythConfirmationDialog*>(m_dialog);
788  if (cbox)
789  {
790  cbox->SetReturnEvent(m_tv, Window);
791  cbox->SetData("DIALOG_CONFIRM_X_X");
792  }
793  m_children.insert(Window, m_dialog);
794  }
795  else
796  {
797  RevertUIScale();
798  delete dialog;
799  return;
800  }
801 
802  RevertUIScale();
803  }
804 
805  if (UpdateFor > 0ms)
806  {
808  m_pulsedDialogText = Text;
809  SetExpiry(Window, kOSDTimeout_None, UpdateFor);
810  }
811 
812  DialogBack();
813  HideAll(true, m_dialog);
814  m_dialog->SetVisible(true);
815 }
816 
817 void OSD::DialogBack(const QString& Text, const QVariant& Data, bool Exit)
818 {
819  auto *dialog = qobject_cast<MythDialogBox*>(m_dialog);
820  if (dialog)
821  {
822  dialog->SetBackAction(Text, Data);
823  if (Exit)
824  dialog->SetExitAction(Text, Data);
825  }
826 }
827 
828 void OSD::DialogAddButton(const QString& Text, QVariant Data, bool Menu, bool Current)
829 {
830  auto *dialog = qobject_cast<MythDialogBox*>(m_dialog);
831  if (dialog)
832  dialog->AddButtonV(Text, std::move(Data), Menu, Current);
833 }
834 
836 {
837  auto *edit = qobject_cast<MythChannelOverlay*>(m_dialog);
838  if (edit)
839  edit->GetText(Map);
840 }
OSD::DialogAddButton
void DialogAddButton(const QString &Text, QVariant Data, bool Menu=false, bool Current=false)
Definition: osd.cpp:828
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:835
OSD::DialogVisible
bool DialogVisible(const QString &Window=QString())
Definition: osd.cpp:698
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:37
MARK_PLACEHOLDER
@ MARK_PLACEHOLDER
Definition: programtypes.h:53
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:603
OSD::ShowDialog
void ShowDialog(const MythOSDDialogData &Data)
Show a dialog menu, removing any existing dialog.
Definition: osd.cpp:736
OSD::IsWindowVisible
bool IsWindowVisible(const QString &Window)
Definition: osd.cpp:627
TVPlaybackState::ChangeOSDText
void ChangeOSDText(const QString &Window, const InfoMap &Map, OSDTimeout Timeout)
MythUIProgressBar::SetStart
void SetStart(int value)
Definition: mythuiprogressbar.cpp:66
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:712
MythUIType::GetChild
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
Definition: mythuitype.cpp:138
MythPlayerOverlayUI::BrowsingChanged
void BrowsingChanged(bool Browsing)
Definition: mythplayeroverlayui.cpp:31
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:971
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:442
MythUIProgressBar::SetUsed
void SetUsed(int value)
Definition: mythuiprogressbar.cpp:72
OSD::ResetWindow
void ResetWindow(const QString &Window)
Definition: osd.cpp:635
mythdialogbox.h
MythScreenType::Create
virtual bool Create(void)
Definition: mythscreentype.cpp:263
frm_dir_map_t
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
Definition: programtypes.h:117
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:610
OSDTimeout
OSDTimeout
Definition: osd.h:55
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
MythUIImage::Reset
void Reset(void) override
Reset the image back to the default defined in the theme.
Definition: mythuiimage.cpp:644
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:745
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:376
Visible
Definition: channelsettings.cpp:416
mythuiimage.h
OSD_WIN_PROGEDIT
static constexpr const char * OSD_WIN_PROGEDIT
Definition: osd.h:35
OSDFunctionalType
OSDFunctionalType
Definition: osd.h:44
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:15
MythOverlayWindow
Definition: mythmediaoverlay.h:18
OSD::RemoveWindow
void RemoveWindow(const QString &Window)
Definition: osd.cpp:655
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:885
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
MythPlayerUI::OSDDebugVisibilityChanged
void OSDDebugVisibilityChanged(bool Visible)
Definition: mythplayerui.cpp:883
MythPlayerUI
Definition: mythplayerui.h:12
OSD_WIN_STATUS
static constexpr const char * OSD_WIN_STATUS
Definition: osd.h:32
MythUIProgressBar::SetTotal
void SetTotal(int value)
Definition: mythuiprogressbar.cpp:78
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
kOSDTimeout_None
@ kOSDTimeout_None
Definition: osd.h:58
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
MythOSDDialogData
Definition: osd.h:64
kOSDTimeout_Ignore
@ kOSDTimeout_Ignore
Definition: osd.h:57
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:27
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:457
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
MARK_CUT_START
@ MARK_CUT_START
Definition: programtypes.h:55
OSD::LoadWindows
void LoadWindows()
Definition: osd.cpp:120
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:666
mythpainter.h
TV::HandleOSDClosed
void HandleOSDClosed(int OSDType)
Definition: tv_play.cpp:7739
MythMediaOverlay::m_children
QMap< QString, MythScreenType * > m_children
Definition: mythmediaoverlay.h:61
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:73
OSD_DLG_EDITOR
static constexpr const char * OSD_DLG_EDITOR
Definition: osd.h:23
kOSDTimeout_Long
@ kOSDTimeout_Long
Definition: osd.h:61
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:262
MythUIEditBar::ClearRegions
void ClearRegions(void)
Definition: mythuieditbar.cpp:67
mythuihelper.h
MythOSDDialogData::m_buttons
std::vector< MythOSDDialogButton > m_buttons
Definition: osd.h:87
ChannelUtil::GetIcon
static QString GetIcon(uint chanid)
Definition: channelutil.cpp:1270
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:401
MythMediaOverlay::GetWindow
virtual MythScreenType * GetWindow(const QString &Window)
Definition: mythmediaoverlay.cpp:92
MARK_CUT_END
@ MARK_CUT_END
Definition: programtypes.h:54
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:115
OSD::DialogQuit
void DialogQuit()
Definition: osd.cpp:719
MythMediaOverlay::m_mainWindow
MythMainWindow * m_mainWindow
Definition: mythmediaoverlay.h:50
MythUIType::SetVisible
virtual void SetVisible(bool visible)
Definition: mythuitype.cpp:1105
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:674
OSD::PositionWindow
void PositionWindow(MythScreenType *Window)
Definition: osd.cpp:645
OSD::DialogBack
void DialogBack(const QString &Text="", const QVariant &Data=0, bool Exit=false)
Definition: osd.cpp:817
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:455
mythnavigationoverlay.h
OSD::DialogHandleKeypress
bool DialogHandleKeypress(QKeyEvent *Event)
Definition: osd.cpp:705
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:548
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:802
MythUIImage::SetFilename
void SetFilename(const QString &filename)
Must be followed by a call to Load() to load the image.
Definition: mythuiimage.cpp:677
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:193
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:903
OSD::SetExpiry
void SetExpiry(const QString &Window, enum OSDTimeout Timeout, std::chrono::milliseconds CustomTimeout=0ms)
Definition: osd.cpp:589
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
kOSDFunctionalType_Default
@ kOSDFunctionalType_Default
Definition: osd.h:46
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
uint
unsigned int uint
Definition: freesurround.h:24
TVPlaybackState::IsOSDVisible
void IsOSDVisible(bool &Visible)
tv_play.h
TV
Control TV playback.
Definition: tv_play.h:154