MythTV  master
myththemedmenu.cpp
Go to the documentation of this file.
1 
2 #include "myththemedmenu.h"
3 
4 // QT headers
5 #include <QCoreApplication>
6 #include <QDir>
7 #include <QKeyEvent>
8 #include <QDomDocument>
9 #include <QFile>
10 #include <QFileInfo>
11 #include <QTextStream>
12 
13 // libmythbase headers
14 #include "libmythbase/lcddevice.h"
17 #include "libmythbase/mythdate.h"
18 #include "libmythbase/mythdb.h"
19 #include "libmythbase/mythdirs.h"
21 #include "libmythbase/mythmedia.h"
22 #include "libmythbase/mythplugin.h"
24 #include "libmythbase/mythversion.h"
25 
26 // libmythui headers
27 #include "mythmainwindow.h"
28 #include "mythdialogbox.h"
29 #include "mythgesture.h"
30 #include "mythuitext.h"
31 #include "mythuistatetype.h"
32 #include "xmlparsebase.h"
33 #include "mythuihelper.h"
34 
36 {
37  if (!LoadWindowFromXML("menu-ui.xml", "mainmenu", this))
38  return false;
39 
40  m_titleState = dynamic_cast<MythUIStateType *> (GetChild("titles"));
41  m_watermarkState = dynamic_cast<MythUIStateType *> (GetChild("watermarks"));
42  m_buttonList = dynamic_cast<MythUIButtonList *> (GetChild("menu"));
43  m_descriptionText = dynamic_cast<MythUIText *> (GetChild("description"));
44 
45  if (!m_buttonList)
46  {
47  LOG(VB_GENERAL, LOG_ERR, "Missing 'menu' buttonlist.");
48  return false;
49  }
50 
51  m_loaded = true;
52 
53  return true;
54 }
55 
57 {
58  auto *st = dynamic_cast<MythThemedMenuState *>(base);
59  if (!st)
60  {
61  LOG(VB_GENERAL, LOG_INFO, "ERROR, bad parsing");
62  return;
63  }
64 
65  m_loaded = st->m_loaded;
66 
68 
69  m_titleState = dynamic_cast<MythUIStateType *> (GetChild("titles"));
70  m_watermarkState = dynamic_cast<MythUIStateType *> (GetChild("watermarks"));
71  m_buttonList = dynamic_cast<MythUIButtonList *> (GetChild("menu"));
72  m_descriptionText = dynamic_cast<MythUIText *> (GetChild("description"));
73 }
74 
76 
90 MythThemedMenu::MythThemedMenu(const QString &/*cdir*/, const QString &menufile,
91  MythScreenStack *parent, const QString &name,
92  bool /*allowreorder*/, MythThemedMenuState *state)
93  : MythThemedMenuState(parent, name), m_state(state)
94 {
95  if (!m_state)
96  {
97  m_state = new MythThemedMenuState(parent, "themedmenustate");
98  m_allocedstate = true;
99  }
100 
101  SetMenuTheme(menufile);
102 }
103 
111 void MythThemedMenu::SetMenuTheme(const QString &menufile)
112 {
113  if (!m_state->m_loaded)
114  {
115  if (m_state->Create())
116  m_foundtheme = true;
117  }
118  else
119  {
120  m_foundtheme = true;
121  }
122 
123  if (!m_foundtheme)
124  return;
125 
126  CopyFrom(m_state);
127 
131  this, qOverload<MythUIButtonListItem*>(&MythThemedMenu::buttonAction));
132 
133  if (!parseMenu(menufile))
134  m_foundtheme = false;
135 }
136 
138 {
139  if (m_allocedstate)
140  delete m_state;
141 }
142 
146 {
147  return m_foundtheme;
148 }
149 
151 void MythThemedMenu::getCallback(void (**lcallback)(void *, QString &),
152  void **data)
153 {
154  *lcallback = m_state->m_callback;
155  *data = m_state->m_callbackdata;
156 }
157 
159 void MythThemedMenu::setCallback(void (*lcallback)(void *, QString &),
160  void *data)
161 {
162  m_state->m_callback = lcallback;
163  m_state->m_callbackdata = data;
164 }
165 
167 {
168  m_state->m_killable = true;
169 }
170 
172 {
173  return m_selection;
174 }
175 
177 {
178  auto button = item->GetData().value<ThemedButton>();
179  if (m_watermarkState)
180  {
181  if (!(m_watermarkState->DisplayState(button.type)))
183  }
184 
185  if (m_descriptionText)
186  m_descriptionText->SetText(button.description);
187 }
188 
194 bool MythThemedMenu::keyPressEvent(QKeyEvent *event)
195 {
196  if (m_ignorekeys)
197  return false;
198 
199  m_ignorekeys = true;
200 
202  if (type && type->keyPressEvent(event))
203  {
204  m_ignorekeys = false;
205  return true;
206  }
207 
208  QStringList actions;
209  bool handled = false;
210 
211  handled = GetMythMainWindow()->TranslateKeyPress("Main Menu", event,
212  actions);
213 
214  for (int i = 0; i < actions.size() && !handled; i++)
215  {
216  const QString& action = actions[i];
217  handled = true;
218 
219  if (action == "ESCAPE" ||
220  action == "EXIT" ||
221  action == "EXITPROMPT" ||
222  action == "STANDBYMODE")
223  {
224  bool callbacks = m_state->m_callback;
225  bool lastScreen = (GetMythMainWindow()->GetMainStack()
226  ->TotalScreens() == 1);
227  QString menuaction = "UPMENU";
228  QString selExit = "EXITING_APP_PROMPT";
229 
230  if (action == "EXIT")
231  selExit = "EXITING_APP";
232  else if (action == "STANDBYMODE")
233  selExit = "STANDBY_MODE";
234 
235  if (!m_allocedstate)
236  handleAction(menuaction);
237  else if (m_state->m_killable)
238  {
239  m_wantpop = true;
240  if (callbacks)
241  {
242  QString sel = "EXITING_MENU";
244  }
245 
246  if (lastScreen)
247  {
248  if (callbacks)
250  QCoreApplication::exit();
251  }
252  }
253  else if ((action == "EXIT" || action == "EXITPROMPT" ||
254  action == "STANDBYMODE" ||
255  (action == "ESCAPE" &&
256  (QCoreApplication::applicationName() ==
257  MYTH_APPNAME_MYTHTV_SETUP))) && lastScreen)
258  {
259  if (callbacks)
261  else
262  {
263  QCoreApplication::exit();
264  m_wantpop = true;
265  }
266  }
267  }
268  else if (action == "HELP")
269  {
270  aboutScreen();
271  }
272  else if (action == "EJECT")
273  {
275  }
276  else
277  {
278  handled = false;
279  }
280  }
281 
282  if (!handled && MythScreenType::keyPressEvent(event))
283  handled = true;
284 
285  m_ignorekeys = false;
286 
287  if (m_wantpop)
289 
290  return handled;
291 }
292 
294 {
297 }
298 
300 {
301  if (m_menuPopup)
302  return;
303 
304  int override_menu = GetMythDB()->GetNumSetting("OverrideExitMenu");
305  QString label = tr("System Menu");
307  m_menuPopup = new MythDialogBox(label, mainStack, "menuPopup");
308 
309  if (m_menuPopup->Create())
310  mainStack->AddScreen(m_menuPopup);
311 
312  m_menuPopup->SetReturnEvent(this, "popmenu");
313 
314  // HACK Implement a better check for this
315  if (QCoreApplication::applicationName() == MYTH_APPNAME_MYTHFRONTEND)
316  m_menuPopup->AddButtonV(tr("Enter standby mode"), QVariant("standby"));
317 
318  // don't show the exit application option if standby option is enabled
319  if (override_menu != 7)
320  m_menuPopup->AddButtonV(tr("Exit application"), QVariant("exit"));
321 
322  switch (override_menu)
323  {
324  case 2:
325  case 4:
326  // shutdown
327  m_menuPopup->AddButtonV(tr("Shutdown"), QVariant("shutdown"));
328  break;
329  case 5:
330  // reboot
331  m_menuPopup->AddButtonV(tr("Reboot"), QVariant("reboot"));
332  break;
333  case 3:
334  case 6:
335  // both
336  m_menuPopup->AddButtonV(tr("Shutdown"), QVariant("shutdown"));
337  m_menuPopup->AddButtonV(tr("Reboot"), QVariant("reboot"));
338  break;
339  case 0:
340  case 7:
341  default:
342  break;
343  }
344 
345  m_menuPopup->AddButtonV(tr("About"), QVariant("about"));
346 }
347 
349 {
350  QString distro_line;
351 
352  QFile file("/etc/os_myth_release");
353  if (file.open(QFile::ReadOnly))
354  {
355  QTextStream t( &file ); // use a text stream
356  distro_line = t.readLine();
357  file.close();
358  }
359 
360  QString label = tr("Revision: %1\n Branch: %2\n %3")
361  .arg(GetMythSourceVersion(),
363  distro_line);
364 
366  m_menuPopup = new MythDialogBox(label, mainStack, "version_dialog");
367  if (m_menuPopup->Create())
368  mainStack->AddScreen(m_menuPopup);
369 
370  m_menuPopup->SetReturnEvent(this, "version");
371  m_menuPopup->AddButton(tr("Ok"));
372 
373 }
374 
375 void MythThemedMenu::customEvent(QEvent *event)
376 {
377  if (event->type() == DialogCompletionEvent::kEventType)
378  {
379  auto *dce = (DialogCompletionEvent*)(event);
380 
381  QString resultid = dce->GetId();
382  //int buttonnum = dce->GetResult();
383  QString halt_cmd = GetMythDB()->GetSetting("HaltCommand");
384  QString reboot_cmd = GetMythDB()->GetSetting("RebootCommand");
385 
386  if (resultid == "popmenu")
387  {
388  QString action = dce->GetData().toString();
389  if (action == "shutdown")
390  {
391  if (!halt_cmd.isEmpty())
392  myth_system(halt_cmd);
393  }
394  else if (action == "reboot")
395  {
396  if (!reboot_cmd.isEmpty())
397  myth_system(reboot_cmd);
398  }
399  else if (action == "about")
400  {
401  aboutScreen();
402  }
403  else if (action == "standby")
404  {
405  QString arg("standby_mode");
407  }
408  else if (action == "exit")
409  {
410  QString arg("exiting_app");
412  }
413  }
414  else if (resultid == "password")
415  {
416  QString text = dce->GetResultText();
418  auto button = item->GetData().value<ThemedButton>();
419  QString password = GetMythDB()->GetSetting(button.password);
420  if (text == password)
421  {
422  QString timestamp_setting = QString("%1Time").arg(button.password);
423  QDateTime curr_time = MythDate::current();
424  QString last_time_stamp =
426  GetMythDB()->SaveSetting(timestamp_setting, last_time_stamp);
427  buttonAction(item, true);
428  }
429  }
430 
431  m_menuPopup = nullptr;
432  }
433 }
434 
440 void MythThemedMenu::parseThemeButton(QDomElement &element)
441 {
442  QString type;
443  QString text;
444  QStringList action;
445  QString alttext;
446  QString description;
447  QString password;
448 
449  bool addit = true;
450 
451  for (QDomNode child = element.firstChild(); !child.isNull();
452  child = child.nextSibling())
453  {
454  QDomElement info = child.toElement();
455  if (!info.isNull())
456  {
457  if (info.tagName() == "type")
458  {
460  }
461  else if (info.tagName() == "text")
462  {
463  if (text.isEmpty() &&
464  info.attribute("lang","").isEmpty())
465  {
466  text = QCoreApplication::translate("ThemeUI",
467  parseText(info).toUtf8() );
468  }
469  else if ((info.attribute("lang","").toLower() ==
471  (info.attribute("lang","").toLower() ==
473  {
474  text = parseText(info);
475  }
476  }
477  else if (info.tagName() == "alttext")
478  {
479  if (alttext.isEmpty() &&
480  info.attribute("lang","").isEmpty())
481  {
482  alttext = QCoreApplication::translate("ThemeUI",
483  parseText(info).toUtf8());
484  }
485  else if ((info.attribute("lang","").toLower() ==
487  (info.attribute("lang","").toLower() ==
489  {
490  alttext = parseText(info);
491  }
492  }
493  else if (info.tagName() == "action")
494  {
496  }
497  else if (info.tagName() == "depends")
498  {
499  addit = findDepends(getFirstText(info));
500  }
501  else if (info.tagName() == "dependsexec")
502  {
504  }
505  else if (info.tagName() == "dependssetting")
506  {
507  addit = GetMythDB()->GetBoolSetting(getFirstText(info));
508  }
509  else if (info.tagName() == "dependjumppoint")
510  {
512  getFirstText(info));
513  }
514  else if (info.tagName() == "dependswindow")
515  {
516  QString xmlFile = info.attribute("xmlfile", "");
517  QString windowName = getFirstText(info);
518  if (xmlFile.isEmpty() || windowName.isEmpty())
519  addit = false;
520  else
521  addit = XMLParseBase::WindowExists(xmlFile, windowName);
522  }
523  else if (info.tagName() == "description")
524  {
525  if (description.isEmpty() &&
526  info.attribute("lang","").isEmpty())
527  {
528  description = QCoreApplication::translate("ThemeUI",
529  getFirstText(info).toUtf8());
530  }
531  else if ((info.attribute("lang","").toLower() ==
533  (info.attribute("lang","").toLower() ==
535  {
536  description = getFirstText(info);
537  }
538  }
539  else if (info.tagName() == "password")
540  {
541  password = getFirstText(info);
542  }
543  else
544  {
545  LOG(VB_GENERAL, LOG_ERR,
546  QString("MythThemedMenu: Unknown tag %1 in button")
547  .arg(info.tagName()));
548  }
549  }
550  }
551 
552  if (text.isEmpty())
553  {
554  LOG(VB_GENERAL, LOG_ERR, "MythThemedMenu: Missing 'text' in button");
555  return;
556  }
557 
558  if (action.empty())
559  {
560  LOG(VB_GENERAL, LOG_ERR, "MythThemedMenu: Missing 'action' in button");
561  return;
562  }
563 
564  if (addit)
565  addButton(type, text, alttext, action, description, password);
566 }
567 
581 bool MythThemedMenu::parseMenu(const QString &menuname)
582 {
583  QString filename = findMenuFile(menuname);
584 
585  QDomDocument doc;
586  QFile f(filename);
587 
588  if (!f.exists() || !f.open(QIODevice::ReadOnly))
589  {
590  LOG(VB_GENERAL, LOG_ERR, QString("MythThemedMenu: Couldn't read "
591  "menu file %1").arg(menuname));
592 
593  if (menuname != "mainmenu.xml")
594  ShowOkPopup(tr("MythTV could not locate the menu file %1")
595  .arg(menuname));
596  return false;
597  }
598 
599 #if QT_VERSION < QT_VERSION_CHECK(6,5,0)
600  QString errorMsg;
601  int errorLine = 0;
602  int errorColumn = 0;
603 
604  if (!doc.setContent(&f, false, &errorMsg, &errorLine, &errorColumn))
605  {
606  LOG(VB_GENERAL, LOG_ERR,
607  QString("Error parsing: %1\nat line: %2 column: %3 msg: %4").
608  arg(filename).arg(errorLine).arg(errorColumn).arg(errorMsg));
609  f.close();
610 
611  if (menuname != "mainmenu.xml")
612  ShowOkPopup(tr("The menu file %1 is incomplete.")
613  .arg(menuname));
614  return false;
615  }
616 #else
617  auto parseResult = doc.setContent(&f);
618  if (!parseResult)
619  {
620  LOG(VB_GENERAL, LOG_ERR,
621  QString("Error parsing: %1\nat line: %2 column: %3 msg: %4")
622  .arg(filename).arg(parseResult.errorLine)
623  .arg(parseResult.errorColumn).arg(parseResult.errorMessage));
624  f.close();
625 
626  if (menuname != "mainmenu.xml")
627  ShowOkPopup(tr("The menu file %1 is incomplete.")
628  .arg(menuname));
629  return false;
630  }
631 #endif
632 
633  f.close();
634 
635  LOG(VB_GUI, LOG_INFO, QString("Loading menu theme from %1").arg(filename));
636 
637  QDomElement docElem = doc.documentElement();
638 
639  m_menumode = docElem.attribute("name", "MAIN");
640 
641  QDomNode n = docElem.firstChild();
642  while (!n.isNull())
643  {
644  QDomElement e = n.toElement();
645  if (!e.isNull())
646  {
647  if (e.tagName() == "button")
648  {
649  parseThemeButton(e);
650  }
651  else
652  {
653  LOG(VB_GENERAL, LOG_ERR,
654  QString("MythThemedMenu: Unknown element %1")
655  .arg(e.tagName()));
656  return false;
657  }
658  }
659  n = n.nextSibling();
660  }
661 
662  if (m_buttonList->GetCount() == 0)
663  {
664  LOG(VB_GENERAL, LOG_ERR,
665  QString("MythThemedMenu: No buttons for menu %1").arg(menuname));
666  return false;
667  }
668 
670 
671  if (m_titleState)
672  {
675  }
676 
677  m_selection.clear();
678  return true;
679 }
680 
697 void MythThemedMenu::addButton(const QString &type, const QString &text,
698  const QString &alttext,
699  const QStringList &action,
700  const QString &description,
701  const QString &password)
702 {
703  ThemedButton newbutton;
704  newbutton.type = type;
705  newbutton.action = action;
706  newbutton.text = text;
707  newbutton.alttext = alttext;
708  newbutton.description = description;
709  newbutton.password = password;
710 
711  if (m_watermarkState)
713 
714  auto *listbuttonitem = new MythUIButtonListItem(m_buttonList, text,
715  QVariant::fromValue(newbutton));
716 
717  listbuttonitem->DisplayState(type, "icon");
718  listbuttonitem->SetText(description, "description");
719 }
720 
722 {
723  auto button = item->GetData().value<ThemedButton>();
724 
725  QString password;
726  if (!skipPass)
727  password = button.password;
728 
729  for (const auto & act : std::as_const(button.action))
730  {
731  if (handleAction(act, password))
732  break;
733  }
734 }
735 
737 {
738  buttonAction(item, false);
739 }
740 
746 QString MythThemedMenu::findMenuFile(const QString &menuname)
747 {
748  QString testdir = GetConfDir() + '/' + menuname;
749  QFile file(testdir);
750  if (file.exists())
751  return testdir;
752  LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);
753 
754  testdir = GetMythUI()->GetMenuThemeDir() + '/' + menuname;
755  file.setFileName(testdir);
756  if (file.exists())
757  return testdir;
758  LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);
759 
760  testdir = GetMythUI()->GetThemeDir() + '/' + menuname;
761  file.setFileName(testdir);
762  if (file.exists())
763  return testdir;
764  LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);
765 
766  testdir = GetShareDir() + menuname;
767  file.setFileName(testdir);
768  if (file.exists())
769  return testdir;
770  LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);
771 
772  testdir = "../mythfrontend/" + menuname;
773  file.setFileName(testdir);
774  if (file.exists())
775  return testdir;
776  LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);
777 
778  testdir = GetShareDir() + "themes/defaultmenu/" + menuname;
779  file.setFileName(testdir);
780  if (file.exists())
781  return testdir;
782  LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);
783 
784  return {};
785 }
786 
793 bool MythThemedMenu::handleAction(const QString &action, const QString &password)
794 {
796 
797  if (!password.isEmpty() && !checkPinCode(password))
798  return true;
799 
800  if (action.startsWith("EXEC "))
801  {
802  QString rest = action.right(action.length() - 5);
803  if (cbs && cbs->exec_program)
804  cbs->exec_program(rest);
805 
806  return false;
807  }
808  if (action.startsWith("EXECTV "))
809  {
810  QString rest = action.right(action.length() - 7).trimmed();
811  if (cbs && cbs->exec_program_tv)
812  cbs->exec_program_tv(rest);
813  }
814  else if (action.startsWith("MENU "))
815  {
816  QString menu = action.right(action.length() - 5);
817 
818  MythScreenStack *stack = GetScreenStack();
819 
820  auto *newmenu = new MythThemedMenu("", menu, stack, menu, false, m_state);
821  if (newmenu->foundTheme())
822  stack->AddScreen(newmenu);
823  else
824  delete newmenu;
825  }
826  else if (action.startsWith("UPMENU"))
827  {
828  m_wantpop = true;
829  }
830  else if (action.startsWith("CONFIGPLUGIN"))
831  {
832  QString rest = action.right(action.length() - 13);
833  if (cbs && cbs->configplugin)
834  cbs->configplugin(rest);
835  }
836  else if (action.startsWith("PLUGIN"))
837  {
838  QString rest = action.right(action.length() - 7);
839  if (cbs && cbs->plugin)
840  cbs->plugin(rest);
841  }
842  else if (action.startsWith("SHUTDOWN"))
843  {
844  if (m_allocedstate)
845  {
846  m_wantpop = true;
847  }
848  }
849  else if (action.startsWith("EJECT"))
850  {
851  if (cbs && cbs->eject)
852  cbs->eject();
853  }
854  else if (action.startsWith("JUMP "))
855  {
856  QString rest = action.right(action.length() - 5);
857  GetMythMainWindow()->JumpTo(rest, false);
858  }
859  else if (action.startsWith("MEDIA "))
860  {
861  // the format is MEDIA HANDLER URL
862  // TODO: allow spaces in the url
863  QStringList list = action.simplified().split(' ');
864  if (list.size() >= 3)
865  GetMythMainWindow()->HandleMedia(list[1], list[2]);
866  }
867  else
868  {
870  if (m_state->m_callback)
872  else
873  LOG(VB_GENERAL, LOG_ERR, "Unknown menu action: " + action);
874  }
875 
876  return true;
877 }
878 
879 bool MythThemedMenu::findDepends(const QString &fileList)
880 {
881  QStringList files = fileList.split(" ");
882  MythPluginManager *pluginManager = gCoreContext->GetPluginManager();
883 
884  for (const auto & file : std::as_const(files))
885  {
886  QString filename = findMenuFile(file);
887  if (!filename.isEmpty() && filename.endsWith(".xml"))
888  return true;
889 
890  // Has plugin by this name been successfully loaded
891  MythPlugin *plugin = pluginManager->GetPlugin(file);
892  if (plugin)
893  return true;
894  }
895 
896  return false;
897 }
898 
900 {
901  QFileInfo filename_info(filename);
902 
903  return filename_info.exists() && filename_info.isFile() && filename_info.isExecutable();
904 }
905 
912 bool MythThemedMenu::checkPinCode(const QString &password_setting)
913 {
914  QString timestamp_setting = QString("%1Time").arg(password_setting);
915  QDateTime curr_time = MythDate::current();
916  QString last_time_stamp = GetMythDB()->GetSetting(timestamp_setting);
917  QString password = GetMythDB()->GetSetting(password_setting);
918 
919  // Password empty? Then skip asking for it
920  if (password.isEmpty())
921  return true;
922 
923  if (last_time_stamp.length() < 1)
924  {
925  LOG(VB_GENERAL, LOG_ERR,
926  "MythThemedMenu: Could not read password/pin time stamp.\n"
927  "This is only an issue if it happens repeatedly.");
928  }
929  else
930  {
931  QDateTime last_time = MythDate::fromString(last_time_stamp);
932  if (!last_time.isValid() || last_time.secsTo(curr_time) < 120)
933  {
934  last_time_stamp = MythDate::toString(
935  curr_time, MythDate::kDatabase);
936  GetMythDB()->SaveSetting(timestamp_setting, last_time_stamp);
937  return true;
938  }
939  }
940 
941  LOG(VB_GENERAL, LOG_INFO, QString("Using Password: %1")
942  .arg(password_setting));
943 
944  QString text = tr("Enter password:");
945  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
946  auto *dialog = new MythTextInputDialog(popupStack, text, FilterNone, true);
947 
948  if (dialog->Create())
949  {
950  dialog->SetReturnEvent(this, "password");
951  popupStack->AddScreen(dialog);
952  }
953  else
954  {
955  delete dialog;
956  }
957 
958  return false;
959 }
960 
965 {
966  if (!event)
967  return;
968 
969  MythMediaDevice *device = event->getDevice();
970 
971  if (!device)
972  return;
973 
974  MythMediaType type = device->getMediaType();
975  MythMediaStatus status = device->getStatus();
976 
977  if ((status & ~MEDIASTAT_USEABLE) &&
978  (status & ~MEDIASTAT_MOUNTED))
979  return;
980 
981  switch (type)
982  {
983  case MEDIATYPE_DVD :
984  case MEDIATYPE_BD :
985  // DVD or Blu-ray Available
986  break;
987  default :
988  return;
989  }
990 }
MythUIMenuCallbacks::exec_program_tv
void(* exec_program_tv)(const QString &cmd)
Definition: mythuihelper.h:17
MythMainWindow::GetMainStack
MythScreenStack * GetMainStack()
Definition: mythmainwindow.cpp:317
MythDialogBox::SetReturnEvent
void SetReturnEvent(QObject *retobject, const QString &resultid)
Definition: mythdialogbox.cpp:303
MEDIATYPE_DVD
@ MEDIATYPE_DVD
Definition: mythmedia.h:29
MythDate::toString
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
Definition: mythdate.cpp:93
MythUIButtonList::GetItemCurrent
MythUIButtonListItem * GetItemCurrent() const
Definition: mythuibuttonlist.cpp:1614
mythuitext.h
MythPluginManager
Definition: mythplugin.h:62
MythUIStateType::EnsureStateLoaded
void EnsureStateLoaded(const QString &name)
Definition: mythuistatetype.cpp:312
MYTH_APPNAME_MYTHFRONTEND
static constexpr const char * MYTH_APPNAME_MYTHFRONTEND
Definition: mythappname.h:6
ThemedButton::alttext
QString alttext
Definition: myththemedmenu.h:19
mythdb.h
ThemedButton::action
QStringList action
Definition: myththemedmenu.h:17
ThemedButton::type
QString type
Definition: myththemedmenu.h:16
MythUIType::GetChild
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
Definition: mythuitype.cpp:138
MythPlugin
Definition: mythplugin.h:22
mythplugin.h
MythMainWindow::JumpTo
void JumpTo(const QString &Destination, bool Pop=true)
Definition: mythmainwindow.cpp:1457
MEDIASTAT_USEABLE
@ MEDIASTAT_USEABLE
Definition: mythmedia.h:19
MythUIButtonList::itemSelected
void itemSelected(MythUIButtonListItem *item)
MythThemedMenuState::CopyFrom
void CopyFrom(MythUIType *base) override
Copy this widgets state from another.
Definition: myththemedmenu.cpp:56
MythThemedMenuState::m_loaded
bool m_loaded
Definition: myththemedmenu.h:46
GetMythSourceVersion
const char * GetMythSourceVersion()
Definition: mythversion.cpp:7
MythThemedMenuState::m_descriptionText
MythUIText * m_descriptionText
Definition: myththemedmenu.h:50
mythdialogbox.h
MythScreenStack
Definition: mythscreenstack.h:16
MythThemedMenu::m_ignorekeys
bool m_ignorekeys
Definition: myththemedmenu.h:113
MythThemedMenu::keyPressEvent
bool keyPressEvent(QKeyEvent *e) override
keyboard/LIRC event handler.
Definition: myththemedmenu.cpp:194
MythThemedMenuState::m_killable
bool m_killable
Definition: myththemedmenu.h:44
MythMediaDevice::getStatus
MythMediaStatus getStatus() const
Definition: mythmedia.h:70
MythThemedMenu::handleAction
bool handleAction(const QString &action, const QString &password=QString())
Handle a MythTV action for the Menus.
Definition: myththemedmenu.cpp:793
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
MythThemedMenu::foundTheme
bool foundTheme(void) const
Returns true iff a theme has been found by a previous call to SetMenuTheme().
Definition: myththemedmenu.cpp:145
mythuistatetype.h
MythThemedMenuState::MythThemedMenuState
MythThemedMenuState(MythScreenStack *parent, const QString &name)
Definition: myththemedmenu.h:35
MythUIStateType::Reset
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuistatetype.cpp:197
GetMythDB
MythDB * GetMythDB(void)
Definition: mythdb.cpp:51
build_compdb.file
file
Definition: build_compdb.py:55
mythdirs.h
MythThemedMenu::m_wantpop
bool m_wantpop
Definition: myththemedmenu.h:114
myth_system
uint myth_system(const QString &command, uint flags, std::chrono::seconds timeout)
Definition: mythsystemlegacy.cpp:506
ThemedButton::text
QString text
Definition: myththemedmenu.h:18
MythScreenType::CopyFrom
void CopyFrom(MythUIType *base) override
Copy this widgets state from another.
Definition: mythscreentype.cpp:521
MythUIButtonList::GetCount
int GetCount() const
Definition: mythuibuttonlist.cpp:1679
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:15
MythMainWindow::HandleMedia
bool HandleMedia(const QString &Handler, const QString &Mrl, const QString &Plot="", const QString &Title="", const QString &Subtitle="", const QString &Director="", int Season=0, int Episode=0, const QString &Inetref="", std::chrono::minutes LenMins=2h, const QString &Year="1895", const QString &Id="", bool UseBookmarks=false)
Definition: mythmainwindow.cpp:1496
XMLParseBase::parseText
static QString parseText(QDomElement &element)
Definition: xmlparsebase.cpp:315
MythMediaType
MythMediaType
Definition: mythmedia.h:24
MythScreenType::GetFocusWidget
MythUIType * GetFocusWidget(void) const
Definition: mythscreentype.cpp:111
mythsystemlegacy.h
MythUIButtonListItem
Definition: mythuibuttonlist.h:41
mythdate.h
ThemedButton
Definition: myththemedmenu.h:14
mythlogging.h
GetConfDir
QString GetConfDir(void)
Definition: mythdirs.cpp:263
MythUIButtonList::itemClicked
void itemClicked(MythUIButtonListItem *item)
MythMainWindow::TranslateKeyPress
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
Definition: mythmainwindow.cpp:1111
MythThemedMenu::addButton
void addButton(const QString &type, const QString &text, const QString &alttext, const QStringList &action, const QString &description, const QString &password)
Create a new MythThemedButton based on the MythThemedMenuState m_state and the type,...
Definition: myththemedmenu.cpp:697
MythThemedMenu::m_menuPopup
MythDialogBox * m_menuPopup
Definition: myththemedmenu.h:118
MythThemedMenu::ShowMenu
void ShowMenu() override
Definition: myththemedmenu.cpp:299
hardwareprofile.i18n.t
t
Definition: i18n.py:36
MythDialogBox::AddButton
void AddButton(const QString &title)
Definition: mythdialogbox.h:197
MythDialogBox
Basic menu dialog, message and a list of options.
Definition: mythdialogbox.h:165
menu
static MythThemedMenu * menu
Definition: mythtv-setup.cpp:58
MythUIThemeHelper::GetThemeDir
QString GetThemeDir()
Definition: mythuithemehelper.cpp:141
MythMediaStatus
MythMediaStatus
Definition: mythmedia.h:12
MythDialogBox::Create
bool Create(void) override
Definition: mythdialogbox.cpp:127
MythThemedMenu::MythThemedMenu
MythThemedMenu(const QString &cdir, const QString &menufile, MythScreenStack *parent, const QString &name, bool allowreorder=false, MythThemedMenuState *state=nullptr)
Creates a themed menu.
Definition: myththemedmenu.cpp:90
GetShareDir
QString GetShareDir(void)
Definition: mythdirs.cpp:261
MythMediaEvent
Definition: mythmedia.h:183
MythUIMenuCallbacks::configplugin
void(* configplugin)(const QString &cmd)
Definition: mythuihelper.h:18
MythMainWindow::DestinationExists
bool DestinationExists(const QString &Destination) const
Definition: mythmainwindow.cpp:1470
XMLParseBase::getFirstText
static QString getFirstText(QDomElement &element)
Definition: xmlparsebase.cpp:52
MythUIHelper::GetMenuCBs
MythUIMenuCallbacks * GetMenuCBs()
Definition: mythuihelper.cpp:91
mythmedia.h
MythThemedMenu::SetMenuTheme
void SetMenuTheme(const QString &menufile)
Loads the main UI theme, and a menu theme.
Definition: myththemedmenu.cpp:111
ThemedButton::password
QString password
Definition: myththemedmenu.h:23
MEDIASTAT_MOUNTED
@ MEDIASTAT_MOUNTED
Definition: mythmedia.h:21
xmlparsebase.h
MythUIButtonList::SetLCDTitles
void SetLCDTitles(const QString &title, const QString &columnList="")
Definition: mythuibuttonlist.cpp:3083
MythScreenStack::TotalScreens
int TotalScreens() const
Definition: mythscreenstack.cpp:47
MythUIButtonListItem::GetData
QVariant GetData()
Definition: mythuibuttonlist.cpp:3715
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:57
MythThemedMenu::parseMenu
bool parseMenu(const QString &menuname)
Parse the themebuttons to be added based on the name of the menu file provided.
Definition: myththemedmenu.cpp:581
XMLParseBase::WindowExists
static bool WindowExists(const QString &xmlfile, const QString &windowname)
Definition: xmlparsebase.cpp:636
MythThemedMenu::m_menumode
QString m_menumode
Definition: myththemedmenu.h:116
MythThemedMenu::m_selection
QString m_selection
Definition: myththemedmenu.h:111
MythThemedMenu::customEvent
void customEvent(QEvent *event) override
Definition: myththemedmenu.cpp:375
FilterNone
@ FilterNone
Definition: mythuitextedit.h:21
MythCoreContext::GetLanguage
QString GetLanguage(void)
Returns two character ISO-639 language descriptor for UI language.
Definition: mythcorecontext.cpp:1777
MythThemedMenuState::m_buttonList
MythUIButtonList * m_buttonList
Definition: myththemedmenu.h:49
MythThemedMenuState::m_callback
void(* m_callback)(void *, QString &)
Definition: myththemedmenu.h:41
MythScreenType::GetScreenStack
MythScreenStack * GetScreenStack() const
Definition: mythscreentype.cpp:215
mythgesture.h
A C++ ripoff of the stroke library for MythTV.
MythThemedMenu::setKillable
void setKillable(void)
Definition: myththemedmenu.cpp:166
MythThemedMenuState::m_watermarkState
MythUIStateType * m_watermarkState
Definition: myththemedmenu.h:48
mythappname.h
MythUIMenuCallbacks::exec_program
void(* exec_program)(const QString &cmd)
Definition: mythuihelper.h:16
ThemedButton::description
QString description
Definition: myththemedmenu.h:20
MythThemedMenuState::m_titleState
MythUIStateType * m_titleState
Definition: myththemedmenu.h:47
MythThemedMenu::findMenuFile
static QString findMenuFile(const QString &menuname)
Locates the appropriate menu file from which to parse the menu.
Definition: myththemedmenu.cpp:746
MythUIType
The base class on which all widgets and screens are based.
Definition: mythuitype.h:85
GetMythSourcePath
const char * GetMythSourcePath()
Definition: mythversion.cpp:12
MythDate::fromString
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
Definition: mythdate.cpp:39
MythThemedMenu::m_allocedstate
bool m_allocedstate
Definition: myththemedmenu.h:109
MYTH_APPNAME_MYTHTV_SETUP
static constexpr const char * MYTH_APPNAME_MYTHTV_SETUP
Definition: mythappname.h:7
mythuihelper.h
MythDialogBox::AddButtonV
void AddButtonV(const QString &title, QVariant data=0, bool newMenu=false, bool setCurrent=false)
Definition: mythdialogbox.cpp:328
MythThemedMenu::parseThemeButton
void parseThemeButton(QDomElement &element)
Parses the element's tags and set the ThemeButton's type, text, depends, and action,...
Definition: myththemedmenu.cpp:440
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
MythScreenType::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: mythscreentype.cpp:402
MythThemedMenu::getCallback
void getCallback(void(**lcallback)(void *, QString &), void **data)
Get the themed menus callback function and data for that function.
Definition: myththemedmenu.cpp:151
mythcorecontext.h
XMLParseBase::LoadWindowFromXML
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
Definition: xmlparsebase.cpp:701
MythThemedMenu::checkPinCode
bool checkPinCode(const QString &password_setting)
Queries the user for a password to enter a part of MythTV restricted by a password.
Definition: myththemedmenu.cpp:912
MythCoreContext::GetLanguageAndVariant
QString GetLanguageAndVariant(void)
Returns the user-set language and variant.
Definition: mythcorecontext.cpp:1789
MythUIMenuCallbacks::plugin
void(* plugin)(const QString &cmd)
Definition: mythuihelper.h:19
MythPluginManager::GetPlugin
MythPlugin * GetPlugin(const QString &plugname)
Definition: mythplugin.cpp:213
DialogCompletionEvent
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
Definition: mythdialogbox.h:40
MEDIATYPE_BD
@ MEDIATYPE_BD
Definition: mythmedia.h:34
MythThemedMenu::findDependsExec
static bool findDependsExec(const QString &filename)
Definition: myththemedmenu.cpp:899
MythUIText::SetText
virtual void SetText(const QString &text)
Definition: mythuitext.cpp:115
MythThemedMenu::buttonAction
void buttonAction(MythUIButtonListItem *item, bool skipPass)
Definition: myththemedmenu.cpp:721
MythThemedMenuState::m_callbackdata
void * m_callbackdata
Definition: myththemedmenu.h:42
MythScreenStack::PopScreen
virtual void PopScreen(MythScreenType *screen=nullptr, bool allowFade=true, bool deleteScreen=true)
Definition: mythscreenstack.cpp:86
MythThemedMenu::setCallback
void setCallback(void(*lcallback)(void *, QString &), void *data)
Set the themed menus callback function and data for that function.
Definition: myththemedmenu.cpp:159
DialogCompletionEvent::kEventType
static const Type kEventType
Definition: mythdialogbox.h:56
MythMediaDevice::getMediaType
MythMediaType getMediaType() const
Definition: mythmedia.h:91
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition: mythmainwindow.cpp:104
build_compdb.action
action
Definition: build_compdb.py:9
MythThemedMenu::setButtonActive
void setButtonActive(MythUIButtonListItem *item)
Definition: myththemedmenu.cpp:176
MythThemedMenuState
Definition: myththemedmenu.h:31
MythDate::kDatabase
@ kDatabase
Default UTC, database format.
Definition: mythdate.h:27
MythThemedMenu::findDepends
static bool findDepends(const QString &fileList)
Definition: myththemedmenu.cpp:879
MythMainWindow::GetStack
MythScreenStack * GetStack(const QString &Stackname)
Definition: mythmainwindow.cpp:322
MythThemedMenu::aboutScreen
void aboutScreen()
Definition: myththemedmenu.cpp:348
MythUIMenuCallbacks::eject
void(* eject)()
Definition: mythuihelper.h:20
MythMediaDevice
Definition: mythmedia.h:48
myththemedmenu.h
azlyrics.info
dictionary info
Definition: azlyrics.py:7
MythThemedMenu::~MythThemedMenu
~MythThemedMenu() override
Definition: myththemedmenu.cpp:137
MythScreenType::m_screenStack
MythScreenStack * m_screenStack
Definition: mythscreentype.h:130
MythThemedMenuState::Create
bool Create(void) override
Definition: myththemedmenu.cpp:35
MythThemedMenu::m_state
MythThemedMenuState * m_state
Definition: myththemedmenu.h:108
MythUIThemeHelper::GetMenuThemeDir
QString GetMenuThemeDir()
Definition: mythuithemehelper.cpp:136
MythTextInputDialog
Dialog prompting the user to enter a text string.
Definition: mythdialogbox.h:313
MythThemedMenu::getSelection
QString getSelection(void)
Definition: myththemedmenu.cpp:171
MythThemedMenu::mediaEvent
void mediaEvent(MythMediaEvent *event) override
Media/Device status event handler, received from MythMediaMonitor.
Definition: myththemedmenu.cpp:964
lcddevice.h
MythScreenType::aboutToShow
virtual void aboutToShow(void)
Definition: mythscreentype.cpp:236
MythThemedMenu::m_foundtheme
bool m_foundtheme
Definition: myththemedmenu.h:112
GetMythUI
MythUIHelper * GetMythUI()
Definition: mythuihelper.cpp:64
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:191
build_compdb.filename
filename
Definition: build_compdb.py:21
MythCoreContext::GetPluginManager
MythPluginManager * GetPluginManager(void)
Definition: mythcorecontext.cpp:2117
mythmainwindow.h
MythScreenStack::AddScreen
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Definition: mythscreenstack.cpp:52
ShowOkPopup
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
Definition: mythdialogbox.cpp:566
MythUIButtonList::updateLCD
void updateLCD(void)
Definition: mythuibuttonlist.cpp:3089
MythUIStateType
This widget is used for grouping other widgets for display when a particular named state is called....
Definition: mythuistatetype.h:22
MythThemedMenu::aboutToShow
void aboutToShow(void) override
Definition: myththemedmenu.cpp:293
MythUIStateType::DisplayState
bool DisplayState(const QString &name)
Definition: mythuistatetype.cpp:84
MythUIMenuCallbacks
Definition: mythuihelper.h:14