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
18#include "libmythbase/mythdb.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
90MythThemedMenu::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
111void 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
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
151void MythThemedMenu::getCallback(void (**lcallback)(void *, QString &),
152 void **data)
153{
154 *lcallback = m_state->m_callback;
155 *data = m_state->m_callbackdata;
156}
157
159void 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>();
180 {
181 if (!(m_watermarkState->DisplayState(button.type)))
183 }
184
186 m_descriptionText->SetText(button.description);
187}
188
194bool 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 {
237 handleAction(menuaction);
238 }
239 else if (m_state->m_killable)
240 {
241 m_wantpop = true;
242 if (callbacks)
243 {
244 QString sel = "EXITING_MENU";
246 }
247
248 if (lastScreen)
249 {
250 if (callbacks)
252 QCoreApplication::exit();
253 }
254 }
255 else if ((action == "EXIT" || action == "EXITPROMPT" ||
256 action == "STANDBYMODE" ||
257 (action == "ESCAPE" &&
258 (QCoreApplication::applicationName() ==
259 MYTH_APPNAME_MYTHTV_SETUP))) && lastScreen)
260 {
261 if (callbacks)
262 {
264 }
265 else
266 {
267 QCoreApplication::exit();
268 m_wantpop = true;
269 }
270 }
271 }
272 else if (action == "HELP")
273 {
274 aboutScreen();
275 }
276 else if (action == "EJECT")
277 {
279 }
280 else
281 {
282 handled = false;
283 }
284 }
285
286 if (!handled && MythScreenType::keyPressEvent(event))
287 handled = true;
288
289 m_ignorekeys = false;
290
291 if (m_wantpop)
293
294 return handled;
295}
296
298{
301}
302
304{
305 if (m_menuPopup)
306 return;
307
308 int override_menu = GetMythDB()->GetNumSetting("OverrideExitMenu");
309 QString label = tr("System Menu");
311 m_menuPopup = new MythDialogBox(label, mainStack, "menuPopup");
312
313 if (m_menuPopup->Create())
314 mainStack->AddScreen(m_menuPopup);
315
316 m_menuPopup->SetReturnEvent(this, "popmenu");
317
318 // HACK Implement a better check for this
319 if (QCoreApplication::applicationName() == MYTH_APPNAME_MYTHFRONTEND)
320 m_menuPopup->AddButtonV(tr("Enter standby mode"), QVariant("standby"));
321
322 // don't show the exit application option if standby option is enabled
323 if (override_menu != 7)
324 m_menuPopup->AddButtonV(tr("Exit application"), QVariant("exit"));
325
326 switch (override_menu)
327 {
328 case 2:
329 case 4:
330 // shutdown
331 m_menuPopup->AddButtonV(tr("Shutdown"), QVariant("shutdown"));
332 break;
333 case 5:
334 // reboot
335 m_menuPopup->AddButtonV(tr("Reboot"), QVariant("reboot"));
336 break;
337 case 3:
338 case 6:
339 // both
340 m_menuPopup->AddButtonV(tr("Shutdown"), QVariant("shutdown"));
341 m_menuPopup->AddButtonV(tr("Reboot"), QVariant("reboot"));
342 break;
343 case 0:
344 case 7:
345 default:
346 break;
347 }
348
349 m_menuPopup->AddButtonV(tr("About"), QVariant("about"));
350}
351
353{
354 QString distro_line;
355
356 QFile file("/etc/os_myth_release");
357 if (file.open(QFile::ReadOnly))
358 {
359 QTextStream t( &file ); // use a text stream
360 distro_line = t.readLine();
361 file.close();
362 }
363
364 QString label = tr("Revision: %1\n Branch: %2\n %3")
367 distro_line);
368
370 m_menuPopup = new MythDialogBox(label, mainStack, "version_dialog");
371 if (m_menuPopup->Create())
372 mainStack->AddScreen(m_menuPopup);
373
374 m_menuPopup->SetReturnEvent(this, "version");
375 m_menuPopup->AddButton(tr("Ok"));
376
377}
378
380{
381 if (event->type() == DialogCompletionEvent::kEventType)
382 {
383 auto *dce = (DialogCompletionEvent*)event;
384
385 QString resultid = dce->GetId();
386 //int buttonnum = dce->GetResult();
387 QString halt_cmd = GetMythDB()->GetSetting("HaltCommand");
388 QString reboot_cmd = GetMythDB()->GetSetting("RebootCommand");
389
390 if (resultid == "popmenu")
391 {
392 QString action = dce->GetData().toString();
393 if (action == "shutdown")
394 {
395 if (!halt_cmd.isEmpty())
396 myth_system(halt_cmd);
397 }
398 else if (action == "reboot")
399 {
400 if (!reboot_cmd.isEmpty())
401 myth_system(reboot_cmd);
402 }
403 else if (action == "about")
404 {
405 aboutScreen();
406 }
407 else if (action == "standby")
408 {
409 QString arg("standby_mode");
411 }
412 else if (action == "exit")
413 {
414 QString arg("exiting_app");
416 }
417 }
418 else if (resultid == "password")
419 {
420 QString text = dce->GetResultText();
422 auto button = item->GetData().value<ThemedButton>();
423 QString password = GetMythDB()->GetSetting(button.password);
424 if (text == password)
425 {
426 QString timestamp_setting = QString("%1Time").arg(button.password);
427 QDateTime curr_time = MythDate::current();
428 QString last_time_stamp =
430 GetMythDB()->SaveSetting(timestamp_setting, last_time_stamp);
431 buttonAction(item, true);
432 }
433 }
434
435 m_menuPopup = nullptr;
436 }
437}
438
444void MythThemedMenu::parseThemeButton(QDomElement &element)
445{
446 QString type;
447 QString text;
448 QStringList action;
449 QString alttext;
450 QString description;
451 QString password;
452
453 bool addit = true;
454
455 for (QDomNode child = element.firstChild(); !child.isNull();
456 child = child.nextSibling())
457 {
458 QDomElement info = child.toElement();
459 if (!info.isNull())
460 {
461 if (info.tagName() == "type")
462 {
464 }
465 else if (info.tagName() == "text")
466 {
467 if (text.isEmpty() &&
468 info.attribute("lang","").isEmpty())
469 {
470 text = QCoreApplication::translate("ThemeUI",
471 parseText(info).toUtf8().constData() );
472 }
473 else if ((info.attribute("lang","").toLower() ==
475 (info.attribute("lang","").toLower() ==
477 {
478 text = parseText(info);
479 }
480 }
481 else if (info.tagName() == "alttext")
482 {
483 if (alttext.isEmpty() &&
484 info.attribute("lang","").isEmpty())
485 {
486 alttext = QCoreApplication::translate("ThemeUI",
487 parseText(info).toUtf8().constData());
488 }
489 else if ((info.attribute("lang","").toLower() ==
491 (info.attribute("lang","").toLower() ==
493 {
494 alttext = parseText(info);
495 }
496 }
497 else if (info.tagName() == "action")
498 {
500 }
501 else if (info.tagName() == "depends")
502 {
503 addit = findDepends(getFirstText(info));
504 }
505 else if (info.tagName() == "dependsexec")
506 {
508 }
509 else if (info.tagName() == "dependssetting")
510 {
511 addit = GetMythDB()->GetBoolSetting(getFirstText(info));
512 }
513 else if (info.tagName() == "dependjumppoint")
514 {
517 }
518 else if (info.tagName() == "dependswindow")
519 {
520 QString xmlFile = info.attribute("xmlfile", "");
521 QString windowName = getFirstText(info);
522 if (xmlFile.isEmpty() || windowName.isEmpty())
523 addit = false;
524 else
525 addit = XMLParseBase::WindowExists(xmlFile, windowName);
526 }
527 else if (info.tagName() == "description")
528 {
529 if (description.isEmpty() &&
530 info.attribute("lang","").isEmpty())
531 {
532 description = QCoreApplication::translate("ThemeUI",
533 getFirstText(info).toUtf8().constData());
534 }
535 else if ((info.attribute("lang","").toLower() ==
537 (info.attribute("lang","").toLower() ==
539 {
540 description = getFirstText(info);
541 }
542 }
543 else if (info.tagName() == "password")
544 {
545 password = getFirstText(info);
546 }
547 else
548 {
549 LOG(VB_GENERAL, LOG_ERR,
550 QString("MythThemedMenu: Unknown tag %1 in button")
551 .arg(info.tagName()));
552 }
553 }
554 }
555
556 if (text.isEmpty())
557 {
558 LOG(VB_GENERAL, LOG_ERR, "MythThemedMenu: Missing 'text' in button");
559 return;
560 }
561
562 if (action.empty())
563 {
564 LOG(VB_GENERAL, LOG_ERR, "MythThemedMenu: Missing 'action' in button");
565 return;
566 }
567
568 if (addit)
569 addButton(type, text, alttext, action, description, password);
570}
571
585bool MythThemedMenu::parseMenu(const QString &menuname)
586{
587 QString filename = findMenuFile(menuname);
588
589 QDomDocument doc;
590 QFile f(filename);
591
592 if (!f.exists() || !f.open(QIODevice::ReadOnly))
593 {
594 LOG(VB_GENERAL, LOG_ERR, QString("MythThemedMenu: Couldn't read "
595 "menu file %1").arg(menuname));
596
597 if (menuname != "mainmenu.xml")
598 ShowOkPopup(tr("MythTV could not locate the menu file %1")
599 .arg(menuname));
600 return false;
601 }
602
603#if QT_VERSION < QT_VERSION_CHECK(6,5,0)
604 QString errorMsg;
605 int errorLine = 0;
606 int errorColumn = 0;
607
608 if (!doc.setContent(&f, false, &errorMsg, &errorLine, &errorColumn))
609 {
610 LOG(VB_GENERAL, LOG_ERR,
611 QString("Error parsing: %1\nat line: %2 column: %3 msg: %4").
612 arg(filename).arg(errorLine).arg(errorColumn).arg(errorMsg));
613 f.close();
614
615 if (menuname != "mainmenu.xml")
616 ShowOkPopup(tr("The menu file %1 is incomplete.")
617 .arg(menuname));
618 return false;
619 }
620#else
621 auto parseResult = doc.setContent(&f);
622 if (!parseResult)
623 {
624 LOG(VB_GENERAL, LOG_ERR,
625 QString("Error parsing: %1\nat line: %2 column: %3 msg: %4")
626 .arg(filename).arg(parseResult.errorLine)
627 .arg(parseResult.errorColumn).arg(parseResult.errorMessage));
628 f.close();
629
630 if (menuname != "mainmenu.xml")
631 ShowOkPopup(tr("The menu file %1 is incomplete.")
632 .arg(menuname));
633 return false;
634 }
635#endif
636
637 f.close();
638
639 LOG(VB_GUI, LOG_INFO, QString("Loading menu theme from %1").arg(filename));
640
641 QDomElement docElem = doc.documentElement();
642
643 m_menumode = docElem.attribute("name", "MAIN");
644
645 QDomNode n = docElem.firstChild();
646 while (!n.isNull())
647 {
648 QDomElement e = n.toElement();
649 if (!e.isNull())
650 {
651 if (e.tagName() == "button")
652 {
654 }
655 else
656 {
657 LOG(VB_GENERAL, LOG_ERR,
658 QString("MythThemedMenu: Unknown element %1")
659 .arg(e.tagName()));
660 return false;
661 }
662 }
663 n = n.nextSibling();
664 }
665
666 if (m_buttonList->GetCount() == 0)
667 {
668 LOG(VB_GENERAL, LOG_ERR,
669 QString("MythThemedMenu: No buttons for menu %1").arg(menuname));
670 return false;
671 }
672
674
675 if (m_titleState)
676 {
679 }
680
681 m_selection.clear();
682 return true;
683}
684
701void MythThemedMenu::addButton(const QString &type, const QString &text,
702 const QString &alttext,
703 const QStringList &action,
704 const QString &description,
705 const QString &password)
706{
707 ThemedButton newbutton;
708 newbutton.type = type;
709 newbutton.action = action;
710 newbutton.text = text;
711 newbutton.alttext = alttext;
712 newbutton.description = description;
713 newbutton.password = password;
714
717
718 auto *listbuttonitem = new MythUIButtonListItem(m_buttonList, text,
719 QVariant::fromValue(newbutton));
720
721 listbuttonitem->DisplayState(type, "icon");
722 listbuttonitem->SetText(description, "description");
723}
724
726{
727 auto button = item->GetData().value<ThemedButton>();
728
729 QString password;
730 if (!skipPass)
731 password = button.password;
732
733 for (const auto & act : std::as_const(button.action))
734 {
735 if (handleAction(act, password))
736 break;
737 }
738}
739
741{
742 buttonAction(item, false);
743}
744
750QString MythThemedMenu::findMenuFile(const QString &menuname)
751{
752 QString testdir = GetConfDir() + '/' + menuname;
753 QFile file(testdir);
754 if (file.exists())
755 return testdir;
756 LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);
757
758 testdir = GetMythUI()->GetMenuThemeDir() + '/' + menuname;
759 file.setFileName(testdir);
760 if (file.exists())
761 return testdir;
762 LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);
763
764 testdir = GetMythUI()->GetThemeDir() + '/' + menuname;
765 file.setFileName(testdir);
766 if (file.exists())
767 return testdir;
768 LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);
769
770 testdir = GetShareDir() + menuname;
771 file.setFileName(testdir);
772 if (file.exists())
773 return testdir;
774 LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);
775
776 testdir = "../mythfrontend/" + menuname;
777 file.setFileName(testdir);
778 if (file.exists())
779 return testdir;
780 LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);
781
782 testdir = GetShareDir() + "themes/defaultmenu/" + menuname;
783 file.setFileName(testdir);
784 if (file.exists())
785 return testdir;
786 LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);
787
788 return {};
789}
790
797bool MythThemedMenu::handleAction(const QString &action, const QString &password)
798{
800
801 if (!password.isEmpty() && !checkPinCode(password))
802 return true;
803
804 if (action.startsWith("EXEC "))
805 {
806 QString rest = action.right(action.length() - 5);
807 if (cbs && cbs->exec_program)
808 cbs->exec_program(rest);
809
810 return false;
811 }
812 if (action.startsWith("EXECTV "))
813 {
814 QString rest = action.right(action.length() - 7).trimmed();
815 if (cbs && cbs->exec_program_tv)
816 cbs->exec_program_tv(rest);
817 }
818 else if (action.startsWith("MENU "))
819 {
820 QString menu = action.right(action.length() - 5);
821
823
824 auto *newmenu = new MythThemedMenu("", menu, stack, menu, false, m_state);
825 if (newmenu->foundTheme())
826 stack->AddScreen(newmenu);
827 else
828 delete newmenu;
829 }
830 else if (action.startsWith("UPMENU"))
831 {
832 m_wantpop = true;
833 }
834 else if (action.startsWith("CONFIGPLUGIN"))
835 {
836 QString rest = action.right(action.length() - 13);
837 if (cbs && cbs->configplugin)
838 cbs->configplugin(rest);
839 }
840 else if (action.startsWith("PLUGIN"))
841 {
842 QString rest = action.right(action.length() - 7);
843 if (cbs && cbs->plugin)
844 cbs->plugin(rest);
845 }
846 else if (action.startsWith("SHUTDOWN"))
847 {
848 if (m_allocedstate)
849 {
850 m_wantpop = true;
851 }
852 }
853 else if (action.startsWith("EJECT"))
854 {
855 if (cbs && cbs->eject)
856 cbs->eject();
857 }
858 else if (action.startsWith("JUMP "))
859 {
860 QString rest = action.right(action.length() - 5);
861 GetMythMainWindow()->JumpTo(rest, false);
862 }
863 else if (action.startsWith("MEDIA "))
864 {
865 // the format is MEDIA HANDLER URL
866 // TODO: allow spaces in the url
867 QStringList list = action.simplified().split(' ');
868 if (list.size() >= 3)
869 GetMythMainWindow()->HandleMedia(list[1], list[2]);
870 }
871 else
872 {
874 if (m_state->m_callback)
876 else
877 LOG(VB_GENERAL, LOG_ERR, "Unknown menu action: " + action);
878 }
879
880 return true;
881}
882
883bool MythThemedMenu::findDepends(const QString &fileList)
884{
885 QStringList files = fileList.split(" ");
887
888 for (const auto & file : std::as_const(files))
889 {
890 QString filename = findMenuFile(file);
891 if (!filename.isEmpty() && filename.endsWith(".xml"))
892 return true;
893
894 // Has plugin by this name been successfully loaded
895 MythPlugin *plugin = pluginManager->GetPlugin(file);
896 if (plugin)
897 return true;
898 }
899
900 return false;
901}
902
904{
905 QFileInfo filename_info(filename);
906
907 return filename_info.exists() && filename_info.isFile() && filename_info.isExecutable();
908}
909
916bool MythThemedMenu::checkPinCode(const QString &password_setting)
917{
918 QString timestamp_setting = QString("%1Time").arg(password_setting);
919 QDateTime curr_time = MythDate::current();
920 QString last_time_stamp = GetMythDB()->GetSetting(timestamp_setting);
921 QString password = GetMythDB()->GetSetting(password_setting);
922
923 // Password empty? Then skip asking for it
924 if (password.isEmpty())
925 return true;
926
927 if (last_time_stamp.length() < 1)
928 {
929 LOG(VB_GENERAL, LOG_ERR,
930 "MythThemedMenu: Could not read password/pin time stamp.\n"
931 "This is only an issue if it happens repeatedly.");
932 }
933 else
934 {
935 QDateTime last_time = MythDate::fromString(last_time_stamp);
936 if (!last_time.isValid() || last_time.secsTo(curr_time) < 120)
937 {
938 last_time_stamp = MythDate::toString(
939 curr_time, MythDate::kDatabase);
940 GetMythDB()->SaveSetting(timestamp_setting, last_time_stamp);
941 return true;
942 }
943 }
944
945 LOG(VB_GENERAL, LOG_INFO, QString("Using Password: %1")
946 .arg(password_setting));
947
948 QString text = tr("Enter password:");
949 MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
950 auto *dialog = new MythTextInputDialog(popupStack, text, FilterNone, true);
951
952 if (dialog->Create())
953 {
954 dialog->SetReturnEvent(this, "password");
955 popupStack->AddScreen(dialog);
956 }
957 else
958 {
959 delete dialog;
960 }
961
962 return false;
963}
964
969{
970 if (!event)
971 return;
972
973 MythMediaDevice *device = event->getDevice();
974
975 if (!device)
976 return;
977
978 MythMediaType type = device->getMediaType();
979 MythMediaStatus status = device->getStatus();
980
981 if ((status & ~MEDIASTAT_USEABLE) &&
982 (status & ~MEDIASTAT_MOUNTED))
983 return;
984
985 switch (type)
986 {
987 case MEDIATYPE_DVD :
988 case MEDIATYPE_BD :
989 // DVD or Blu-ray Available
990 break;
991 default :
992 return;
993 }
994}
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
Definition: mythdialogbox.h:40
static const Type kEventType
Definition: mythdialogbox.h:55
MythPluginManager * GetPluginManager(void)
QString GetLanguage(void)
Returns two character ISO-639 language descriptor for UI language.
QString GetLanguageAndVariant(void)
Returns the user-set language and variant.
Basic menu dialog, message and a list of options.
void AddButton(const QString &title)
void SetReturnEvent(QObject *retobject, const QString &resultid)
void AddButtonV(const QString &title, QVariant data=0, bool newMenu=false, bool setCurrent=false)
bool Create(void) override
MythScreenStack * GetMainStack()
void JumpTo(const QString &Destination, bool Pop=true)
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
MythScreenStack * GetStack(const QString &Stackname)
bool DestinationExists(const QString &Destination) const
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)
MythMediaStatus getStatus() const
Definition: mythmedia.h:70
MythMediaType getMediaType() const
Definition: mythmedia.h:91
MythPlugin * GetPlugin(const QString &plugname)
Definition: mythplugin.cpp:218
virtual void PopScreen(MythScreenType *screen=nullptr, bool allowFade=true, bool deleteScreen=true)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
int TotalScreens() const
MythScreenStack * m_screenStack
virtual void aboutToShow(void)
MythUIType * GetFocusWidget(void) const
MythScreenStack * GetScreenStack() const
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
void CopyFrom(MythUIType *base) override
Copy this widgets state from another.
Dialog prompting the user to enter a text string.
bool Create(void) override
void(* m_callback)(void *, QString &)
MythUIButtonList * m_buttonList
MythUIText * m_descriptionText
void CopyFrom(MythUIType *base) override
Copy this widgets state from another.
MythUIStateType * m_titleState
MythThemedMenuState(MythScreenStack *parent, const QString &name)
MythUIStateType * m_watermarkState
bool keyPressEvent(QKeyEvent *e) override
keyboard/LIRC event handler.
void setCallback(void(*lcallback)(void *, QString &), void *data)
Set the themed menus callback function and data for that function.
void buttonAction(MythUIButtonListItem *item, bool skipPass)
QString getSelection(void)
MythThemedMenu(const QString &cdir, const QString &menufile, MythScreenStack *parent, const QString &name, bool allowreorder=false, MythThemedMenuState *state=nullptr)
Creates a themed menu.
void aboutToShow(void) override
void setButtonActive(MythUIButtonListItem *item)
static QString findMenuFile(const QString &menuname)
Locates the appropriate menu file from which to parse the menu.
bool foundTheme(void) const
Returns true iff a theme has been found by a previous call to SetMenuTheme().
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,...
bool handleAction(const QString &action, const QString &password=QString())
Handle a MythTV action for the Menus.
bool parseMenu(const QString &menuname)
Parse the themebuttons to be added based on the name of the menu file provided.
bool checkPinCode(const QString &password_setting)
Queries the user for a password to enter a part of MythTV restricted by a password.
~MythThemedMenu() override
void setKillable(void)
void mediaEvent(MythMediaEvent *event) override
Media/Device status event handler, received from MythMediaMonitor.
static bool findDepends(const QString &fileList)
void ShowMenu() override
void SetMenuTheme(const QString &menufile)
Loads the main UI theme, and a menu theme.
void customEvent(QEvent *event) override
MythThemedMenuState * m_state
void getCallback(void(**lcallback)(void *, QString &), void **data)
Get the themed menus callback function and data for that function.
void parseThemeButton(QDomElement &element)
Parses the element's tags and set the ThemeButton's type, text, depends, and action,...
MythDialogBox * m_menuPopup
static bool findDependsExec(const QString &filename)
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
void SetLCDTitles(const QString &title, const QString &columnList="")
MythUIButtonListItem * GetItemCurrent() const
void itemClicked(MythUIButtonListItem *item)
void itemSelected(MythUIButtonListItem *item)
MythUIMenuCallbacks * GetMenuCBs()
This widget is used for grouping other widgets for display when a particular named state is called.
void EnsureStateLoaded(const QString &name)
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
bool DisplayState(const QString &name)
All purpose text widget, displays a text string.
Definition: mythuitext.h:29
virtual void SetText(const QString &text)
Definition: mythuitext.cpp:115
The base class on which all widgets and screens are based.
Definition: mythuitype.h:97
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
Definition: mythuitype.cpp:130
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
static QString getFirstText(QDomElement &element)
static bool WindowExists(const QString &xmlfile, const QString &windowname)
static QString parseText(QDomElement &element)
static constexpr const char * MYTH_APPNAME_MYTHTV_SETUP
Definition: mythappname.h:7
static constexpr const char * MYTH_APPNAME_MYTHFRONTEND
Definition: mythappname.h:6
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
MythDB * GetMythDB(void)
Definition: mythdb.cpp:50
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
QString GetShareDir(void)
Definition: mythdirs.cpp:283
QString GetConfDir(void)
Definition: mythdirs.cpp:285
A C++ ripoff of the stroke library for MythTV.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
MythMainWindow * GetMythMainWindow(void)
MythMediaType
Definition: mythmedia.h:24
@ MEDIATYPE_BD
Definition: mythmedia.h:34
@ MEDIATYPE_DVD
Definition: mythmedia.h:29
MythMediaStatus
Definition: mythmedia.h:12
@ MEDIASTAT_USEABLE
Definition: mythmedia.h:19
@ MEDIASTAT_MOUNTED
Definition: mythmedia.h:21
uint myth_system(const QString &command, uint flags, std::chrono::seconds timeout)
static MythThemedMenu * menu
MythUIHelper * GetMythUI()
@ FilterNone
const char * GetMythSourceVersion()
Definition: mythversion.cpp:7
const char * GetMythSourcePath()
Definition: mythversion.cpp:12
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
Definition: mythdate.cpp:93
@ kDatabase
Default UTC, database format.
Definition: mythdate.h:27
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
Definition: mythdate.cpp:39
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:15
dictionary info
Definition: azlyrics.py:7
void(* configplugin)(const QString &cmd)
Definition: mythuihelper.h:18
void(* exec_program_tv)(const QString &cmd)
Definition: mythuihelper.h:17
void(* plugin)(const QString &cmd)
Definition: mythuihelper.h:19
void(* exec_program)(const QString &cmd)
Definition: mythuihelper.h:16
QStringList action
QString description
QString alttext
QString password