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