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 handleAction(menuaction);
237 else if (m_state->m_killable)
238 {
239 m_wantpop = true;
240 if (callbacks)
241 {
242 QString sel = "EXITING_MENU";
244 }
245
246 if (lastScreen)
247 {
248 if (callbacks)
250 QCoreApplication::exit();
251 }
252 }
253 else if ((action == "EXIT" || action == "EXITPROMPT" ||
254 action == "STANDBYMODE" ||
255 (action == "ESCAPE" &&
256 (QCoreApplication::applicationName() ==
257 MYTH_APPNAME_MYTHTV_SETUP))) && lastScreen)
258 {
259 if (callbacks)
261 else
262 {
263 QCoreApplication::exit();
264 m_wantpop = true;
265 }
266 }
267 }
268 else if (action == "HELP")
269 {
270 aboutScreen();
271 }
272 else if (action == "EJECT")
273 {
275 }
276 else
277 {
278 handled = false;
279 }
280 }
281
282 if (!handled && MythScreenType::keyPressEvent(event))
283 handled = true;
284
285 m_ignorekeys = false;
286
287 if (m_wantpop)
289
290 return handled;
291}
292
294{
297}
298
300{
301 if (m_menuPopup)
302 return;
303
304 int override_menu = GetMythDB()->GetNumSetting("OverrideExitMenu");
305 QString label = tr("System Menu");
307 m_menuPopup = new MythDialogBox(label, mainStack, "menuPopup");
308
309 if (m_menuPopup->Create())
310 mainStack->AddScreen(m_menuPopup);
311
312 m_menuPopup->SetReturnEvent(this, "popmenu");
313
314 // HACK Implement a better check for this
315 if (QCoreApplication::applicationName() == MYTH_APPNAME_MYTHFRONTEND)
316 m_menuPopup->AddButtonV(tr("Enter standby mode"), QVariant("standby"));
317
318 // don't show the exit application option if standby option is enabled
319 if (override_menu != 7)
320 m_menuPopup->AddButtonV(tr("Exit application"), QVariant("exit"));
321
322 switch (override_menu)
323 {
324 case 2:
325 case 4:
326 // shutdown
327 m_menuPopup->AddButtonV(tr("Shutdown"), QVariant("shutdown"));
328 break;
329 case 5:
330 // reboot
331 m_menuPopup->AddButtonV(tr("Reboot"), QVariant("reboot"));
332 break;
333 case 3:
334 case 6:
335 // both
336 m_menuPopup->AddButtonV(tr("Shutdown"), QVariant("shutdown"));
337 m_menuPopup->AddButtonV(tr("Reboot"), QVariant("reboot"));
338 break;
339 case 0:
340 case 7:
341 default:
342 break;
343 }
344
345 m_menuPopup->AddButtonV(tr("About"), QVariant("about"));
346}
347
349{
350 QString distro_line;
351
352 QFile file("/etc/os_myth_release");
353 if (file.open(QFile::ReadOnly))
354 {
355 QTextStream t( &file ); // use a text stream
356 distro_line = t.readLine();
357 file.close();
358 }
359
360 QString label = tr("Revision: %1\n Branch: %2\n %3")
363 distro_line);
364
366 m_menuPopup = new MythDialogBox(label, mainStack, "version_dialog");
367 if (m_menuPopup->Create())
368 mainStack->AddScreen(m_menuPopup);
369
370 m_menuPopup->SetReturnEvent(this, "version");
371 m_menuPopup->AddButton(tr("Ok"));
372
373}
374
376{
377 if (event->type() == DialogCompletionEvent::kEventType)
378 {
379 auto *dce = (DialogCompletionEvent*)(event);
380
381 QString resultid = dce->GetId();
382 //int buttonnum = dce->GetResult();
383 QString halt_cmd = GetMythDB()->GetSetting("HaltCommand");
384 QString reboot_cmd = GetMythDB()->GetSetting("RebootCommand");
385
386 if (resultid == "popmenu")
387 {
388 QString action = dce->GetData().toString();
389 if (action == "shutdown")
390 {
391 if (!halt_cmd.isEmpty())
392 myth_system(halt_cmd);
393 }
394 else if (action == "reboot")
395 {
396 if (!reboot_cmd.isEmpty())
397 myth_system(reboot_cmd);
398 }
399 else if (action == "about")
400 {
401 aboutScreen();
402 }
403 else if (action == "standby")
404 {
405 QString arg("standby_mode");
407 }
408 else if (action == "exit")
409 {
410 QString arg("exiting_app");
412 }
413 }
414 else if (resultid == "password")
415 {
416 QString text = dce->GetResultText();
418 auto button = item->GetData().value<ThemedButton>();
419 QString password = GetMythDB()->GetSetting(button.password);
420 if (text == password)
421 {
422 QString timestamp_setting = QString("%1Time").arg(button.password);
423 QDateTime curr_time = MythDate::current();
424 QString last_time_stamp =
426 GetMythDB()->SaveSetting(timestamp_setting, last_time_stamp);
427 buttonAction(item, true);
428 }
429 }
430
431 m_menuPopup = nullptr;
432 }
433}
434
440void MythThemedMenu::parseThemeButton(QDomElement &element)
441{
442 QString type;
443 QString text;
444 QStringList action;
445 QString alttext;
446 QString description;
447 QString password;
448
449 bool addit = true;
450
451 for (QDomNode child = element.firstChild(); !child.isNull();
452 child = child.nextSibling())
453 {
454 QDomElement info = child.toElement();
455 if (!info.isNull())
456 {
457 if (info.tagName() == "type")
458 {
460 }
461 else if (info.tagName() == "text")
462 {
463 if (text.isEmpty() &&
464 info.attribute("lang","").isEmpty())
465 {
466 text = QCoreApplication::translate("ThemeUI",
467 parseText(info).toUtf8() );
468 }
469 else if ((info.attribute("lang","").toLower() ==
471 (info.attribute("lang","").toLower() ==
473 {
474 text = parseText(info);
475 }
476 }
477 else if (info.tagName() == "alttext")
478 {
479 if (alttext.isEmpty() &&
480 info.attribute("lang","").isEmpty())
481 {
482 alttext = QCoreApplication::translate("ThemeUI",
483 parseText(info).toUtf8());
484 }
485 else if ((info.attribute("lang","").toLower() ==
487 (info.attribute("lang","").toLower() ==
489 {
490 alttext = parseText(info);
491 }
492 }
493 else if (info.tagName() == "action")
494 {
496 }
497 else if (info.tagName() == "depends")
498 {
499 addit = findDepends(getFirstText(info));
500 }
501 else if (info.tagName() == "dependsexec")
502 {
504 }
505 else if (info.tagName() == "dependssetting")
506 {
507 addit = GetMythDB()->GetBoolSetting(getFirstText(info));
508 }
509 else if (info.tagName() == "dependjumppoint")
510 {
513 }
514 else if (info.tagName() == "dependswindow")
515 {
516 QString xmlFile = info.attribute("xmlfile", "");
517 QString windowName = getFirstText(info);
518 if (xmlFile.isEmpty() || windowName.isEmpty())
519 addit = false;
520 else
521 addit = XMLParseBase::WindowExists(xmlFile, windowName);
522 }
523 else if (info.tagName() == "description")
524 {
525 if (description.isEmpty() &&
526 info.attribute("lang","").isEmpty())
527 {
528 description = QCoreApplication::translate("ThemeUI",
529 getFirstText(info).toUtf8());
530 }
531 else if ((info.attribute("lang","").toLower() ==
533 (info.attribute("lang","").toLower() ==
535 {
536 description = getFirstText(info);
537 }
538 }
539 else if (info.tagName() == "password")
540 {
541 password = getFirstText(info);
542 }
543 else
544 {
545 LOG(VB_GENERAL, LOG_ERR,
546 QString("MythThemedMenu: Unknown tag %1 in button")
547 .arg(info.tagName()));
548 }
549 }
550 }
551
552 if (text.isEmpty())
553 {
554 LOG(VB_GENERAL, LOG_ERR, "MythThemedMenu: Missing 'text' in button");
555 return;
556 }
557
558 if (action.empty())
559 {
560 LOG(VB_GENERAL, LOG_ERR, "MythThemedMenu: Missing 'action' in button");
561 return;
562 }
563
564 if (addit)
565 addButton(type, text, alttext, action, description, password);
566}
567
581bool MythThemedMenu::parseMenu(const QString &menuname)
582{
583 QString filename = findMenuFile(menuname);
584
585 QDomDocument doc;
586 QFile f(filename);
587
588 if (!f.exists() || !f.open(QIODevice::ReadOnly))
589 {
590 LOG(VB_GENERAL, LOG_ERR, QString("MythThemedMenu: Couldn't read "
591 "menu file %1").arg(menuname));
592
593 if (menuname != "mainmenu.xml")
594 ShowOkPopup(tr("MythTV could not locate the menu file %1")
595 .arg(menuname));
596 return false;
597 }
598
599#if QT_VERSION < QT_VERSION_CHECK(6,5,0)
600 QString errorMsg;
601 int errorLine = 0;
602 int errorColumn = 0;
603
604 if (!doc.setContent(&f, false, &errorMsg, &errorLine, &errorColumn))
605 {
606 LOG(VB_GENERAL, LOG_ERR,
607 QString("Error parsing: %1\nat line: %2 column: %3 msg: %4").
608 arg(filename).arg(errorLine).arg(errorColumn).arg(errorMsg));
609 f.close();
610
611 if (menuname != "mainmenu.xml")
612 ShowOkPopup(tr("The menu file %1 is incomplete.")
613 .arg(menuname));
614 return false;
615 }
616#else
617 auto parseResult = doc.setContent(&f);
618 if (!parseResult)
619 {
620 LOG(VB_GENERAL, LOG_ERR,
621 QString("Error parsing: %1\nat line: %2 column: %3 msg: %4")
622 .arg(filename).arg(parseResult.errorLine)
623 .arg(parseResult.errorColumn).arg(parseResult.errorMessage));
624 f.close();
625
626 if (menuname != "mainmenu.xml")
627 ShowOkPopup(tr("The menu file %1 is incomplete.")
628 .arg(menuname));
629 return false;
630 }
631#endif
632
633 f.close();
634
635 LOG(VB_GUI, LOG_INFO, QString("Loading menu theme from %1").arg(filename));
636
637 QDomElement docElem = doc.documentElement();
638
639 m_menumode = docElem.attribute("name", "MAIN");
640
641 QDomNode n = docElem.firstChild();
642 while (!n.isNull())
643 {
644 QDomElement e = n.toElement();
645 if (!e.isNull())
646 {
647 if (e.tagName() == "button")
648 {
650 }
651 else
652 {
653 LOG(VB_GENERAL, LOG_ERR,
654 QString("MythThemedMenu: Unknown element %1")
655 .arg(e.tagName()));
656 return false;
657 }
658 }
659 n = n.nextSibling();
660 }
661
662 if (m_buttonList->GetCount() == 0)
663 {
664 LOG(VB_GENERAL, LOG_ERR,
665 QString("MythThemedMenu: No buttons for menu %1").arg(menuname));
666 return false;
667 }
668
670
671 if (m_titleState)
672 {
675 }
676
677 m_selection.clear();
678 return true;
679}
680
697void MythThemedMenu::addButton(const QString &type, const QString &text,
698 const QString &alttext,
699 const QStringList &action,
700 const QString &description,
701 const QString &password)
702{
703 ThemedButton newbutton;
704 newbutton.type = type;
705 newbutton.action = action;
706 newbutton.text = text;
707 newbutton.alttext = alttext;
708 newbutton.description = description;
709 newbutton.password = password;
710
713
714 auto *listbuttonitem = new MythUIButtonListItem(m_buttonList, text,
715 QVariant::fromValue(newbutton));
716
717 listbuttonitem->DisplayState(type, "icon");
718 listbuttonitem->SetText(description, "description");
719}
720
722{
723 auto button = item->GetData().value<ThemedButton>();
724
725 QString password;
726 if (!skipPass)
727 password = button.password;
728
729 for (const auto & act : std::as_const(button.action))
730 {
731 if (handleAction(act, password))
732 break;
733 }
734}
735
737{
738 buttonAction(item, false);
739}
740
746QString MythThemedMenu::findMenuFile(const QString &menuname)
747{
748 QString testdir = GetConfDir() + '/' + menuname;
749 QFile file(testdir);
750 if (file.exists())
751 return testdir;
752 LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);
753
754 testdir = GetMythUI()->GetMenuThemeDir() + '/' + menuname;
755 file.setFileName(testdir);
756 if (file.exists())
757 return testdir;
758 LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);
759
760 testdir = GetMythUI()->GetThemeDir() + '/' + menuname;
761 file.setFileName(testdir);
762 if (file.exists())
763 return testdir;
764 LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);
765
766 testdir = GetShareDir() + menuname;
767 file.setFileName(testdir);
768 if (file.exists())
769 return testdir;
770 LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);
771
772 testdir = "../mythfrontend/" + menuname;
773 file.setFileName(testdir);
774 if (file.exists())
775 return testdir;
776 LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);
777
778 testdir = GetShareDir() + "themes/defaultmenu/" + menuname;
779 file.setFileName(testdir);
780 if (file.exists())
781 return testdir;
782 LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);
783
784 return {};
785}
786
793bool MythThemedMenu::handleAction(const QString &action, const QString &password)
794{
796
797 if (!password.isEmpty() && !checkPinCode(password))
798 return true;
799
800 if (action.startsWith("EXEC "))
801 {
802 QString rest = action.right(action.length() - 5);
803 if (cbs && cbs->exec_program)
804 cbs->exec_program(rest);
805
806 return false;
807 }
808 if (action.startsWith("EXECTV "))
809 {
810 QString rest = action.right(action.length() - 7).trimmed();
811 if (cbs && cbs->exec_program_tv)
812 cbs->exec_program_tv(rest);
813 }
814 else if (action.startsWith("MENU "))
815 {
816 QString menu = action.right(action.length() - 5);
817
819
820 auto *newmenu = new MythThemedMenu("", menu, stack, menu, false, m_state);
821 if (newmenu->foundTheme())
822 stack->AddScreen(newmenu);
823 else
824 delete newmenu;
825 }
826 else if (action.startsWith("UPMENU"))
827 {
828 m_wantpop = true;
829 }
830 else if (action.startsWith("CONFIGPLUGIN"))
831 {
832 QString rest = action.right(action.length() - 13);
833 if (cbs && cbs->configplugin)
834 cbs->configplugin(rest);
835 }
836 else if (action.startsWith("PLUGIN"))
837 {
838 QString rest = action.right(action.length() - 7);
839 if (cbs && cbs->plugin)
840 cbs->plugin(rest);
841 }
842 else if (action.startsWith("SHUTDOWN"))
843 {
844 if (m_allocedstate)
845 {
846 m_wantpop = true;
847 }
848 }
849 else if (action.startsWith("EJECT"))
850 {
851 if (cbs && cbs->eject)
852 cbs->eject();
853 }
854 else if (action.startsWith("JUMP "))
855 {
856 QString rest = action.right(action.length() - 5);
857 GetMythMainWindow()->JumpTo(rest, false);
858 }
859 else if (action.startsWith("MEDIA "))
860 {
861 // the format is MEDIA HANDLER URL
862 // TODO: allow spaces in the url
863 QStringList list = action.simplified().split(' ');
864 if (list.size() >= 3)
865 GetMythMainWindow()->HandleMedia(list[1], list[2]);
866 }
867 else
868 {
870 if (m_state->m_callback)
872 else
873 LOG(VB_GENERAL, LOG_ERR, "Unknown menu action: " + action);
874 }
875
876 return true;
877}
878
879bool MythThemedMenu::findDepends(const QString &fileList)
880{
881 QStringList files = fileList.split(" ");
883
884 for (const auto & file : std::as_const(files))
885 {
886 QString filename = findMenuFile(file);
887 if (!filename.isEmpty() && filename.endsWith(".xml"))
888 return true;
889
890 // Has plugin by this name been successfully loaded
891 MythPlugin *plugin = pluginManager->GetPlugin(file);
892 if (plugin)
893 return true;
894 }
895
896 return false;
897}
898
900{
901 QFileInfo filename_info(filename);
902
903 return filename_info.exists() && filename_info.isFile() && filename_info.isExecutable();
904}
905
912bool MythThemedMenu::checkPinCode(const QString &password_setting)
913{
914 QString timestamp_setting = QString("%1Time").arg(password_setting);
915 QDateTime curr_time = MythDate::current();
916 QString last_time_stamp = GetMythDB()->GetSetting(timestamp_setting);
917 QString password = GetMythDB()->GetSetting(password_setting);
918
919 // Password empty? Then skip asking for it
920 if (password.isEmpty())
921 return true;
922
923 if (last_time_stamp.length() < 1)
924 {
925 LOG(VB_GENERAL, LOG_ERR,
926 "MythThemedMenu: Could not read password/pin time stamp.\n"
927 "This is only an issue if it happens repeatedly.");
928 }
929 else
930 {
931 QDateTime last_time = MythDate::fromString(last_time_stamp);
932 if (!last_time.isValid() || last_time.secsTo(curr_time) < 120)
933 {
934 last_time_stamp = MythDate::toString(
935 curr_time, MythDate::kDatabase);
936 GetMythDB()->SaveSetting(timestamp_setting, last_time_stamp);
937 return true;
938 }
939 }
940
941 LOG(VB_GENERAL, LOG_INFO, QString("Using Password: %1")
942 .arg(password_setting));
943
944 QString text = tr("Enter password:");
945 MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
946 auto *dialog = new MythTextInputDialog(popupStack, text, FilterNone, true);
947
948 if (dialog->Create())
949 {
950 dialog->SetReturnEvent(this, "password");
951 popupStack->AddScreen(dialog);
952 }
953 else
954 {
955 delete dialog;
956 }
957
958 return false;
959}
960
965{
966 if (!event)
967 return;
968
969 MythMediaDevice *device = event->getDevice();
970
971 if (!device)
972 return;
973
974 MythMediaType type = device->getMediaType();
975 MythMediaStatus status = device->getStatus();
976
977 if ((status & ~MEDIASTAT_USEABLE) &&
978 (status & ~MEDIASTAT_MOUNTED))
979 return;
980
981 switch (type)
982 {
983 case MEDIATYPE_DVD :
984 case MEDIATYPE_BD :
985 // DVD or Blu-ray Available
986 break;
987 default :
988 return;
989 }
990}
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
Definition: mythdialogbox.h:41
static const Type kEventType
Definition: mythdialogbox.h:56
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:213
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:86
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
Definition: mythuitype.cpp:138
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:51
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
QString GetShareDir(void)
Definition: mythdirs.cpp:261
QString GetConfDir(void)
Definition: mythdirs.cpp:263
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