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