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 
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  foreach(MythScreenType* child, 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 char* s_defaultWindows[7] = {
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 #if QT_VERSION < QT_VERSION_CHECK(5,8,0)
503  int startts = Map["startts"].toInt();
504  int endts = Map["endts"].toInt();
505  int nowts = MythDate::current().toTime_t();
506 #else
507  qint64 startts = Map["startts"].toLongLong();
508  qint64 endts = Map["endts"].toLongLong();
509  qint64 nowts = MythDate::current().toSecsSinceEpoch();
510 #endif
511  if (startts > nowts)
512  {
513  bar->SetUsed(0);
514  }
515  else if (endts < nowts)
516  {
517  bar->SetUsed(1000);
518  }
519  else
520  {
521 #if QT_VERSION < QT_VERSION_CHECK(5,8,0)
522  int duration = endts - startts;
523 #else
524  qint64 duration = endts - startts;
525 #endif
526  if (duration > 0)
527  bar->SetUsed(static_cast<int>(1000 * (nowts - startts) / duration));
528  else
529  bar->SetUsed(0);
530  }
531  bar->SetVisible(startts > 0);
532  bar->SetStart(0);
533  bar->SetTotal(1000);
534  }
535 
536  win->SetVisible(true);
537 
538  if (win == m_dialog)
539  {
540  auto *edit = dynamic_cast<ChannelEditor*>(m_dialog);
541  if (edit)
542  edit->SetText(Map);
543  else
544  win->SetTextFromMap(Map);
545  }
546  else
547  win->SetTextFromMap(Map);
548 
549  SetExpiry(Window, Timeout);
550 }
551 
552 void OSD::SetRegions(const QString &Window, frm_dir_map_t &Map, long long Total)
553 {
554  MythScreenType *win = GetWindow(Window);
555  if (!win)
556  return;
557 
558  MythUIEditBar *bar = dynamic_cast<MythUIEditBar*>(win->GetChild("editbar"));
559  if (!bar)
560  return;
561 
562  bar->ClearRegions();
563  if (Map.empty() || Total < 1)
564  {
565  bar->Display();
566  return;
567  }
568 
569  long long start = -1;
570  long long end = -1;
571  bool first = true;
572  QMapIterator<uint64_t, MarkTypes> it(Map);
573  while (it.hasNext())
574  {
575  bool error = false;
576  it.next();
577  if (it.value() == MARK_CUT_START)
578  {
579  start = static_cast<long long>(it.key());
580  if (end > -1)
581  error = true;
582  }
583  else if (it.value() == MARK_CUT_END)
584  {
585  if (first)
586  start = 0;
587  if (start < 0)
588  error = true;
589  end = static_cast<long long>(it.key());
590  }
591  else if (it.value() == MARK_PLACEHOLDER)
592  {
593  start = end = static_cast<long long>(it.key());
594  }
595  first = false;
596 
597  if (error)
598  {
599  LOG(VB_GENERAL, LOG_ERR, LOC + "deleteMap discontinuity");
600  start = -1;
601  end = -1;
602  }
603 
604  if (start >=0 && end >= 0)
605  {
606  bar->AddRegion((static_cast<double>(start) / static_cast<double>(Total)),
607  (static_cast<double>(end) / static_cast<double>(Total)));
608  start = -1;
609  end = -1;
610  }
611  }
612  if (start > -1 && end < 0)
613  bar->AddRegion(static_cast<double>(start) / static_cast<double>(Total), 1.0);
614 
615  bar->Display();
616 }
617 
618 void OSD::SetGraph(const QString &Window, const QString &Graph, int64_t Timecode)
619 {
620  MythScreenType *win = GetWindow(Window);
621  if (!win)
622  return;
623 
624  auto *image = dynamic_cast<MythUIImage* >(win->GetChild(Graph));
625  if (!image)
626  return;
627 
628  MythImage* mi = m_parent->GetAudioGraph().GetImage(Timecode);
629  if (mi)
630  image->SetImage(mi);
631 }
632 
633 bool OSD::Draw(MythPainter* Painter, QSize Size, bool Repaint)
634 {
635  if (!Painter)
636  return false;
637 
638  bool visible = false;
639  bool redraw = m_refresh;
640  m_refresh = false;
641  QTime now = MythDate::current().time();
642 
643  CheckExpiry();
644  QMap<QString,MythScreenType*>::const_iterator it;
645  for (it = m_children.begin(); it != m_children.end(); ++it)
646  {
647  if ((*it)->IsVisible())
648  {
649  visible = true;
650  (*it)->Pulse();
651  if (m_expireTimes.contains((*it)))
652  {
653  QTime expires = m_expireTimes.value((*it)).time();
654  int left = now.msecsTo(expires);
655  if (left < m_fadeTime)
656  (*it)->SetAlpha((255 * left) / m_fadeTime);
657  }
658  if ((*it)->NeedsRedraw())
659  redraw = true;
660  }
661  }
662 
664  QList<MythScreenType*> notifications;
665  nc->GetNotificationScreens(notifications);
666  QList<MythScreenType*>::iterator it2 = notifications.begin();
667  while (it2 != notifications.end())
668  {
670  {
671  LOG(VB_GUI, LOG_DEBUG, LOC + "Creating OSD Notification");
672 
673  if (!m_uiScaleOverride)
674  {
675  OverrideUIScale(false);
676  }
677  (*it2)->SetPainter(m_currentPainter);
678  if (!(*it2)->Create())
679  {
680  it2 = notifications.erase(it2);
681  continue;
682  }
683  }
684  if ((*it2)->IsVisible())
685  {
686  if (!m_uiScaleOverride)
687  {
688  OverrideUIScale(false);
689  }
690 
691  (*it2)->SetPainter(m_currentPainter);
692 
694 
695  visible = true;
696  (*it2)->Pulse();
697  QTime expires = MythNotificationCenter::ScreenExpiryTime(*it2).time();
698  int left = now.msecsTo(expires);
699  if (left < 0)
700  left = 0;
701  if (expires.isValid() && left < m_fadeTime)
702  (*it2)->SetAlpha((255 * left) / m_fadeTime);
703  if ((*it2)->NeedsRedraw())
704  redraw = true;
705  }
706  ++it2;
707  }
708  RevertUIScale();
709 
710  redraw |= Repaint;
711 
712  if (redraw && visible)
713  {
714  QRect cliprect = QRect(QPoint(0, 0), Size);
715  Painter->Begin(nullptr);
716  for (it = m_children.begin(); it != m_children.end(); ++it)
717  {
718  if ((*it)->IsVisible())
719  {
720  (*it)->Draw(Painter, 0, 0, 255, cliprect);
721  (*it)->SetAlpha(255);
722  (*it)->ResetNeedsRedraw();
723  }
724  }
725  for (it2 = notifications.begin(); it2 != notifications.end(); ++it2)
726  {
727  if ((*it2)->IsVisible())
728  {
729  (*it2)->Draw(Painter, 0, 0, 255, cliprect);
730  (*it2)->SetAlpha(255);
731  (*it2)->ResetNeedsRedraw();
732  }
733  }
734  Painter->End();
735  }
736 
737  // Force a redraw if it just became invisible
738  if (m_visible && !visible)
739  redraw=true;
740  m_visible = visible;
741 
742  return redraw;
743 }
744 
746 {
747  QDateTime now = MythDate::current();
748  QMutableHashIterator<MythScreenType*, QDateTime> it(m_expireTimes);
749  while (it.hasNext())
750  {
751  it.next();
752  if (it.value() < now)
753  {
754  if (it.key() == m_dialog)
755  DialogQuit();
756  else
757  HideWindow(m_children.key(it.key()));
758  }
759  else if (it.key() == m_dialog)
760  {
761  if (!m_pulsedDialogText.isEmpty() && now > m_nextPulseUpdate)
762  {
763  QString newtext = m_pulsedDialogText;
764  auto *dialog = dynamic_cast<MythDialogBox*>(m_dialog);
765  if (dialog)
766  {
767  // The disambiguation string must be an empty string
768  // and not a NULL to get extracted by the Qt tools.
769  QString replace = QCoreApplication::translate("(Common)",
770  "%n second(s)", "",
771  static_cast<int>(now.secsTo(it.value())));
772  dialog->SetText(newtext.replace("%d", replace));
773  }
774  auto *cdialog = dynamic_cast<MythConfirmationDialog*>(m_dialog);
775  if (cdialog)
776  {
777  QString replace = QString::number(now.secsTo(it.value()));
778  cdialog->SetMessage(newtext.replace("%d", replace));
779  }
780  m_nextPulseUpdate = now.addSecs(1);
781  }
782  }
783  }
784 }
785 
786 void OSD::SetExpiry(const QString &Window, enum OSDTimeout Timeout,
787  int CustomTimeout)
788 {
789  SetExpiryPriv(Window, Timeout, CustomTimeout);
790  if (IsWindowVisible(Window))
791  {
792  // Keep status and nav timeouts in sync
793  if (Window == OSD_DLG_NAVIGATE)
794  SetExpiryPriv("osd_status", Timeout, CustomTimeout);
795  else if (Window == "osd_status" && IsWindowVisible(OSD_DLG_NAVIGATE))
796  SetExpiryPriv(OSD_DLG_NAVIGATE, Timeout, CustomTimeout);
797  }
798 }
799 
800 void OSD::SetExpiryPriv(const QString &Window, enum OSDTimeout Timeout, int CustomTimeout)
801 {
802  if (Timeout == kOSDTimeout_Ignore && !CustomTimeout)
803  return;
804 
805  MythScreenType *win = GetWindow(Window);
806  int time = CustomTimeout ? CustomTimeout : m_timeouts[Timeout];
807  if ((time > 0) && win)
808  {
809  QDateTime expires = MythDate::current().addMSecs(time);
810  m_expireTimes.insert(win, expires);
811  }
812  else if ((time < 0) && win)
813  {
814  if (m_expireTimes.contains(win))
815  m_expireTimes.remove(win);
816  }
817 }
818 
819 void OSD::SetTimeouts(int Short, int Medium, int Long)
820 {
822  m_timeouts[kOSDTimeout_Short] = Short;
823  m_timeouts[kOSDTimeout_Med] = Medium;
825 }
826 
827 bool OSD::IsWindowVisible(const QString &Window)
828 {
829  if (!m_children.contains(Window))
830  return false;
831 
832  return m_children.value(Window)->IsVisible(/*true*/);
833 }
834 
835 void OSD::ResetWindow(const QString &Window)
836 {
837  if (!m_children.contains(Window))
838  return;
839 
840  m_children.value(Window)->Reset();
841 }
842 
844 {
845  if (!Window)
846  return;
847 
848  MythRect rect = Window->GetArea();
849  rect.translate(m_rect.left(), m_rect.top());
850  Window->SetArea(rect);
851 }
852 
853 void OSD::RemoveWindow(const QString &Window)
854 {
855  if (!m_children.contains(Window))
856  return;
857 
858  HideWindow(Window);
859  MythScreenType *child = m_children.value(Window);
860  m_children.remove(Window);
861  delete child;
862 }
863 
864 MythScreenType *OSD::GetWindow(const QString &Window)
865 {
866  if (m_children.contains(Window))
867  return m_children.value(Window);
868 
869  MythScreenType *new_window = nullptr;
870 
871  if (Window == OSD_WIN_INTERACT)
872  {
873  new_window = new InteractiveScreen(m_parent, Window);
874  }
875  else if (Window == OSD_WIN_BDOVERLAY)
876  {
877  new_window = new BDOverlayScreen(m_parent, Window);
878  }
879  else
880  {
881  new_window = new MythOSDWindow(nullptr, Window, false);
882  }
883 
884  new_window->SetPainter(m_currentPainter);
885  if (new_window->Create())
886  {
887  m_children.insert(Window, new_window);
888  LOG(VB_PLAYBACK, LOG_INFO, LOC +
889  QString("Created window %1").arg(Window));
890  return new_window;
891  }
892 
893  LOG(VB_GENERAL, LOG_ERR, LOC + QString("Failed to create window %1")
894  .arg(Window));
895  delete new_window;
896  return nullptr;
897 }
898 
899 void OSD::SetFunctionalWindow(const QString &window, enum OSDFunctionalType Type)
900 {
901  if (m_functionalType != kOSDFunctionalType_Default &&
902  m_functionalType != Type)
903  SendHideEvent();
904 
905  m_functionalWindow = window;
906  m_functionalType = Type;
907 }
908 
909 void OSD::HideWindow(const QString &Window)
910 {
911  if (!m_children.contains(Window))
912  return;
913  m_children.value(Window)->SetVisible(false);
914  m_children.value(Window)->Close(); // for InteractiveScreen
915  SetExpiry(Window, kOSDTimeout_None);
916  m_refresh = true;
917 
918  if (m_functionalType != kOSDFunctionalType_Default)
919  {
920  bool valid = m_children.contains(m_functionalWindow);
921  bool visible = valid && m_children.value(m_functionalWindow)->IsVisible(false);
922  if (!valid || !visible)
923  {
924  SendHideEvent();
925  m_functionalType = kOSDFunctionalType_Default;
926  m_functionalWindow = QString();
927  }
928  }
929 }
930 
932 {
933  auto *event = new OSDHideEvent(m_functionalType);
934  QCoreApplication::postEvent(m_parentObject, event);
935 }
936 
937 bool OSD::HasWindow(const QString &Window)
938 {
939  return m_children.contains(Window);
940 }
941 
942 bool OSD::DialogVisible(const QString& Window)
943 {
944  if (!m_dialog || Window.isEmpty())
945  return m_dialog;
946  return m_dialog->objectName() == Window;
947 }
948 
950 {
951  if (!m_dialog)
952  return false;
953  return m_dialog->keyPressEvent(Event);
954 }
955 
957 {
958  if (!m_dialog)
959  return false;
960  return m_dialog->gestureEvent(Event);
961 }
962 
963 void OSD::DialogQuit(void)
964 {
965  if (!m_dialog)
966  return;
967 
968  RemoveWindow(m_dialog->objectName());
969  m_dialog = nullptr;
970  m_pulsedDialogText = QString();
971 }
972 
973 void OSD::DialogShow(const QString &Window, const QString &Text, int UpdateFor)
974 {
975  if (m_dialog)
976  {
977  QString current = m_dialog->objectName();
978  if (current != Window)
979  {
980  DialogQuit();
981  }
982  else
983  {
984  auto *dialog = dynamic_cast<MythDialogBox*>(m_dialog);
985  if (dialog)
986  dialog->Reset();
987 
988  DialogSetText(Text);
989  }
990  }
991 
992  if (!m_dialog)
993  {
994  OverrideUIScale();
995  MythScreenType *dialog = nullptr;
996 
997  if (Window == OSD_DLG_EDITOR)
998  dialog = new ChannelEditor(m_parentObject, Window.toLatin1());
999  else if (Window == OSD_DLG_CONFIRM)
1000  dialog = new MythConfirmationDialog(nullptr, Text, false);
1001  else if (Window == OSD_DLG_NAVIGATE)
1002  dialog = new OsdNavigation(m_parentObject, Window, this);
1003  else
1004  dialog = new MythDialogBox(Text, nullptr, Window.toLatin1(), false, true);
1005 
1006  dialog->SetPainter(m_currentPainter);
1007  if (dialog->Create())
1008  {
1009  PositionWindow(dialog);
1010  m_dialog = dialog;
1011  auto *dbox = dynamic_cast<MythDialogBox*>(m_dialog);
1012  if (dbox)
1013  dbox->SetReturnEvent(m_parentObject, Window);
1014  auto *cbox = dynamic_cast<MythConfirmationDialog*>(m_dialog);
1015  if (cbox)
1016  {
1017  cbox->SetReturnEvent(m_parentObject, Window);
1018  cbox->SetData("DIALOG_CONFIRM_X_X");
1019  }
1020  m_children.insert(Window, m_dialog);
1021  }
1022  else
1023  {
1024  RevertUIScale();
1025  delete dialog;
1026  return;
1027  }
1028 
1029  RevertUIScale();
1030  }
1031 
1032  if (UpdateFor)
1033  {
1035  m_pulsedDialogText = Text;
1036  SetExpiry(Window, kOSDTimeout_None, UpdateFor);
1037  }
1038 
1039  DialogBack();
1040  HideAll(true, m_dialog);
1041  m_dialog->SetVisible(true);
1042 }
1043 
1044 void OSD::DialogSetText(const QString &Text)
1045 {
1046  auto *dialog = dynamic_cast<MythDialogBox*>(m_dialog);
1047  if (dialog)
1048  dialog->SetText(Text);
1049 }
1050 
1051 void OSD::DialogBack(const QString& Text, const QVariant& Data, bool Exit)
1052 {
1053  auto *dialog = dynamic_cast<MythDialogBox*>(m_dialog);
1054  if (dialog)
1055  {
1056  dialog->SetBackAction(Text, Data);
1057  if (Exit)
1058  dialog->SetExitAction(Text, Data);
1059  }
1060 }
1061 
1062 void OSD::DialogAddButton(const QString& Text, QVariant Data, bool Menu, bool Current)
1063 {
1064  auto *dialog = dynamic_cast<MythDialogBox*>(m_dialog);
1065  if (dialog)
1066  dialog->AddButton(Text, std::move(Data), Menu, Current);
1067 }
1068 
1070 {
1071  auto *edit = dynamic_cast<ChannelEditor*>(m_dialog);
1072  if (edit)
1073  edit->GetText(Map);
1074 }
1075 
1077 {
1078  TeletextScreen *tt = nullptr;
1079  if (m_children.contains(OSD_WIN_TELETEXT))
1080  {
1081  tt = dynamic_cast<TeletextScreen*>(m_children.value(OSD_WIN_TELETEXT));
1082  }
1083  else
1084  {
1085  OverrideUIScale();
1087 
1089  if (tt->Create())
1090  {
1091  m_children.insert(OSD_WIN_TELETEXT, tt);
1092  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Created window %1")
1093  .arg(OSD_WIN_TELETEXT));
1094  }
1095  else
1096  {
1097  delete tt;
1098  tt = nullptr;
1099  }
1100  RevertUIScale();
1101  }
1102  if (!tt)
1103  {
1104  LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to create Teletext window");
1105  return nullptr;
1106  }
1107 
1109  tt->SetDisplaying(false);
1110  return tt;
1111 }
1112 
1113 void OSD::EnableTeletext(bool Enable, int Page)
1114 {
1115  TeletextScreen *tt = InitTeletext();
1116  if (!tt)
1117  return;
1118 
1119  tt->SetVisible(Enable);
1120  tt->SetDisplaying(Enable);
1121  if (Enable)
1122  {
1123  tt->SetPage(Page, -1);
1124  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Enabled teletext page %1")
1125  .arg(Page));
1126  }
1127  else
1128  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Disabled teletext");
1129 }
1130 
1131 bool OSD::TeletextAction(const QString &Action)
1132 {
1134  return false;
1135 
1136  TeletextScreen* tt = dynamic_cast<TeletextScreen*>(m_children.value(OSD_WIN_TELETEXT));
1137  if (tt)
1138  return tt->KeyPress(Action);
1139  return false;
1140 }
1141 
1143 {
1145  return;
1146 
1147  TeletextScreen* tt = InitTeletext();
1148  if (tt)
1149  tt->Reset();
1150 }
1151 
1153 {
1155  return;
1156 
1157  TeletextScreen* tt = dynamic_cast<TeletextScreen*>(m_children.value(OSD_WIN_TELETEXT));
1158  if (tt)
1159  tt->ClearScreen();
1160 }
1161 
1163 {
1164  SubtitleScreen *sub = nullptr;
1165  if (m_children.contains(OSD_WIN_SUBTITLE))
1166  {
1167  sub = dynamic_cast<SubtitleScreen*>(m_children.value(OSD_WIN_SUBTITLE));
1168  }
1169  else
1170  {
1171  OverrideUIScale();
1174  if (sub->Create())
1175  {
1176  m_children.insert(OSD_WIN_SUBTITLE, sub);
1177  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Created window %1")
1178  .arg(OSD_WIN_SUBTITLE));
1179  }
1180  else
1181  {
1182  delete sub;
1183  sub = nullptr;
1184  }
1185  RevertUIScale();
1186  }
1187  if (!sub)
1188  {
1189  LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to create subtitle window");
1190  return nullptr;
1191  }
1192  return sub;
1193 }
1194 
1195 void OSD::EnableSubtitles(int Type, bool ForcedOnly)
1196 {
1197  SubtitleScreen *sub = InitSubtitles();
1198  if (sub)
1199  sub->EnableSubtitles(Type, ForcedOnly);
1200 }
1201 
1203 {
1205  return;
1206 
1207  SubtitleScreen *sub = InitSubtitles();
1208  sub->DisableForcedSubtitles();
1209 }
1210 
1212 {
1214  return;
1215 
1216  SubtitleScreen* sub = InitSubtitles();
1217  if (sub)
1218  sub->ClearAllSubtitles();
1219 }
1220 
1221 void OSD::DisplayDVDButton(AVSubtitle* DVDButton, QRect &Pos)
1222 {
1223  if (!DVDButton)
1224  return;
1225 
1226  SubtitleScreen* sub = InitSubtitles();
1227  if (sub)
1228  {
1230  sub->DisplayDVDButton(DVDButton, Pos);
1231  }
1232 }
1233 
1235 {
1236  if (!Overlay)
1237  return;
1238 
1239  BDOverlayScreen* bd = dynamic_cast<BDOverlayScreen*>(GetWindow(OSD_WIN_BDOVERLAY));
1240  if (bd)
1241  bd->DisplayBDOverlay(Overlay);
1242 }
1243 
1245 {
1246  if (!XMLParseBase::LoadWindowFromXML("osd.xml", "osd_navigation", this))
1247  return false;
1248 
1249  MythUIButton *moreButton = nullptr;
1250  UIUtilW::Assign(this, moreButton, "more");
1251  if (moreButton)
1252  connect(moreButton, SIGNAL(Clicked()), SLOT(More()));
1253  UIUtilW::Assign(this, m_pauseButton, "PAUSE");
1254  UIUtilW::Assign(this, m_playButton, "PLAY");
1255  UIUtilW::Assign(this, m_muteButton, "MUTE");
1256  UIUtilW::Assign(this, m_unMuteButton, "unmute");
1257 
1258  MythPlayer *player = m_osd->GetPlayer();
1259 
1260  if (!player || !player->HasAudioOut() ||
1261  !player->PlayerControlsVolume())
1262  {
1263  m_isVolumeControl = false;
1264  if (m_muteButton)
1265  m_muteButton->Hide();
1266  if (m_unMuteButton)
1267  m_unMuteButton->Hide();
1268  }
1269 
1270  // find number of groups and make sure only corrrect one is visible
1271  MythUIGroup *group = nullptr;
1272  for (int i = 0; i < 100 ; i++)
1273  {
1274  UIUtilW::Assign(this, group, QString("grp%1").arg(i));
1275  if (group)
1276  {
1277  m_maxGroupNum = i;
1278  if (i != m_visibleGroup)
1279  group->SetVisible (false);
1280  QList<MythUIType *> * children = group->GetAllChildren();
1281  QList<MythUIType *>::iterator it;
1282  for (it = children->begin(); it != children->end(); ++it)
1283  {
1284  MythUIType *child = *it;
1285  if (child == moreButton)
1286  continue;
1287  connect(child, SIGNAL(Clicked()), SLOT(GeneralAction()));
1288  }
1289  }
1290  else
1291  break;
1292  }
1293 
1294  BuildFocusList();
1295 
1296  return true;
1297 }
1298 
1300 {
1301  // bool extendTimeout = (m_paused != 'Y');
1302  bool extendTimeout = true;
1303  bool handled = false;
1304 
1305  MythUIType *focus = GetFocusWidget();
1306  if (focus && focus->keyPressEvent(Event))
1307  handled = true;
1308 
1309  if (!handled)
1310  {
1311  QStringList actions;
1312  handled = GetMythMainWindow()->TranslateKeyPress("qt", Event, actions);
1313 
1314  for (int i = 0; i < actions.size() && !handled; i++)
1315  {
1316  QString action = actions[i];
1317  if (action == "ESCAPE" )
1318  {
1319  SendResult(-1,action);
1320  handled = true;
1321  extendTimeout = false;
1322  }
1323  }
1324  }
1325  if (!handled && MythScreenType::keyPressEvent(Event))
1326  handled = true;
1327 
1328  if (extendTimeout)
1329  {
1331  // m_osd->SetExpiry("osd_status", kOSDTimeout_Long);
1332  }
1333 
1334  return handled;
1335 }
1336 
1337 // Virtual
1339 {
1340  SendResult(100,"MENU");
1341 }
1342 
1343 void OsdNavigation::SendResult(int Result, const QString& Action)
1344 {
1345  if (!m_retObject)
1346  return;
1347 
1348  auto *dce = new DialogCompletionEvent("", Result, "", Action);
1349  QCoreApplication::postEvent(m_retObject, dce);
1350 }
1351 
1353 {
1354  MythUIType *fw = GetFocusWidget();
1355  if (fw)
1356  {
1357  QString nameClicked = fw->objectName();
1358  int result = 100;
1359  int hashPos = nameClicked.indexOf('#');
1360  if (hashPos > -1)
1361  nameClicked.truncate(hashPos);
1362  if (nameClicked == "INFO")
1363  result=0;
1364  if (nameClicked == "unmute")
1365  nameClicked = "MUTE";
1366  SendResult(result, nameClicked);
1367  }
1368 }
1369 
1370 // Switch to next group of icons. They have to be
1371 // named grp0, grp1, etc with no gaps in numbers.
1373 {
1374  if (m_maxGroupNum <= 0)
1375  return;
1376 
1377  MythUIGroup *group = nullptr;
1378  UIUtilW::Assign(this, group, QString("grp%1").arg(m_visibleGroup));
1379  group->SetVisible (false);
1380 
1381  // wrap around after last group displayed
1382  if (++m_visibleGroup > m_maxGroupNum)
1383  m_visibleGroup = 0;
1384 
1385  UIUtilW::Assign(this, group, QString("grp%1").arg(m_visibleGroup));
1386  group->SetVisible (true);
1387 }
1388 
1390 {
1391 
1392  char paused = Map.value("paused", "X").toLocal8Bit().at(0);
1393  if (paused != 'X')
1394  {
1395  if (m_playButton && m_pauseButton && paused != m_paused)
1396  {
1397  MythUIType *fw = GetFocusWidget();
1398  m_playButton->SetVisible(paused=='Y');
1399  m_pauseButton->SetVisible(paused!='Y');
1400  if (fw && (fw == m_playButton || fw == m_pauseButton))
1401  {
1402  fw->LoseFocus();
1403  MythUIType *newfw = (paused=='Y' ? m_playButton : m_pauseButton);
1404  SetFocusWidget(newfw);
1405  if (m_paused == 'X')
1406  newfw->TakeFocus();
1407  }
1408  m_paused = paused;
1409  }
1410  }
1411 
1412  char muted = Map.value("muted","X").toLocal8Bit().at(0);
1413  if (m_isVolumeControl && muted != 'X')
1414  {
1415  if (m_muteButton && m_unMuteButton && muted != m_muted)
1416  {
1417  MythUIType *fw = GetFocusWidget();
1418  m_muteButton->SetVisible(muted!='Y');
1419  m_unMuteButton->SetVisible(muted=='Y');
1420  m_muted = muted;
1421  if (fw && (fw == m_muteButton || fw == m_unMuteButton))
1422  {
1423  fw->LoseFocus();
1424  SetFocusWidget(muted=='Y' ? m_unMuteButton : m_muteButton);
1425  }
1426  }
1427  }
1428 
1430 }
bool m_visible
Definition: osd.h:210
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:194
void DisplayBDOverlay(BDOverlay *Overlay)
Definition: osd.cpp:1234
bool m_isVolumeControl
Definition: osd.h:256
const AudioOutputGraph & GetAudioGraph() const
Definition: mythplayer.h:226
void SetFontStretch(int stretch)
void SetUsed(int value)
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:1076
int m_visibleGroup
Definition: osd.h:254
virtual bool keyPressEvent(QKeyEvent *event)
Key event handler.
Definition: mythuitype.cpp:972
bool TranslateKeyPress(const QString &context, QKeyEvent *e, QStringList &actions, bool allowJumps=true)
Get a list of actions for a keypress in the given context.
void SendHideEvent(void)
Definition: osd.cpp:931
bool HasWindow(const QString &Window)
Definition: osd.cpp:937
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:1142
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
QRect GetScreenSettings(void)
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:882
MythUITextEdit * m_channumEdit
Definition: osd.h:103
void SetTextFromMap(const InfoMap &Map) override
Definition: osd.cpp:1389
void TearDown(void)
Definition: osd.cpp:147
void OverrideUIScale(bool Log=true)
Definition: osd.cpp:191
void RevertUIScale(void)
Definition: osd.cpp:216
void EnableSubtitles(int Type, bool ForcedOnly=false)
Definition: osd.cpp:1195
virtual bool Create(void)
void LoseFocus()
bool TeletextAction(const QString &Action)
Definition: osd.cpp:1131
Basic menu dialog, message and a list of options.
void ClearSubtitles(void)
Definition: osd.cpp:1211
bool IsVisible(void)
Definition: osd.cpp:249
void DialogQuit(void)
Definition: osd.cpp:963
QSize GetBaseSize(void) const
bool IsWindowVisible(const QString &Window)
Definition: osd.cpp:827
QObject * m_retObject
Definition: osd.h:246
virtual void SetText(const QString &text)
Definition: mythuitext.cpp:135
void SetDisplaying(bool display)
QRect m_savedUIRect
Definition: osd.h:215
#define OSD_WIN_INTERACT
Definition: osd.h:35
void EnableSubtitles(int type, bool forced_only=false)
void RemoveWindow(const QString &Window)
Definition: osd.cpp:853
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
MythScreenType * m_dialog
Definition: osd.h:206
void SetExpiryPriv(const QString &Window, enum OSDTimeout Timeout, int CustomTimeout)
Definition: osd.cpp:800
void GeneralAction(void)
Definition: osd.cpp:1352
void ShowMenu(void) override
Definition: osd.cpp:1338
void SetExpiry(const QString &Window, enum OSDTimeout Timeout, int CustomTimeout=0)
Definition: osd.cpp:786
void DialogBack(const QString &Text="", const QVariant &Data=0, bool Exit=false)
Definition: osd.cpp:1051
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:835
void EnableTeletext(bool Enable, int Page)
Definition: osd.cpp:1113
QString m_functionalWindow
Definition: osd.h:219
void SetGraph(const QString &Window, const QString &Graph, int64_t Timecode)
Definition: osd.cpp:618
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:40
bool m_refresh
Definition: osd.h:209
virtual void End()
Definition: mythpainter.h:51
void Hide(void)
OSDTimeout
Definition: osd.h:57
void SetStart(int value)
void SetScalingFactors(float wmult, float hmult)
virtual void SetVisible(bool visible)
void DisableForcedSubtitles(void)
bool DialogHandleGesture(MythGestureEvent *Event)
Definition: osd.cpp:956
void SetText(const QString &Window, const InfoMap &Map, OSDTimeout Timeout)
Definition: osd.cpp:377
void HideWindow(const QString &Window)
Definition: osd.cpp:909
SubtitleScreen * InitSubtitles(void)
Definition: osd.cpp:1162
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:864
int m_savedFontStretch
Definition: osd.h:217
QMap< QString, MythScreenType * > m_children
Definition: osd.h:220
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...
void DisableForcedSubtitles(void)
Definition: osd.cpp:1202
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
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
void TeletextClear(void)
Definition: osd.cpp:1152
void More(void)
Definition: osd.cpp:1372
#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:1062
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:745
void SetTotal(int value)
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:552
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
QString m_pulsedDialogText
Definition: osd.h:207
#define OSD_WIN_TELETEXT
Definition: osd.h:32
bool Draw(MythPainter *Painter, QSize Size, bool Repaint=false)
Definition: osd.cpp:633
void DialogSetText(const QString &Text)
Definition: osd.cpp:1044
bool PlayerControlsVolume(void) const
Definition: mythplayer.h:263
void HideAll(bool KeepSubs=true, MythScreenType *Except=nullptr, bool DropNotification=false)
Definition: osd.cpp:267
MythPlayer * m_parent
Definition: osd.h:201
int m_timeouts[4]
Definition: osd.h:211
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
A single button widget.
Definition: mythuibutton.h:21
MythMainWindow * GetMythMainWindow(void)
bool keyPressEvent(QKeyEvent *Event) override
Key event handler.
Definition: osd.cpp:1299
MythUITextEdit * m_callsignEdit
Definition: osd.h:102
float m_savedHMult
Definition: osd.h:214
void SetValues(const QString &Window, const QHash< QString, int > &Map, OSDTimeout Timeout)
Definition: osd.cpp:319
QHash< MythScreenType *, QDateTime > m_expireTimes
Definition: osd.h:221
void LoadWindows(void)
Definition: osd.cpp:292
void ClearScreen(void)
virtual void SetArea(const MythRect &rect)
Definition: mythuitype.cpp:589
bool gestureEvent(MythGestureEvent *event) override
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
void SetFunctionalWindow(const QString &Window, enum OSDFunctionalType Type)
Definition: osd.cpp:899
void SetUIScreenRect(QRect &rect)
int m_fadeTime
Definition: osd.h:205
MythPainter * m_currentPainter
Definition: osd.h:203
bool Create(void) override
#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:973
char m_paused
Definition: osd.h:252
void DialogGetText(InfoMap &Map)
Definition: osd.cpp:1069
void PositionWindow(MythScreenType *Window)
Definition: osd.cpp:843
bool HasAudioOut(void) const
Definition: mythplayer.h:259
#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.
void SendResult(int result)
Definition: osd.cpp:119
static Type kEventType
Definition: osd.h:75
Event details.
Definition: zmdefines.h:26
MythImage * GetImage(int64_t timecode) const
bool DialogHandleKeypress(QKeyEvent *Event)
Definition: osd.cpp:949
bool Create(void) override
Definition: osd.cpp:1244
QRect m_rect
Definition: osd.h:204
void SendResult(int Result, const QString &Action)
Definition: osd.cpp:1343
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())
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)
QObject * m_parentObject
Definition: osd.h:202
float m_savedWMult
Definition: osd.h:213
void DisplayDVDButton(AVSubtitle *DVDButton, QRect &Pos)
Definition: osd.cpp:1221
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
Definition: programtypes.h:81
bool m_uiScaleOverride
Definition: osd.h:212
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:41
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
Definition: mythuitype.cpp:130
void SetEditPosition(double position)
void ClearRegions(void)
char m_muted
Definition: osd.h:253
#define LOC
Definition: osd.cpp:31
QDateTime m_nextPulseUpdate
Definition: osd.h:208
A narrow purpose widget used to represent cut positions and regions when editing a video.
Definition: mythuieditbar.h:16
bool DialogVisible(const QString &Window=QString())
Definition: osd.cpp:942
void SetTimeouts(int Short, int Medium, int Long)
Definition: osd.cpp:819
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:227