MythTV  master
osd.cpp
Go to the documentation of this file.
1 // Qt
2 #include <QCoreApplication>
3 #include <utility>
4 
5 // libmyth
6 #include "mythlogging.h"
7 
8 // libmythui
9 #include "mythmainwindow.h"
10 #include "mythuihelper.h"
11 #include "mythpainter.h"
12 #include "mythuiimage.h"
13 #include "mythuiprogressbar.h"
14 #include "mythdialogbox.h"
15 #include "mythuitext.h"
16 #include "mythuibutton.h"
17 #include "mythuieditbar.h"
18 #include "mythuistatetype.h"
19 #include "mythuigroup.h"
20 
21 // libmythtv
22 #include "channelutil.h"
25 #include "interactivescreen.h"
26 #include "osd.h"
27 #include "Bluray/mythbdbuffer.h"
29 #include "tv_actions.h"
30 
31 #define LOC QString("OSD: ")
32 
33 QEvent::Type OSDHideEvent::kEventType = static_cast<QEvent::Type>(QEvent::registerEventType());
34 
36 {
37  if (!XMLParseBase::LoadWindowFromXML("osd.xml", "ChannelEditor", this))
38  return false;
39 
40  MythUIButton *probeButton = nullptr;
41  MythUIButton *okButton = nullptr;
42 
43  bool err = false;
44  UIUtilE::Assign(this, m_callsignEdit, "callsign", &err);
45  UIUtilE::Assign(this, m_channumEdit, "channum", &err);
46  UIUtilE::Assign(this, m_channameEdit, "channame", &err);
47  UIUtilE::Assign(this, m_xmltvidEdit, "XMLTV", &err);
48  UIUtilE::Assign(this, probeButton, "probe", &err);
49  UIUtilE::Assign(this, okButton, "ok", &err);
50 
51  if (err)
52  {
53  LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'ChannelEditor'");
54  return false;
55  }
56 
58  connect(okButton, SIGNAL(Clicked()), SLOT(Confirm()));
59  connect(probeButton, SIGNAL(Clicked()), SLOT(Probe()));
60  SetFocusWidget(okButton);
61 
62  return true;
63 }
64 
66 {
67  SendResult(1);
68 }
69 
71 {
72  SendResult(2);
73 }
74 
76 {
77  if (Map.contains("callsign"))
78  m_callsignEdit->SetText(Map.value("callsign"));
79  if (Map.contains("channum"))
80  m_channumEdit->SetText(Map.value("channum"));
81  if (Map.contains("channame"))
82  m_channameEdit->SetText(Map.value("channame"));
83  if (Map.contains("XMLTV"))
84  m_xmltvidEdit->SetText(Map.value("XMLTV"));
85 }
86 
88 {
89  Map["callsign"] = m_callsignEdit->GetText();
90  Map["channum"] = m_channumEdit->GetText();
91  Map["channame"] = m_channameEdit->GetText();
92  Map["XMLTV"] = m_xmltvidEdit->GetText();
93 }
94 
96 {
98  return true;
99 
100  QStringList actions;
101  bool handled = GetMythMainWindow()->TranslateKeyPress("qt", Event, actions);
102 
103  for (int i = 0; i < actions.size() && !handled; i++)
104  {
105  QString action = actions[i];
106  if (action == "ESCAPE" )
107  {
108  SendResult(3);
109  handled = true;
110  }
111  }
112 
113  if (!handled && MythScreenType::keyPressEvent(Event))
114  handled = true;
115 
116  return handled;
117 }
118 
120 {
121  if (!m_retObject)
122  return;
123 
124  QString message = "";
125  switch (result)
126  {
127  case 1:
128  message = "DIALOG_EDITOR_OK_0";
129  break;
130  case 2:
131  message = "DIALOG_EDITOR_PROBE_0";
132  break;
133  case 3:
134  message = "DIALOG_EDITOR_QUIT_0";
135  break;
136  }
137 
138  auto *dce = new DialogCompletionEvent("", result, "", message);
139  QCoreApplication::postEvent(m_retObject, dce);
140 }
141 
143 {
144  TearDown();
145 }
146 
147 void OSD::TearDown(void)
148 {
149  for (MythScreenType* screen : qAsConst(m_children))
150  delete screen;
151  m_children.clear();
152  m_dialog = nullptr;
153 }
154 
155 bool OSD::Init(const QRect &Rect, float FontAspect)
156 {
157  m_rect = Rect;
158  m_fontStretch = static_cast<int>(lroundf(FontAspect * 100));
159  OverrideUIScale();
160  LoadWindows();
161  RevertUIScale();
162 
163  if (m_children.isEmpty())
164  {
165  LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to load any windows.");
166  return false;
167  }
168 
169  LOG(VB_PLAYBACK, LOG_INFO, LOC +
170  QString("Loaded OSD: size %1x%2 offset %3+%4")
171  .arg(m_rect.width()).arg(m_rect.height())
172  .arg(m_rect.left()).arg(m_rect.top()));
173  HideAll(false);
174  return true;
175 }
176 
178 {
179  if (Painter == m_currentPainter)
180  return;
181 
182  m_currentPainter = Painter;
183  QMapIterator<QString, MythScreenType*> it(m_children);
184  while (it.hasNext())
185  {
186  it.next();
187  it.value()->SetPainter(m_currentPainter);
188  }
189 }
190 
191 void OSD::OverrideUIScale(bool Log)
192 {
193  QRect uirect = GetMythMainWindow()->GetUIScreenRect();
194  if (uirect == m_rect)
195  return;
196 
200  QSize theme_size = GetMythUI()->GetBaseSize();
201  m_savedUIRect = uirect;
202  float tmp_wmult = static_cast<float>(m_rect.size().width()) / static_cast<float>(theme_size.width());
203  float tmp_hmult = static_cast<float>(m_rect.size().height()) / static_cast<float>(theme_size.height());
204  if (Log)
205  {
206  LOG(VB_GENERAL, LOG_INFO, LOC + QString("Base theme size: %1x%2")
207  .arg(theme_size.width()).arg(theme_size.height()));
208  LOG(VB_GENERAL, LOG_INFO, LOC + QString("Scaling factors: %1x%2")
209  .arg(static_cast<double>(tmp_wmult)).arg(static_cast<double>(tmp_hmult)));
210  }
211  m_uiScaleOverride = true;
212  GetMythMainWindow()->SetScalingFactors(tmp_wmult, tmp_hmult);
214 }
215 
217 {
218  if (m_uiScaleOverride)
219  {
223  }
224  m_uiScaleOverride = false;
225 }
226 
227 bool OSD::Reinit(const QRect &Rect, float FontAspect)
228 {
229  m_refresh = true;
230  int new_stretch = static_cast<int>(lroundf(FontAspect * 100));
231  if ((Rect == m_rect) && (new_stretch == m_fontStretch))
232  return true;
233  if (m_dialog && m_dialog->objectName() == OSD_DLG_NAVIGATE
234  && m_dialog->IsVisible())
235  {
236  return true;
237  }
238 
239  HideAll(false);
240  TearDown();
241  if (!Init(Rect, FontAspect))
242  {
243  LOG(VB_GENERAL, LOG_ERR, LOC + QString("Failed to re-init OSD."));
244  return false;
245  }
246  return true;
247 }
248 
249 bool OSD::IsVisible(void)
250 {
251  if (GetNotificationCenter()->DisplayedNotifications() > 0)
252  return true;
253 
254  for (MythScreenType* child : qAsConst(m_children))
255  {
256  if (child->IsVisible() &&
257  child->objectName() != OSD_WIN_SUBTITLE &&
258  child->objectName() != OSD_WIN_TELETEXT &&
259  child->objectName() != OSD_WIN_BDOVERLAY &&
260  child->objectName() != OSD_WIN_INTERACT)
261  return true;
262  }
263 
264  return false;
265 }
266 
267 void OSD::HideAll(bool KeepSubs, MythScreenType* Except, bool DropNotification)
268 {
269  if (DropNotification)
270  {
271  if (GetNotificationCenter()->RemoveFirst())
272  return; // we've removed the top window, don't process any further
273  }
274  QMutableMapIterator<QString, MythScreenType*> it(m_children);
275  while (it.hasNext())
276  {
277  it.next();
278  if (Except && Except->objectName() == OSD_DLG_NAVIGATE
279  && it.value()->objectName() == "osd_status")
280  continue;
281  bool match1 = KeepSubs &&
282  (it.key() == OSD_WIN_SUBTITLE ||
283  it.key() == OSD_WIN_TELETEXT);
284  bool match2 = it.key() == OSD_WIN_BDOVERLAY ||
285  it.key() == OSD_WIN_INTERACT ||
286  it.value() == Except;
287  if (!(match1 || match2))
288  HideWindow(it.key());
289  }
290 }
291 
293 {
294  static const std::array<const QString,7> s_defaultWindows {
295  "osd_message", "osd_input", "program_info", "browse_info", "osd_status",
296  "osd_program_editor", "osd_debug"};
297 
298  for (const auto & window : s_defaultWindows)
299  {
300  auto *win = new MythOSDWindow(nullptr, window, true);
301 
302  win->SetPainter(m_currentPainter);
303  if (win->Create())
304  {
305  PositionWindow(win);
306  LOG(VB_PLAYBACK, LOG_INFO, LOC +
307  QString("Loaded window %1").arg(window));
308  m_children.insert(window, win);
309  }
310  else
311  {
312  LOG(VB_GENERAL, LOG_ERR, LOC + QString("Failed to load window %1")
313  .arg(window));
314  delete win;
315  }
316  }
317 }
318 
319 void OSD::SetValues(const QString &Window, const QHash<QString,int> &Map, OSDTimeout Timeout)
320 {
321  MythScreenType *win = GetWindow(Window);
322  if (!win)
323  return;
324 
325  bool found = false;
326  if (Map.contains("position"))
327  {
328  MythUIProgressBar *bar = dynamic_cast<MythUIProgressBar *> (win->GetChild("position"));
329  if (bar)
330  {
331  bar->SetVisible(true);
332  bar->SetStart(0);
333  bar->SetTotal(1000);
334  bar->SetUsed(Map.value("position"));
335  found = true;
336  }
337  }
338  if (Map.contains("relposition"))
339  {
340  MythUIProgressBar *bar = dynamic_cast<MythUIProgressBar *> (win->GetChild("relposition"));
341  if (bar)
342  {
343  bar->SetVisible(true);
344  bar->SetStart(0);
345  bar->SetTotal(1000);
346  bar->SetUsed(Map.value("relposition"));
347  found = true;
348  }
349  }
350 
351  if (found)
352  SetExpiry(Window, Timeout);
353 }
354 
355 void OSD::SetValues(const QString &Window, const QHash<QString,float> &Map,
356  OSDTimeout Timeout)
357 {
358  MythScreenType *win = GetWindow(Window);
359  if (!win)
360  return;
361 
362  bool found = false;
363  if (Map.contains("position"))
364  {
365  MythUIEditBar *edit = dynamic_cast<MythUIEditBar *> (win->GetChild("editbar"));
366  if (edit)
367  {
368  edit->SetEditPosition(static_cast<double>(Map.value("position")));
369  found = true;
370  }
371  }
372 
373  if (found)
374  SetExpiry(Window, Timeout);
375 }
376 
377 void OSD::SetText(const QString &Window, const InfoMap &Map, OSDTimeout Timeout)
378 {
379  MythScreenType *win = GetWindow(Window);
380  if (!win)
381  return;
382 
383  if (Map.contains("numstars"))
384  {
385  MythUIStateType *state = dynamic_cast<MythUIStateType *> (win->GetChild("ratingstate"));
386  if (state)
387  state->DisplayState(Map["numstars"]);
388  }
389  if (Map.contains("tvstate"))
390  {
391  MythUIStateType *state = dynamic_cast<MythUIStateType *> (win->GetChild("tvstate"));
392  if (state)
393  state->DisplayState(Map["tvstate"]);
394  }
395  if (Map.contains("videocodec"))
396  {
397  MythUIStateType *state = dynamic_cast<MythUIStateType *> (win->GetChild("videocodec"));
398  if (state)
399  state->DisplayState(Map["videocodec"]);
400  }
401  if (Map.contains("videodescrip"))
402  {
403  MythUIStateType *state = dynamic_cast<MythUIStateType *> (win->GetChild("videodescrip"));
404  if (state)
405  state->DisplayState(Map["videodescrip"]);
406  }
407  if (Map.contains("audiocodec"))
408  {
409  MythUIStateType *state = dynamic_cast<MythUIStateType *> (win->GetChild("audiocodec"));
410  if (state)
411  state->DisplayState(Map["audiocodec"]);
412  }
413  if (Map.contains("audiochannels"))
414  {
415  MythUIStateType *state = dynamic_cast<MythUIStateType *> (win->GetChild("audiochannels"));
416  if (state)
417  state->DisplayState(Map["audiochannels"]);
418  }
419  if (Map.contains("chanid"))
420  {
421  MythUIImage *icon = dynamic_cast<MythUIImage *> (win->GetChild("iconpath"));
422  if (icon)
423  {
424  icon->Reset();
425 
426  uint chanid = Map["chanid"].toUInt();
427  QString iconpath;
428  if (Map.contains("iconpath"))
429  iconpath = Map["iconpath"];
430  else
431  iconpath = ChannelUtil::GetIcon(chanid);
432 
433  if (!iconpath.isEmpty())
434  {
435  QString iconurl =
436  gCoreContext->GetMasterHostPrefix("ChannelIcons",
437  iconpath);
438 
439  icon->SetFilename(iconurl);
440  icon->Load(false);
441  }
442  }
443  }
444 
445  if (Map.contains("channelgroup"))
446  {
447  MythUIText *textArea = dynamic_cast<MythUIText *> (win->GetChild("channelgroup"));
448  if (textArea)
449  {
450  textArea->SetText(Map["channelgroup"]);
451  }
452  }
453 
454  if (Map.contains("inetref"))
455  {
456  MythUIImage *cover = dynamic_cast<MythUIImage *> (win->GetChild("coverart"));
457  if (cover && Map.contains("coverartpath"))
458  {
459  QString coverpath = Map["coverartpath"];
460  cover->SetFilename(coverpath);
461  cover->Load(false);
462  }
463  MythUIImage *fanart = dynamic_cast<MythUIImage *> (win->GetChild("fanart"));
464  if (fanart && Map.contains("fanartpath"))
465  {
466  QString fanartpath = Map["fanartpath"];
467  fanart->SetFilename(fanartpath);
468  fanart->Load(false);
469  }
470  MythUIImage *banner = dynamic_cast<MythUIImage *> (win->GetChild("banner"));
471  if (banner && Map.contains("bannerpath"))
472  {
473  QString bannerpath = Map["bannerpath"];
474  banner->SetFilename(bannerpath);
475  banner->Load(false);
476  }
477  MythUIImage *screenshot = dynamic_cast<MythUIImage *> (win->GetChild("screenshot"));
478  if (screenshot && Map.contains("screenshotpath"))
479  {
480  QString screenshotpath = Map["screenshotpath"];
481  screenshot->SetFilename(screenshotpath);
482  screenshot->Load(false);
483  }
484  }
485  if (Map.contains("nightmode"))
486  {
487  MythUIStateType *state = dynamic_cast<MythUIStateType *> (win->GetChild("nightmode"));
488  if (state)
489  state->DisplayState(Map["nightmode"]);
490  }
491  if (Map.contains("mediatype"))
492  {
493  MythUIStateType *state = dynamic_cast<MythUIStateType *> (win->GetChild("mediatype"));
494  if (state)
495  state->DisplayState(Map["mediatype"]);
496  }
497 
498  MythUIProgressBar *bar =
499  dynamic_cast<MythUIProgressBar *>(win->GetChild("elapsedpercent"));
500  if (bar)
501  {
502  qint64 startts = Map["startts"].toLongLong();
503  qint64 endts = Map["endts"].toLongLong();
504  qint64 nowts = MythDate::current().toSecsSinceEpoch();
505  if (startts > nowts)
506  {
507  bar->SetUsed(0);
508  }
509  else if (endts < nowts)
510  {
511  bar->SetUsed(1000);
512  }
513  else
514  {
515  qint64 duration = endts - startts;
516  if (duration > 0)
517  bar->SetUsed(static_cast<int>(1000 * (nowts - startts) / duration));
518  else
519  bar->SetUsed(0);
520  }
521  bar->SetVisible(startts > 0);
522  bar->SetStart(0);
523  bar->SetTotal(1000);
524  }
525 
526  win->SetVisible(true);
527 
528  if (win == m_dialog)
529  {
530  auto *edit = dynamic_cast<ChannelEditor*>(m_dialog);
531  if (edit)
532  edit->SetText(Map);
533  else
534  win->SetTextFromMap(Map);
535  }
536  else
537  win->SetTextFromMap(Map);
538 
539  SetExpiry(Window, Timeout);
540 }
541 
542 void OSD::SetRegions(const QString &Window, frm_dir_map_t &Map, long long Total)
543 {
544  MythScreenType *win = GetWindow(Window);
545  if (!win)
546  return;
547 
548  MythUIEditBar *bar = dynamic_cast<MythUIEditBar*>(win->GetChild("editbar"));
549  if (!bar)
550  return;
551 
552  bar->ClearRegions();
553  if (Map.empty() || Total < 1)
554  {
555  bar->Display();
556  return;
557  }
558 
559  long long start = -1;
560  long long end = -1;
561  bool first = true;
562  QMapIterator<uint64_t, MarkTypes> it(Map);
563  while (it.hasNext())
564  {
565  bool error = false;
566  it.next();
567  if (it.value() == MARK_CUT_START)
568  {
569  start = static_cast<long long>(it.key());
570  if (end > -1)
571  error = true;
572  }
573  else if (it.value() == MARK_CUT_END)
574  {
575  if (first)
576  start = 0;
577  if (start < 0)
578  error = true;
579  end = static_cast<long long>(it.key());
580  }
581  else if (it.value() == MARK_PLACEHOLDER)
582  {
583  start = end = static_cast<long long>(it.key());
584  }
585  first = false;
586 
587  if (error)
588  {
589  LOG(VB_GENERAL, LOG_ERR, LOC + "deleteMap discontinuity");
590  start = -1;
591  end = -1;
592  }
593 
594  if (start >=0 && end >= 0)
595  {
596  bar->AddRegion((static_cast<double>(start) / static_cast<double>(Total)),
597  (static_cast<double>(end) / static_cast<double>(Total)));
598  start = -1;
599  end = -1;
600  }
601  }
602  if (start > -1 && end < 0)
603  bar->AddRegion(static_cast<double>(start) / static_cast<double>(Total), 1.0);
604 
605  bar->Display();
606 }
607 
608 void OSD::SetGraph(const QString &Window, const QString &Graph, int64_t Timecode)
609 {
610  MythScreenType *win = GetWindow(Window);
611  if (!win)
612  return;
613 
614  auto *image = dynamic_cast<MythUIImage* >(win->GetChild(Graph));
615  if (!image)
616  return;
617 
618  MythImage* mi = m_parent->GetAudioGraph().GetImage(Timecode);
619  if (mi)
620  image->SetImage(mi);
621 }
622 
623 bool OSD::Draw(MythPainter* Painter, QSize Size, bool Repaint)
624 {
625  if (!Painter)
626  return false;
627 
628  bool visible = false;
629  bool redraw = m_refresh;
630  m_refresh = false;
631  QTime now = MythDate::current().time();
632 
633  CheckExpiry();
634  QMap<QString,MythScreenType*>::const_iterator it;
635  for (it = m_children.begin(); it != m_children.end(); ++it)
636  {
637  if ((*it)->IsVisible())
638  {
639  visible = true;
640  (*it)->Pulse();
641  if (m_expireTimes.contains((*it)))
642  {
643  QTime expires = m_expireTimes.value((*it)).time();
644  int left = now.msecsTo(expires);
645  if (left < m_fadeTime)
646  (*it)->SetAlpha((255 * left) / m_fadeTime);
647  }
648  if ((*it)->NeedsRedraw())
649  redraw = true;
650  }
651  }
652 
654  QList<MythScreenType*> notifications;
655  nc->GetNotificationScreens(notifications);
656  QList<MythScreenType*>::iterator it2 = notifications.begin();
657  while (it2 != notifications.end())
658  {
660  {
661  LOG(VB_GUI, LOG_DEBUG, LOC + "Creating OSD Notification");
662 
663  if (!m_uiScaleOverride)
664  {
665  OverrideUIScale(false);
666  }
667  (*it2)->SetPainter(m_currentPainter);
668  if (!(*it2)->Create())
669  {
670  it2 = notifications.erase(it2);
671  continue;
672  }
673  }
674  if ((*it2)->IsVisible())
675  {
676  if (!m_uiScaleOverride)
677  {
678  OverrideUIScale(false);
679  }
680 
681  (*it2)->SetPainter(m_currentPainter);
682 
684 
685  visible = true;
686  (*it2)->Pulse();
687  QTime expires = MythNotificationCenter::ScreenExpiryTime(*it2).time();
688  int left = now.msecsTo(expires);
689  if (left < 0)
690  left = 0;
691  if (expires.isValid() && left < m_fadeTime)
692  (*it2)->SetAlpha((255 * left) / m_fadeTime);
693  if ((*it2)->NeedsRedraw())
694  redraw = true;
695  }
696  ++it2;
697  }
698  RevertUIScale();
699 
700  redraw |= Repaint;
701 
702  if (redraw && visible)
703  {
704  QRect cliprect = QRect(QPoint(0, 0), Size);
705  Painter->Begin(nullptr);
706  for (it = m_children.begin(); it != m_children.end(); ++it)
707  {
708  if ((*it)->IsVisible())
709  {
710  (*it)->Draw(Painter, 0, 0, 255, cliprect);
711  (*it)->SetAlpha(255);
712  (*it)->ResetNeedsRedraw();
713  }
714  }
715  for (it2 = notifications.begin(); it2 != notifications.end(); ++it2)
716  {
717  if ((*it2)->IsVisible())
718  {
719  (*it2)->Draw(Painter, 0, 0, 255, cliprect);
720  (*it2)->SetAlpha(255);
721  (*it2)->ResetNeedsRedraw();
722  }
723  }
724  Painter->End();
725  }
726 
727  // Force a redraw if it just became invisible
728  if (m_visible && !visible)
729  redraw=true;
730  m_visible = visible;
731 
732  return redraw;
733 }
734 
736 {
737  QDateTime now = MythDate::current();
738  QMutableHashIterator<MythScreenType*, QDateTime> it(m_expireTimes);
739  while (it.hasNext())
740  {
741  it.next();
742  if (it.value() < now)
743  {
744  if (it.key() == m_dialog)
745  DialogQuit();
746  else
747  HideWindow(m_children.key(it.key()));
748  }
749  else if (it.key() == m_dialog)
750  {
751  if (!m_pulsedDialogText.isEmpty() && now > m_nextPulseUpdate)
752  {
753  QString newtext = m_pulsedDialogText;
754  auto *dialog = dynamic_cast<MythDialogBox*>(m_dialog);
755  if (dialog)
756  {
757  // The disambiguation string must be an empty string
758  // and not a NULL to get extracted by the Qt tools.
759  QString replace = QCoreApplication::translate("(Common)",
760  "%n second(s)", "",
761  static_cast<int>(now.secsTo(it.value())));
762  dialog->SetText(newtext.replace("%d", replace));
763  }
764  auto *cdialog = dynamic_cast<MythConfirmationDialog*>(m_dialog);
765  if (cdialog)
766  {
767  QString replace = QString::number(now.secsTo(it.value()));
768  cdialog->SetMessage(newtext.replace("%d", replace));
769  }
770  m_nextPulseUpdate = now.addSecs(1);
771  }
772  }
773  }
774 }
775 
776 void OSD::SetExpiry(const QString &Window, enum OSDTimeout Timeout,
777  int CustomTimeout)
778 {
779  SetExpiryPriv(Window, Timeout, CustomTimeout);
780  if (IsWindowVisible(Window))
781  {
782  // Keep status and nav timeouts in sync
783  if (Window == OSD_DLG_NAVIGATE)
784  SetExpiryPriv("osd_status", Timeout, CustomTimeout);
785  else if (Window == "osd_status" && IsWindowVisible(OSD_DLG_NAVIGATE))
786  SetExpiryPriv(OSD_DLG_NAVIGATE, Timeout, CustomTimeout);
787  }
788 }
789 
790 void OSD::SetExpiryPriv(const QString &Window, enum OSDTimeout Timeout, int CustomTimeout)
791 {
792  if (Timeout == kOSDTimeout_Ignore && !CustomTimeout)
793  return;
794 
795  MythScreenType *win = GetWindow(Window);
796  int time = CustomTimeout ? CustomTimeout : m_timeouts[Timeout];
797  if ((time > 0) && win)
798  {
799  QDateTime expires = MythDate::current().addMSecs(time);
800  m_expireTimes.insert(win, expires);
801  }
802  else if ((time < 0) && win)
803  {
804  if (m_expireTimes.contains(win))
805  m_expireTimes.remove(win);
806  }
807 }
808 
809 void OSD::SetTimeouts(int Short, int Medium, int Long)
810 {
812  m_timeouts[kOSDTimeout_Short] = Short;
813  m_timeouts[kOSDTimeout_Med] = Medium;
815 }
816 
817 bool OSD::IsWindowVisible(const QString &Window)
818 {
819  if (!m_children.contains(Window))
820  return false;
821 
822  return m_children.value(Window)->IsVisible(/*true*/);
823 }
824 
825 void OSD::ResetWindow(const QString &Window)
826 {
827  if (!m_children.contains(Window))
828  return;
829 
830  m_children.value(Window)->Reset();
831 }
832 
834 {
835  if (!Window)
836  return;
837 
838  MythRect rect = Window->GetArea();
839  rect.translate(m_rect.left(), m_rect.top());
840  Window->SetArea(rect);
841 }
842 
843 void OSD::RemoveWindow(const QString &Window)
844 {
845  if (!m_children.contains(Window))
846  return;
847 
848  HideWindow(Window);
849  MythScreenType *child = m_children.value(Window);
850  m_children.remove(Window);
851  delete child;
852 }
853 
854 MythScreenType *OSD::GetWindow(const QString &Window)
855 {
856  if (m_children.contains(Window))
857  return m_children.value(Window);
858 
859  MythScreenType *new_window = nullptr;
860 
861  if (Window == OSD_WIN_INTERACT)
862  {
863  new_window = new InteractiveScreen(m_parent, Window);
864  }
865  else if (Window == OSD_WIN_BDOVERLAY)
866  {
867  new_window = new MythBDOverlayScreen(m_parent, Window);
868  }
869  else
870  {
871  new_window = new MythOSDWindow(nullptr, Window, false);
872  }
873 
874  new_window->SetPainter(m_currentPainter);
875  if (new_window->Create())
876  {
877  m_children.insert(Window, new_window);
878  LOG(VB_PLAYBACK, LOG_INFO, LOC +
879  QString("Created window %1").arg(Window));
880  return new_window;
881  }
882 
883  LOG(VB_GENERAL, LOG_ERR, LOC + QString("Failed to create window %1")
884  .arg(Window));
885  delete new_window;
886  return nullptr;
887 }
888 
889 void OSD::SetFunctionalWindow(const QString &window, enum OSDFunctionalType Type)
890 {
891  if (m_functionalType != kOSDFunctionalType_Default &&
892  m_functionalType != Type)
893  SendHideEvent();
894 
895  m_functionalWindow = window;
896  m_functionalType = Type;
897 }
898 
899 void OSD::HideWindow(const QString &Window)
900 {
901  if (!m_children.contains(Window))
902  return;
903  m_children.value(Window)->SetVisible(false);
904  m_children.value(Window)->Close(); // for InteractiveScreen
905  SetExpiry(Window, kOSDTimeout_None);
906  m_refresh = true;
907 
908  if (m_functionalType != kOSDFunctionalType_Default)
909  {
910  bool valid = m_children.contains(m_functionalWindow);
911  bool visible = valid && m_children.value(m_functionalWindow)->IsVisible(false);
912  if (!valid || !visible)
913  {
914  SendHideEvent();
915  m_functionalType = kOSDFunctionalType_Default;
916  m_functionalWindow = QString();
917  }
918  }
919 }
920 
922 {
923  auto *event = new OSDHideEvent(m_functionalType);
924  QCoreApplication::postEvent(m_parentObject, event);
925 }
926 
927 bool OSD::HasWindow(const QString &Window)
928 {
929  return m_children.contains(Window);
930 }
931 
932 bool OSD::DialogVisible(const QString& Window)
933 {
934  if (!m_dialog || Window.isEmpty())
935  return m_dialog;
936  return m_dialog->objectName() == Window;
937 }
938 
940 {
941  if (!m_dialog)
942  return false;
943  return m_dialog->keyPressEvent(Event);
944 }
945 
947 {
948  if (!m_dialog)
949  return false;
950  return m_dialog->gestureEvent(Event);
951 }
952 
953 void OSD::DialogQuit(void)
954 {
955  if (!m_dialog)
956  return;
957 
958  RemoveWindow(m_dialog->objectName());
959  m_dialog = nullptr;
960  m_pulsedDialogText = QString();
961 }
962 
963 void OSD::DialogShow(const QString &Window, const QString &Text, int UpdateFor)
964 {
965  if (m_dialog)
966  {
967  QString current = m_dialog->objectName();
968  if (current != Window)
969  {
970  DialogQuit();
971  }
972  else
973  {
974  auto *dialog = dynamic_cast<MythDialogBox*>(m_dialog);
975  if (dialog)
976  dialog->Reset();
977 
978  DialogSetText(Text);
979  }
980  }
981 
982  if (!m_dialog)
983  {
984  OverrideUIScale();
985  MythScreenType *dialog = nullptr;
986 
987  if (Window == OSD_DLG_EDITOR)
988  dialog = new ChannelEditor(m_parentObject, Window.toLatin1());
989  else if (Window == OSD_DLG_CONFIRM)
990  dialog = new MythConfirmationDialog(nullptr, Text, false);
991  else if (Window == OSD_DLG_NAVIGATE)
992  dialog = new OsdNavigation(m_parentObject, Window, this);
993  else
994  dialog = new MythDialogBox(Text, nullptr, Window.toLatin1(), false, true);
995 
996  dialog->SetPainter(m_currentPainter);
997  if (dialog->Create())
998  {
999  PositionWindow(dialog);
1000  m_dialog = dialog;
1001  auto *dbox = dynamic_cast<MythDialogBox*>(m_dialog);
1002  if (dbox)
1003  dbox->SetReturnEvent(m_parentObject, Window);
1004  auto *cbox = dynamic_cast<MythConfirmationDialog*>(m_dialog);
1005  if (cbox)
1006  {
1007  cbox->SetReturnEvent(m_parentObject, Window);
1008  cbox->SetData("DIALOG_CONFIRM_X_X");
1009  }
1010  m_children.insert(Window, m_dialog);
1011  }
1012  else
1013  {
1014  RevertUIScale();
1015  delete dialog;
1016  return;
1017  }
1018 
1019  RevertUIScale();
1020  }
1021 
1022  if (UpdateFor)
1023  {
1025  m_pulsedDialogText = Text;
1026  SetExpiry(Window, kOSDTimeout_None, UpdateFor);
1027  }
1028 
1029  DialogBack();
1030  HideAll(true, m_dialog);
1031  m_dialog->SetVisible(true);
1032 }
1033 
1034 void OSD::DialogSetText(const QString &Text)
1035 {
1036  auto *dialog = dynamic_cast<MythDialogBox*>(m_dialog);
1037  if (dialog)
1038  dialog->SetText(Text);
1039 }
1040 
1041 void OSD::DialogBack(const QString& Text, const QVariant& Data, bool Exit)
1042 {
1043  auto *dialog = dynamic_cast<MythDialogBox*>(m_dialog);
1044  if (dialog)
1045  {
1046  dialog->SetBackAction(Text, Data);
1047  if (Exit)
1048  dialog->SetExitAction(Text, Data);
1049  }
1050 }
1051 
1052 void OSD::DialogAddButton(const QString& Text, QVariant Data, bool Menu, bool Current)
1053 {
1054  auto *dialog = dynamic_cast<MythDialogBox*>(m_dialog);
1055  if (dialog)
1056  dialog->AddButton(Text, std::move(Data), Menu, Current);
1057 }
1058 
1060 {
1061  auto *edit = dynamic_cast<ChannelEditor*>(m_dialog);
1062  if (edit)
1063  edit->GetText(Map);
1064 }
1065 
1067 {
1068  TeletextScreen *tt = nullptr;
1069  if (m_children.contains(OSD_WIN_TELETEXT))
1070  {
1071  tt = dynamic_cast<TeletextScreen*>(m_children.value(OSD_WIN_TELETEXT));
1072  }
1073  else
1074  {
1075  OverrideUIScale();
1077 
1079  if (tt->Create())
1080  {
1081  m_children.insert(OSD_WIN_TELETEXT, tt);
1082  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Created window %1")
1083  .arg(OSD_WIN_TELETEXT));
1084  }
1085  else
1086  {
1087  delete tt;
1088  tt = nullptr;
1089  }
1090  RevertUIScale();
1091  }
1092  if (!tt)
1093  {
1094  LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to create Teletext window");
1095  return nullptr;
1096  }
1097 
1099  tt->SetDisplaying(false);
1100  return tt;
1101 }
1102 
1103 void OSD::EnableTeletext(bool Enable, int Page)
1104 {
1105  TeletextScreen *tt = InitTeletext();
1106  if (!tt)
1107  return;
1108 
1109  tt->SetVisible(Enable);
1110  tt->SetDisplaying(Enable);
1111  if (Enable)
1112  {
1113  tt->SetPage(Page, -1);
1114  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Enabled teletext page %1")
1115  .arg(Page));
1116  }
1117  else
1118  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Disabled teletext");
1119 }
1120 
1121 bool OSD::TeletextAction(const QString &Action)
1122 {
1124  return false;
1125 
1126  TeletextScreen* tt = dynamic_cast<TeletextScreen*>(m_children.value(OSD_WIN_TELETEXT));
1127  if (tt)
1128  return tt->KeyPress(Action);
1129  return false;
1130 }
1131 
1133 {
1135  return;
1136 
1137  TeletextScreen* tt = InitTeletext();
1138  if (tt)
1139  tt->Reset();
1140 }
1141 
1143 {
1145  return;
1146 
1147  TeletextScreen* tt = dynamic_cast<TeletextScreen*>(m_children.value(OSD_WIN_TELETEXT));
1148  if (tt)
1149  tt->ClearScreen();
1150 }
1151 
1153 {
1154  SubtitleScreen *sub = nullptr;
1155  if (m_children.contains(OSD_WIN_SUBTITLE))
1156  {
1157  sub = dynamic_cast<SubtitleScreen*>(m_children.value(OSD_WIN_SUBTITLE));
1158  }
1159  else
1160  {
1161  OverrideUIScale();
1164  if (sub->Create())
1165  {
1166  m_children.insert(OSD_WIN_SUBTITLE, sub);
1167  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Created window %1")
1168  .arg(OSD_WIN_SUBTITLE));
1169  }
1170  else
1171  {
1172  delete sub;
1173  sub = nullptr;
1174  }
1175  RevertUIScale();
1176  }
1177  if (!sub)
1178  {
1179  LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to create subtitle window");
1180  return nullptr;
1181  }
1182  return sub;
1183 }
1184 
1185 void OSD::EnableSubtitles(int Type, bool ForcedOnly)
1186 {
1187  SubtitleScreen *sub = InitSubtitles();
1188  if (sub)
1189  sub->EnableSubtitles(Type, ForcedOnly);
1190 }
1191 
1193 {
1195  return;
1196 
1197  SubtitleScreen *sub = InitSubtitles();
1198  sub->DisableForcedSubtitles();
1199 }
1200 
1202 {
1204  return;
1205 
1206  SubtitleScreen* sub = InitSubtitles();
1207  if (sub)
1208  sub->ClearAllSubtitles();
1209 }
1210 
1211 void OSD::DisplayDVDButton(AVSubtitle* DVDButton, QRect &Pos)
1212 {
1213  if (!DVDButton)
1214  return;
1215 
1216  SubtitleScreen* sub = InitSubtitles();
1217  if (sub)
1218  {
1220  sub->DisplayDVDButton(DVDButton, Pos);
1221  }
1222 }
1223 
1225 {
1226  if (!Overlay)
1227  return;
1228 
1230  if (bd)
1231  bd->DisplayBDOverlay(Overlay);
1232 }
1233 
1235 {
1236  if (!XMLParseBase::LoadWindowFromXML("osd.xml", "osd_navigation", this))
1237  return false;
1238 
1239  MythUIButton *moreButton = nullptr;
1240  UIUtilW::Assign(this, moreButton, "more");
1241  if (moreButton)
1242  connect(moreButton, SIGNAL(Clicked()), SLOT(More()));
1243  UIUtilW::Assign(this, m_pauseButton, "PAUSE");
1244  UIUtilW::Assign(this, m_playButton, "PLAY");
1245  UIUtilW::Assign(this, m_muteButton, "MUTE");
1246  UIUtilW::Assign(this, m_unMuteButton, "unmute");
1247 
1248  MythPlayer *player = m_osd->GetPlayer();
1249 
1250  if (!player || !player->HasAudioOut() ||
1251  !player->PlayerControlsVolume())
1252  {
1253  m_isVolumeControl = false;
1254  if (m_muteButton)
1255  m_muteButton->Hide();
1256  if (m_unMuteButton)
1257  m_unMuteButton->Hide();
1258  }
1259 
1260  // find number of groups and make sure only corrrect one is visible
1261  MythUIGroup *group = nullptr;
1262  for (int i = 0; i < 100 ; i++)
1263  {
1264  UIUtilW::Assign(this, group, QString("grp%1").arg(i));
1265  if (group)
1266  {
1267  m_maxGroupNum = i;
1268  if (i != m_visibleGroup)
1269  group->SetVisible (false);
1270  QList<MythUIType *> * children = group->GetAllChildren();
1271  QList<MythUIType *>::iterator it;
1272  for (it = children->begin(); it != children->end(); ++it)
1273  {
1274  MythUIType *child = *it;
1275  if (child == moreButton)
1276  continue;
1277  connect(child, SIGNAL(Clicked()), SLOT(GeneralAction()));
1278  }
1279  }
1280  else
1281  break;
1282  }
1283 
1284  BuildFocusList();
1285 
1286  return true;
1287 }
1288 
1290 {
1291  // bool extendTimeout = (m_paused != 'Y');
1292  bool extendTimeout = true;
1293  bool handled = false;
1294 
1295  MythUIType *focus = GetFocusWidget();
1296  if (focus && focus->keyPressEvent(Event))
1297  handled = true;
1298 
1299  if (!handled)
1300  {
1301  QStringList actions;
1302  handled = GetMythMainWindow()->TranslateKeyPress("qt", Event, actions);
1303 
1304  for (int i = 0; i < actions.size() && !handled; i++)
1305  {
1306  QString action = actions[i];
1307  if (action == "ESCAPE" )
1308  {
1309  SendResult(-1,action);
1310  handled = true;
1311  extendTimeout = false;
1312  }
1313  }
1314  }
1315  if (!handled && MythScreenType::keyPressEvent(Event))
1316  handled = true;
1317 
1318  if (extendTimeout)
1319  {
1321  // m_osd->SetExpiry("osd_status", kOSDTimeout_Long);
1322  }
1323 
1324  return handled;
1325 }
1326 
1327 // Virtual
1329 {
1330  SendResult(100,"MENU");
1331 }
1332 
1333 void OsdNavigation::SendResult(int Result, const QString& Action)
1334 {
1335  if (!m_retObject)
1336  return;
1337 
1338  auto *dce = new DialogCompletionEvent("", Result, "", Action);
1339  QCoreApplication::postEvent(m_retObject, dce);
1340 }
1341 
1343 {
1344  MythUIType *fw = GetFocusWidget();
1345  if (fw)
1346  {
1347  QString nameClicked = fw->objectName();
1348  int result = 100;
1349  int hashPos = nameClicked.indexOf('#');
1350  if (hashPos > -1)
1351  nameClicked.truncate(hashPos);
1352  if (nameClicked == "INFO")
1353  result=0;
1354  if (nameClicked == "unmute")
1355  nameClicked = "MUTE";
1356  SendResult(result, nameClicked);
1357  }
1358 }
1359 
1360 // Switch to next group of icons. They have to be
1361 // named grp0, grp1, etc with no gaps in numbers.
1363 {
1364  if (m_maxGroupNum <= 0)
1365  return;
1366 
1367  MythUIGroup *group = nullptr;
1368  UIUtilW::Assign(this, group, QString("grp%1").arg(m_visibleGroup));
1369  group->SetVisible (false);
1370 
1371  // wrap around after last group displayed
1372  if (++m_visibleGroup > m_maxGroupNum)
1373  m_visibleGroup = 0;
1374 
1375  UIUtilW::Assign(this, group, QString("grp%1").arg(m_visibleGroup));
1376  group->SetVisible (true);
1377 }
1378 
1380 {
1381 
1382  char paused = Map.value("paused", "X").toLocal8Bit().at(0);
1383  if (paused != 'X')
1384  {
1385  if (m_playButton && m_pauseButton && paused != m_paused)
1386  {
1387  MythUIType *fw = GetFocusWidget();
1388  m_playButton->SetVisible(paused=='Y');
1389  m_pauseButton->SetVisible(paused!='Y');
1390  if (fw && (fw == m_playButton || fw == m_pauseButton))
1391  {
1392  fw->LoseFocus();
1393  MythUIType *newfw = (paused=='Y' ? m_playButton : m_pauseButton);
1394  SetFocusWidget(newfw);
1395  if (m_paused == 'X')
1396  newfw->TakeFocus();
1397  }
1398  m_paused = paused;
1399  }
1400  }
1401 
1402  char muted = Map.value("muted","X").toLocal8Bit().at(0);
1403  if (m_isVolumeControl && muted != 'X')
1404  {
1405  if (m_muteButton && m_unMuteButton && muted != m_muted)
1406  {
1407  MythUIType *fw = GetFocusWidget();
1408  m_muteButton->SetVisible(muted!='Y');
1409  m_unMuteButton->SetVisible(muted=='Y');
1410  m_muted = muted;
1411  if (fw && (fw == m_muteButton || fw == m_unMuteButton))
1412  {
1413  fw->LoseFocus();
1414  SetFocusWidget(muted=='Y' ? m_unMuteButton : m_muteButton);
1415  }
1416  }
1417  }
1418 
1420 }
OSD::DialogAddButton
void DialogAddButton(const QString &Text, QVariant Data, bool Menu=false, bool Current=false)
Definition: osd.cpp:1052
MythUIType::keyPressEvent
virtual bool keyPressEvent(QKeyEvent *event)
Key event handler.
Definition: mythuitype.cpp:972
OsdNavigation::More
void More(void)
Definition: osd.cpp:1362
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
OsdNavigation::m_muted
char m_muted
Definition: osd.h:253
OSD::m_expireTimes
QHash< MythScreenType *, QDateTime > m_expireTimes
Definition: osd.h:221
OSD_WIN_INTERACT
#define OSD_WIN_INTERACT
Definition: osd.h:35
OSD::DialogGetText
void DialogGetText(InfoMap &Map)
Definition: osd.cpp:1059
OSD::SendHideEvent
void SendHideEvent(void)
Definition: osd.cpp:921
MythDialogBox::SetReturnEvent
void SetReturnEvent(QObject *retobject, const QString &resultid)
Definition: mythdialogbox.cpp:275
OSD::DialogVisible
bool DialogVisible(const QString &Window=QString())
Definition: osd.cpp:932
OSD::m_rect
QRect m_rect
Definition: osd.h:204
TeletextScreen::SetDisplaying
void SetDisplaying(bool display)
Definition: teletextscreen.cpp:243
OSD::RevertUIScale
void RevertUIScale(void)
Definition: osd.cpp:216
OsdNavigation::m_playButton
MythUIButton * m_playButton
Definition: osd.h:248
mythuitext.h
mythuiprogressbar.h
OSD::m_visible
bool m_visible
Definition: osd.h:210
MythUIImage
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
OSD_DLG_CONFIRM
#define OSD_DLG_CONFIRM
Definition: osd.h:30
error
static void error(const char *str,...)
Definition: vbi.cpp:42
OSD::Draw
bool Draw(MythPainter *Painter, QSize Size, bool Repaint=false)
Definition: osd.cpp:623
MythUIEditBar::Display
void Display(void)
Definition: mythuieditbar.cpp:72
TeletextScreen::SetPage
void SetPage(int page, int subpage)
Definition: teletextscreen.cpp:237
AudioOutputGraph::GetImage
MythImage * GetImage(int64_t timecode) const
Definition: audiooutputgraph.cpp:261
OSD::TeletextAction
bool TeletextAction(const QString &Action)
Definition: osd.cpp:1121
OSD_WIN_BDOVERLAY
#define OSD_WIN_BDOVERLAY
Definition: osd.h:36
MARK_PLACEHOLDER
@ MARK_PLACEHOLDER
Definition: programtypes.h:54
OSD::IsWindowVisible
bool IsWindowVisible(const QString &Window)
Definition: osd.cpp:817
OSD::SetTimeouts
void SetTimeouts(int Short, int Medium, int Long)
Definition: osd.cpp:809
OSD::m_savedFontStretch
int m_savedFontStretch
Definition: osd.h:217
teletextscreen.h
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::m_savedHMult
float m_savedHMult
Definition: osd.h:214
OSD::DisplayDVDButton
void DisplayDVDButton(AVSubtitle *DVDButton, QRect &Pos)
Definition: osd.cpp:1211
OSD::DialogHandleGesture
bool DialogHandleGesture(MythGestureEvent *Event)
Definition: osd.cpp:946
OSD::Reinit
bool Reinit(const QRect &Rect, float FontAspect)
Definition: osd.cpp:227
MythMainWindow::TranslateKeyPress
bool TranslateKeyPress(const QString &context, QKeyEvent *e, QStringList &actions, bool allowJumps=true)
Get a list of actions for a keypress in the given context.
Definition: mythmainwindow.cpp:1106
MythUIType::GetChild
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
Definition: mythuitype.cpp:130
MythConfirmationDialog::SetReturnEvent
void SetReturnEvent(QObject *retobject, const QString &resultid)
Definition: mythdialogbox.cpp:512
MARK_CUT_END
@ MARK_CUT_END
Definition: programtypes.h:55
OsdNavigation::GeneralAction
void GeneralAction(void)
Definition: osd.cpp:1342
OSD::SetGraph
void SetGraph(const QString &Window, const QString &Graph, int64_t Timecode)
Definition: osd.cpp:608
MythUIImage::Load
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
Definition: mythuiimage.cpp:967
MythDialogBox::SetBackAction
void SetBackAction(const QString &text, QVariant data)
Definition: mythdialogbox.cpp:282
ChannelEditor::m_callsignEdit
MythUITextEdit * m_callsignEdit
Definition: osd.h:102
MythBDOverlayScreen::DisplayBDOverlay
void DisplayBDOverlay(MythBDOverlay *Overlay)
Definition: mythbdoverlayscreen.cpp:18
MythUIEditBar
A narrow purpose widget used to represent cut positions and regions when editing a video.
Definition: mythuieditbar.h:16
MythUIProgressBar::SetUsed
void SetUsed(int value)
Definition: mythuiprogressbar.cpp:59
OSD::ResetWindow
void ResetWindow(const QString &Window)
Definition: osd.cpp:825
mythdialogbox.h
MythScreenType::Create
virtual bool Create(void)
Definition: mythscreentype.cpp:282
arg
arg(title).arg(filename).arg(doDelete))
frm_dir_map_t
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
Definition: programtypes.h:82
ChannelEditor::keyPressEvent
bool keyPressEvent(QKeyEvent *Event) override
Key event handler.
Definition: osd.cpp:95
OsdNavigation::m_unMuteButton
MythUIButton * m_unMuteButton
Definition: osd.h:251
MythBDOverlay
Definition: mythbdoverlay.h:18
SubtitleScreen::Create
bool Create(void) override
Definition: subtitlescreen.cpp:1697
osd.h
ChannelEditor::m_retObject
QObject * m_retObject
Definition: osd.h:106
MythUIType::SetArea
virtual void SetArea(const MythRect &rect)
Definition: mythuitype.cpp:589
MythUIGroup
Create a group of widgets.
Definition: mythuigroup.h:11
OSD::TearDown
void TearDown(void)
Definition: osd.cpp:147
OSD::OverrideUIScale
void OverrideUIScale(bool Log=true)
Definition: osd.cpp:191
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:267
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:377
MythPlayer::PlayerControlsVolume
bool PlayerControlsVolume(void) const
Definition: mythplayer.h:269
MythUIType::GetAllChildren
QList< MythUIType * > * GetAllChildren(void)
Return a list of all child widgets.
Definition: mythuitype.cpp:194
OSD::m_functionalWindow
QString m_functionalWindow
Definition: osd.h:219
OSDHideEvent::kEventType
static Type kEventType
Definition: osd.h:75
kOSDTimeout_None
@ kOSDTimeout_None
Definition: osd.h:60
MythPlayer
Definition: mythplayer.h:164
MythUITextEdit::GetText
QString GetText(void) const
Definition: mythuitextedit.h:47
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
OSD::DialogSetText
void DialogSetText(const QString &Text)
Definition: osd.cpp:1034
mythuieditbar.h
OSD::m_savedUIRect
QRect m_savedUIRect
Definition: osd.h:215
OSD::SetRegions
void SetRegions(const QString &Window, frm_dir_map_t &Map, long long Total)
Definition: osd.cpp:542
OSD::m_parent
MythPlayer * m_parent
Definition: osd.h:201
ChannelEditor::Probe
void Probe()
Definition: osd.cpp:70
MythMainWindow::SetScalingFactors
void SetScalingFactors(float wmult, float hmult)
Definition: mythmainwindow.cpp:2246
OSD::LoadWindows
void LoadWindows(void)
Definition: osd.cpp:292
mythuiimage.h
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
OSD::ClearSubtitles
void ClearSubtitles(void)
Definition: osd.cpp:1201
OSD::RemoveWindow
void RemoveWindow(const QString &Window)
Definition: osd.cpp:843
OsdNavigation::m_retObject
QObject * m_retObject
Definition: osd.h:246
Action
An action (for this plugin) consists of a description, and a set of key sequences.
Definition: action.h:40
OSD::m_parentObject
QObject * m_parentObject
Definition: osd.h:202
MythScreenType::GetFocusWidget
MythUIType * GetFocusWidget(void) const
Definition: mythscreentype.cpp:112
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:864
OSD::DialogShow
void DialogShow(const QString &Window, const QString &Text="", int UpdateFor=0)
Definition: osd.cpp:963
OSD::SetExpiryPriv
void SetExpiryPriv(const QString &Window, enum OSDTimeout Timeout, int CustomTimeout)
Definition: osd.cpp:790
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
OsdNavigation::ShowMenu
void ShowMenu(void) override
Definition: osd.cpp:1328
SubtitleScreen
Definition: subtitlescreen.h:172
OSD::m_uiScaleOverride
bool m_uiScaleOverride
Definition: osd.h:212
OSD::HideWindow
void HideWindow(const QString &Window)
Definition: osd.cpp:899
OSD::GetWindow
MythScreenType * GetWindow(const QString &Window)
Definition: osd.cpp:854
MythPlayer::HasAudioOut
bool HasAudioOut(void) const
Definition: mythplayer.h:265
MythPlayer::GetAudioGraph
const AudioOutputGraph & GetAudioGraph() const
Definition: mythplayer.h:232
MythUITextEdit::SetText
void SetText(const QString &text, bool moveCursor=true)
Definition: mythuitextedit.cpp:216
OSD_WIN_TELETEXT
#define OSD_WIN_TELETEXT
Definition: osd.h:32
OSD::m_fadeTime
int m_fadeTime
Definition: osd.h:205
MythUIProgressBar::SetTotal
void SetTotal(int value)
Definition: mythuiprogressbar.cpp:71
OSD::EnableTeletext
void EnableTeletext(bool Enable, int Page)
Definition: osd.cpp:1103
ChannelEditor::m_xmltvidEdit
MythUITextEdit * m_xmltvidEdit
Definition: osd.h:105
mythlogging.h
OSDTimeout
OSDTimeout
Definition: osd.h:57
subtitlescreen.h
OSD::TeletextClear
void TeletextClear(void)
Definition: osd.cpp:1142
kOSDFunctionalType_Default
@ kOSDFunctionalType_Default
Definition: osd.h:48
MythUIType::LoseFocus
void LoseFocus()
Definition: mythuitype.cpp:1001
tv_actions.h
MythUIProgressBar
Progress bar widget.
Definition: mythuiprogressbar.h:12
OSD::SetPainter
void SetPainter(MythPainter *Painter)
Definition: osd.cpp:177
Event
Event details.
Definition: zmdefines.h:26
MythScreenType::SetFocusWidget
bool SetFocusWidget(MythUIType *widget=nullptr)
Definition: mythscreentype.cpp:117
MythDialogBox
Basic menu dialog, message and a list of options.
Definition: mythdialogbox.h:137
SubtitleScreen::EnableSubtitles
void EnableSubtitles(int type, bool forced_only=false)
Definition: subtitlescreen.cpp:1386
MythDialogBox::AddButton
void AddButton(const QString &title, QVariant data=0, bool newMenu=false, bool setCurrent=false)
Definition: mythdialogbox.cpp:300
TeletextScreen::Reset
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: teletextscreen.cpp:250
MythUIEditBar::AddRegion
void AddRegion(double start, double end)
Definition: mythuieditbar.cpp:45
TeletextScreen::Create
bool Create(void) override
Definition: teletextscreen.cpp:55
MythDialogBox::SetText
void SetText(const QString &text)
Definition: mythdialogbox.cpp:294
MythUIHelper::GetBaseSize
QSize GetBaseSize(void) const
Definition: mythuihelper.cpp:1506
MythScreenType::BuildFocusList
void BuildFocusList(void)
Definition: mythscreentype.cpp:222
OSD::m_refresh
bool m_refresh
Definition: osd.h:209
OSD::DisplayBDOverlay
void DisplayBDOverlay(MythBDOverlay *Overlay)
Definition: osd.cpp:1224
OSD_DLG_NAVIGATE
#define OSD_DLG_NAVIGATE
Definition: osd.h:29
MythUIType::SetPainter
void SetPainter(MythPainter *painter)
Definition: mythuitype.h:167
ChannelEditor
Definition: osd.h:81
MythOSDWindow
Definition: osd.h:109
MythUIButton
A single button widget.
Definition: mythuibutton.h:21
kOSDTimeout_Short
@ kOSDTimeout_Short
Definition: osd.h:61
MythUIComposite::SetTextFromMap
virtual void SetTextFromMap(const InfoMap &infoMap)
Definition: mythuicomposite.cpp:9
kOSDTimeout_Long
@ kOSDTimeout_Long
Definition: osd.h:63
MythUIHelper::GetFontStretch
int GetFontStretch(void) const
Definition: mythuihelper.cpp:1516
OSD::EnableSubtitles
void EnableSubtitles(int Type, bool ForcedOnly=false)
Definition: osd.cpp:1185
SubtitleScreen::DisplayDVDButton
void DisplayDVDButton(AVSubtitle *dvdButton, QRect &buttonPos)
Definition: subtitlescreen.cpp:1481
OSD::SetFunctionalWindow
void SetFunctionalWindow(const QString &Window, enum OSDFunctionalType Type)
Definition: osd.cpp:889
mythpainter.h
kOSDTimeout_Ignore
@ kOSDTimeout_Ignore
Definition: osd.h:59
OSD::m_children
QMap< QString, MythScreenType * > m_children
Definition: osd.h:220
uint
unsigned int uint
Definition: compat.h:140
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:57
MythUIType::TakeFocus
bool TakeFocus()
Definition: mythuitype.cpp:1011
ChannelEditor::Confirm
void Confirm()
Definition: osd.cpp:65
SubtitleScreen::DisableForcedSubtitles
void DisableForcedSubtitles(void)
Definition: subtitlescreen.cpp:1444
interactivescreen.h
OSD::InitTeletext
TeletextScreen * InitTeletext(void)
Definition: osd.cpp:1066
OSD::DisableForcedSubtitles
void DisableForcedSubtitles(void)
Definition: osd.cpp:1192
OSD::HasWindow
bool HasWindow(const QString &Window)
Definition: osd.cpp:927
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:69
OsdNavigation::m_visibleGroup
int m_visibleGroup
Definition: osd.h:254
OSD_DLG_EDITOR
#define OSD_DLG_EDITOR
Definition: osd.h:26
UIUtilDisp::Assign
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
Definition: mythuiutils.h:27
OsdNavigation::m_osd
OSD * m_osd
Definition: osd.h:247
OSD::m_currentPainter
MythPainter * m_currentPainter
Definition: osd.h:203
channelutil.h
MythUIType::Hide
void Hide(void)
Definition: mythuitype.cpp:1113
MythPainter::End
virtual void End()
Definition: mythpainter.h:53
mythuigroup.h
TeletextScreen
Definition: teletextscreen.h:10
MythUIType
The base class on which all widgets and screens are based.
Definition: mythuitype.h:63
MythUIHelper::SetFontStretch
void SetFontStretch(int stretch)
Definition: mythuihelper.cpp:1511
OsdNavigation::m_paused
char m_paused
Definition: osd.h:252
OSD::m_pulsedDialogText
QString m_pulsedDialogText
Definition: osd.h:207
MythUIEditBar::ClearRegions
void ClearRegions(void)
Definition: mythuieditbar.cpp:67
mythuihelper.h
OSD::SetExpiry
void SetExpiry(const QString &Window, enum OSDTimeout Timeout, int CustomTimeout=0)
Definition: osd.cpp:776
MARK_CUT_START
@ MARK_CUT_START
Definition: programtypes.h:56
mythbdbuffer.h
InteractiveScreen
Definition: interactivescreen.h:7
ChannelEditor::m_channumEdit
MythUITextEdit * m_channumEdit
Definition: osd.h:103
ChannelUtil::GetIcon
static QString GetIcon(uint chanid)
Definition: channelutil.cpp:1245
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:414
OSD::DialogQuit
void DialogQuit(void)
Definition: osd.cpp:953
OSD::GetPlayer
MythPlayer * GetPlayer(void)
Definition: osd.h:190
MythConfirmationDialog
Dialog asking for user confirmation. Ok and optional Cancel button.
Definition: mythdialogbox.h:221
OsdNavigation::SendResult
void SendResult(int Result, const QString &Action)
Definition: osd.cpp:1333
XMLParseBase::LoadWindowFromXML
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
Definition: xmlparsebase.cpp:692
OSD::~OSD
~OSD()
Definition: osd.cpp:142
mythbdoverlayscreen.h
MythPainter
Definition: mythpainter.h:32
OsdNavigation::m_isVolumeControl
bool m_isVolumeControl
Definition: osd.h:256
MythUIEditBar::SetEditPosition
void SetEditPosition(double position)
Definition: mythuieditbar.cpp:31
MythImage
Definition: mythimage.h:36
OSD::m_timeouts
std::array< int, 4 > m_timeouts
Definition: osd.h:211
OSD::InitSubtitles
SubtitleScreen * InitSubtitles(void)
Definition: osd.cpp:1152
OsdNavigation::keyPressEvent
bool keyPressEvent(QKeyEvent *Event) override
Key event handler.
Definition: osd.cpp:1289
ChannelEditor::Create
bool Create(void) override
Definition: osd.cpp:35
DialogCompletionEvent
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
Definition: mythdialogbox.h:41
OSD_WIN_SUBTITLE
#define OSD_WIN_SUBTITLE
Definition: osd.h:33
MythPainter::Begin
virtual void Begin(QPaintDevice *parent)
Definition: mythpainter.h:52
OSD::m_dialog
MythScreenType * m_dialog
Definition: osd.h:206
MythMainWindow::SetUIScreenRect
void SetUIScreenRect(QRect &rect)
Definition: mythmainwindow.cpp:2257
OSD::m_savedWMult
float m_savedWMult
Definition: osd.h:213
MythUIText::SetText
virtual void SetText(const QString &text)
Definition: mythuitext.cpp:135
MythUIType::SetVisible
virtual void SetVisible(bool visible)
Definition: mythuitype.cpp:1080
GetNotificationCenter
MythNotificationCenter * GetNotificationCenter(void)
Definition: mythmainwindow.cpp:127
OsdNavigation::m_maxGroupNum
int m_maxGroupNum
Definition: osd.h:255
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::CheckExpiry
void CheckExpiry(void)
Definition: osd.cpp:735
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition: mythmainwindow.cpp:107
MythBDOverlayScreen
Definition: mythbdoverlayscreen.h:10
OSD::PositionWindow
void PositionWindow(MythScreenType *Window)
Definition: osd.cpp:833
OSD::DialogBack
void DialogBack(const QString &Text="", const QVariant &Data=0, bool Exit=false)
Definition: osd.cpp:1041
build_compdb.action
action
Definition: build_compdb.py:9
kDisplayDVDButton
@ kDisplayDVDButton
Definition: mythplayer.h:79
ChannelEditor::SendResult
void SendResult(int result)
Definition: osd.cpp:119
OSD::SetValues
void SetValues(const QString &Window, const QHash< QString, int > &Map, OSDTimeout Timeout)
Definition: osd.cpp:319
mythuibutton.h
MythScreenType::gestureEvent
bool gestureEvent(MythGestureEvent *event) override
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
Definition: mythscreentype.cpp:456
OSD::IsVisible
bool IsVisible(void)
Definition: osd.cpp:249
OSD::m_fontStretch
int m_fontStretch
Definition: osd.h:216
OSD::DialogHandleKeypress
bool DialogHandleKeypress(QKeyEvent *Event)
Definition: osd.cpp:939
OSDFunctionalType
OSDFunctionalType
Definition: osd.h:46
OSD::Init
bool Init(const QRect &Rect, float FontAspect)
Definition: osd.cpp:155
ChannelEditor::GetText
void GetText(InfoMap &Map)
Definition: osd.cpp:87
ChannelEditor::m_channameEdit
MythUITextEdit * m_channameEdit
Definition: osd.h:104
TeletextScreen::KeyPress
bool KeyPress(const QString &key)
Definition: teletextscreen.cpp:230
LOC
#define LOC
Definition: osd.cpp:31
MythGestureEvent
A custom event that represents a mouse gesture.
Definition: mythgesture.h:39
OsdNavigation
Definition: osd.h:224
OSD::m_nextPulseUpdate
QDateTime m_nextPulseUpdate
Definition: osd.h:208
MythCoreContext::GetMasterHostPrefix
QString GetMasterHostPrefix(const QString &storageGroup=QString(), const QString &path=QString())
Definition: mythcorecontext.cpp:801
MythNotificationCenter
Definition: mythnotificationcenter.h:33
OsdNavigation::Create
bool Create(void) override
Definition: osd.cpp:1234
OSDHideEvent
Definition: osd.h:66
MythUIImage::SetFilename
void SetFilename(const QString &filename)
Must be followed by a call to Load() to load the image.
Definition: mythuiimage.cpp:675
GetMythUI
MythUIHelper * GetMythUI()
Definition: mythuihelper.cpp:81
MythUIProgressBar::SetVisible
void SetVisible(bool visible) override
Definition: mythuiprogressbar.cpp:186
OsdNavigation::SetTextFromMap
void SetTextFromMap(const InfoMap &Map) override
Definition: osd.cpp:1379
OsdNavigation::m_muteButton
MythUIButton * m_muteButton
Definition: osd.h:250
mythmainwindow.h
kOSDTimeout_Med
@ kOSDTimeout_Med
Definition: osd.h:62
MythMainWindow::GetUIScreenRect
QRect GetUIScreenRect()
Definition: mythmainwindow.cpp:2252
MythUIType::IsVisible
bool IsVisible(bool recurse=false) const
Definition: mythuitype.cpp:882
ChannelEditor::SetText
void SetText(const InfoMap &Map)
Definition: osd.cpp:75
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
OSD::TeletextReset
void TeletextReset(void)
Definition: osd.cpp:1132
TeletextScreen::ClearScreen
void ClearScreen(void)
Definition: teletextscreen.cpp:62
MythUIHelper::GetScreenSettings
QRect GetScreenSettings(void)
Definition: mythuihelper.cpp:809
OsdNavigation::m_pauseButton
MythUIButton * m_pauseButton
Definition: osd.h:249
SubtitleScreen::ClearAllSubtitles
void ClearAllSubtitles(void)
Definition: subtitlescreen.cpp:1453