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 
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 : qAsConst(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 : qAsConst(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 : qAsConst(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  if (Timeout == kOSDTimeout_Ignore && CustomTimeout == 0ms)
605  return;
606 
607  MythScreenType *win = GetWindow(Window);
608  std::chrono::milliseconds time = (CustomTimeout != 0ms)
609  ? CustomTimeout : m_timeouts[static_cast<size_t>(Timeout)];
610  if ((time > 0ms) && win)
611  {
612  QDateTime expires = MythDate::current().addMSecs(time.count());
613  m_expireTimes.insert(win, expires);
614  }
615  else if ((time < 0ms) && win)
616  {
617  if (m_expireTimes.contains(win))
618  m_expireTimes.remove(win);
619  }
620 }
621 
622 bool OSD::IsWindowVisible(const QString &Window)
623 {
624  if (!m_children.contains(Window))
625  return false;
626 
627  return m_children.value(Window)->IsVisible(/*true*/);
628 }
629 
630 void OSD::ResetWindow(const QString &Window)
631 {
632  if (!m_children.contains(Window))
633  return;
634 
635  MythScreenType *screen = m_children.value(Window);
636  if (screen != nullptr)
637  screen->Reset();
638 }
639 
641 {
642  if (!Window)
643  return;
644 
645  MythRect rect = Window->GetArea();
646  rect.translate(m_rect.left(), m_rect.top());
647  Window->SetArea(rect);
648 }
649 
650 void OSD::RemoveWindow(const QString &Window)
651 {
652  if (!m_children.contains(Window))
653  return;
654 
655  HideWindow(Window);
656  MythScreenType *child = m_children.value(Window);
657  m_children.remove(Window);
658  delete child;
659 }
660 
661 void OSD::SetFunctionalWindow(const QString &window, enum OSDFunctionalType Type)
662 {
663  if (m_functionalType != kOSDFunctionalType_Default && m_functionalType != Type)
664  emit HideOSD(m_functionalType);
665  m_functionalWindow = window;
666  m_functionalType = Type;
667 }
668 
669 void OSD::HideWindow(const QString &Window)
670 {
671  if (!m_children.contains(Window))
672  return;
673 
675 
676  SetExpiry(Window, kOSDTimeout_None);
677 
678  MythScreenType* screen = m_children.value(Window);
679  if ((m_functionalType != kOSDFunctionalType_Default) && screen)
680  {
681  bool valid = m_children.contains(m_functionalWindow);
682  screen = m_children.value(m_functionalWindow);
683  bool visible = valid && screen && screen->IsVisible(false);
684  if (!valid || !visible)
685  {
686  emit HideOSD(m_functionalType);
687  m_functionalType = kOSDFunctionalType_Default;
688  m_functionalWindow = QString();
689  }
690  }
691 }
692 
693 bool OSD::DialogVisible(const QString& Window)
694 {
695  if (!m_dialog || Window.isEmpty())
696  return m_dialog;
697  return m_dialog->objectName() == Window;
698 }
699 
701 {
702  if (!m_dialog)
703  return false;
704  return m_dialog->keyPressEvent(Event);
705 }
706 
708 {
709  if (!m_dialog)
710  return false;
711  return m_dialog->gestureEvent(Event);
712 }
713 
715 {
716  if (!m_dialog)
717  return;
718 
719  RemoveWindow(m_dialog->objectName());
720  m_dialog = nullptr;
721  m_pulsedDialogText = QString();
722 }
723 
732 {
733  DialogShow(Data.m_dialogName, Data.m_message, Data.m_timeout);
734  std::for_each(Data.m_buttons.cbegin(), Data.m_buttons.cend(),
735  [this](const MythOSDDialogData::MythOSDDialogButton& B) {
736  DialogAddButton(B.m_text, B.m_data, B.m_menu, B.m_current); });
737  DialogBack(Data.m_back.m_text, Data.m_back.m_data, Data.m_back.m_exit);
738 }
739 
740 void OSD::DialogShow(const QString &Window, const QString &Text, std::chrono::milliseconds UpdateFor)
741 {
742  if (m_dialog)
743  {
744  QString current = m_dialog->objectName();
745  if (current != Window)
746  {
747  DialogQuit();
748  }
749  else
750  {
751  auto *dialog = qobject_cast<MythDialogBox*>(m_dialog);
752  if (dialog)
753  {
754  dialog->Reset();
755  dialog->SetText(Text);
756  }
757  }
758  }
759 
760  if (!m_dialog)
761  {
762  OverrideUIScale();
763  MythScreenType *dialog = nullptr;
764 
765  if (Window == OSD_DLG_EDITOR)
766  dialog = new MythChannelOverlay(m_mainWindow, m_tv, Window.toLatin1());
767  else if (Window == OSD_DLG_CONFIRM)
768  dialog = new MythConfirmationDialog(nullptr, Text, false);
769  else if (Window == OSD_DLG_NAVIGATE)
770  dialog = new MythNavigationOverlay(m_mainWindow, m_tv, m_player, Window, this);
771  else
772  dialog = new MythDialogBox(Text, nullptr, Window.toLatin1(), false, true);
773 
774  dialog->SetPainter(m_painter);
775  if (dialog->Create())
776  {
777  PositionWindow(dialog);
778  m_dialog = dialog;
779  auto *dbox = qobject_cast<MythDialogBox*>(m_dialog);
780  if (dbox)
781  dbox->SetReturnEvent(m_tv, Window);
782  auto *cbox = qobject_cast<MythConfirmationDialog*>(m_dialog);
783  if (cbox)
784  {
785  cbox->SetReturnEvent(m_tv, Window);
786  cbox->SetData("DIALOG_CONFIRM_X_X");
787  }
788  m_children.insert(Window, m_dialog);
789  }
790  else
791  {
792  RevertUIScale();
793  delete dialog;
794  return;
795  }
796 
797  RevertUIScale();
798  }
799 
800  if (UpdateFor > 0ms)
801  {
803  m_pulsedDialogText = Text;
804  SetExpiry(Window, kOSDTimeout_None, UpdateFor);
805  }
806 
807  DialogBack();
808  HideAll(true, m_dialog);
809  m_dialog->SetVisible(true);
810 }
811 
812 void OSD::DialogBack(const QString& Text, const QVariant& Data, bool Exit)
813 {
814  auto *dialog = qobject_cast<MythDialogBox*>(m_dialog);
815  if (dialog)
816  {
817  dialog->SetBackAction(Text, Data);
818  if (Exit)
819  dialog->SetExitAction(Text, Data);
820  }
821 }
822 
823 void OSD::DialogAddButton(const QString& Text, QVariant Data, bool Menu, bool Current)
824 {
825  auto *dialog = qobject_cast<MythDialogBox*>(m_dialog);
826  if (dialog)
827  dialog->AddButtonV(Text, std::move(Data), Menu, Current);
828 }
829 
831 {
832  auto *edit = qobject_cast<MythChannelOverlay*>(m_dialog);
833  if (edit)
834  edit->GetText(Map);
835 }
OSD::DialogAddButton
void DialogAddButton(const QString &Text, QVariant Data, bool Menu=false, bool Current=false)
Definition: osd.cpp:823
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:154
OSD::DialogGetText
void DialogGetText(InfoMap &Map)
Definition: osd.cpp:830
OSD::DialogVisible
bool DialogVisible(const QString &Window=QString())
Definition: osd.cpp:693
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:35
OSD::m_fadeTime
std::chrono::milliseconds m_fadeTime
Definition: osd.h:147
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:601
OSD::ShowDialog
void ShowDialog(const MythOSDDialogData &Data)
Show a dialog menu, removing any existing dialog.
Definition: osd.cpp:731
MARK_PLACEHOLDER
@ MARK_PLACEHOLDER
Definition: programtypes.h:55
OSD::IsWindowVisible
bool IsWindowVisible(const QString &Window)
Definition: osd.cpp:622
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:707
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:29
MARK_CUT_END
@ MARK_CUT_END
Definition: programtypes.h:56
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:970
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:440
MythUIProgressBar::SetUsed
void SetUsed(int value)
Definition: mythuiprogressbar.cpp:59
OSD::ResetWindow
void ResetWindow(const QString &Window)
Definition: osd.cpp:630
mythdialogbox.h
MythScreenType::Create
virtual bool Create(void)
Definition: mythscreentype.cpp:265
frm_dir_map_t
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
Definition: programtypes.h:119
MythNavigationOverlay
Definition: mythnavigationoverlay.h:12
osd.h
MythUIType::SetArea
virtual void SetArea(const MythRect &rect)
Definition: mythuitype.cpp:607
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: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:44
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:35
MythOSDDialogData::MythOSDDialogButton
Definition: osd.h:68
OSD::m_functionalWindow
QString m_functionalWindow
Definition: osd.h:153
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:647
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:740
OSD::SetRegions
void SetRegions(const QString &Window, frm_dir_map_t &Map, long long Total)
Definition: osd.cpp:374
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:650
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:882
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
MythPlayerUI::OSDDebugVisibilityChanged
void OSDDebugVisibilityChanged(bool Visible)
Definition: mythplayerui.cpp:844
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
AudioOutputGraph::GetImage
MythImage * GetImage(std::chrono::milliseconds Timecode) const
Definition: audiooutputgraph.cpp:249
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
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::Draw
void Draw()
Definition: osd.cpp:455
OSD_DLG_NAVIGATE
#define OSD_DLG_NAVIGATE
Definition: osd.h:27
MythUIType::SetPainter
void SetPainter(MythPainter *painter)
Definition: mythuitype.h:190
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:120
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:661
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:7648
MythMediaOverlay::m_children
QMap< QString, MythScreenType * > m_children
Definition: mythmediaoverlay.h:61
uint
unsigned int uint
Definition: compat.h:144
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:149
MythMainWindow::GetCurrentNotificationCenter
MythNotificationCenter * GetCurrentNotificationCenter()
Definition: mythmainwindow.cpp:259
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:57
ChannelUtil::GetIcon
static QString GetIcon(uint chanid)
Definition: channelutil.cpp:1243
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:397
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:148
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:714
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:1098
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:669
OSD::PositionWindow
void PositionWindow(MythScreenType *Window)
Definition: osd.cpp:640
OSD::DialogBack
void DialogBack(const QString &Text="", const QVariant &Data=0, bool Exit=false)
Definition: osd.cpp:812
OSD::m_embedded
bool m_embedded
Definition: osd.h:146
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:439
mythnavigationoverlay.h
OSD::DialogHandleKeypress
bool DialogHandleKeypress(QKeyEvent *Event)
Definition: osd.cpp:700
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:546
Player
Definition: zmliveplayer.h:34
mythchanneloverlay.h
OSD::m_nextPulseUpdate
QDateTime m_nextPulseUpdate
Definition: osd.h:150
MythChannelOverlay
Definition: mythchanneloverlay.h:10
MythCoreContext::GetMasterHostPrefix
QString GetMasterHostPrefix(const QString &storageGroup=QString(), const QString &path=QString())
Definition: mythcorecontext.cpp:822
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:678
OSD::m_timeouts
std::array< std::chrono::milliseconds, 4 > m_timeouts
Definition: osd.h:151
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:82
mythmainwindow.h
OSD::Embed
void Embed(bool Embedding)
Definition: osd.cpp:77
MythUIType::IsVisible
bool IsVisible(bool recurse=false) const
Definition: mythuitype.cpp:900
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: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:154