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