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