MythTV  master
mythfrontend.cpp
Go to the documentation of this file.
1 // C/C++
2 #include <cerrno>
3 #include <csignal>
4 #include <cstdlib>
5 #include <fcntl.h>
6 #include <iostream>
7 #include <memory>
8 #include "zlib.h"
9 
10 // Qt
11 #include <QtGlobal>
12 #ifdef Q_OS_ANDROID
13 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
14 #include <QtAndroidExtras>
15 #else
16 #include <QCoreApplication>
17 #include <QJniObject>
18 #define QAndroidJniObject QJniObject
19 #endif
20 #endif
21 #include <QApplication>
22 #include <QDir>
23 #include <QEvent>
24 #include <QFile>
25 #include <QFileInfo>
26 #include <QKeyEvent>
27 #include <QMap>
28 #ifdef Q_OS_DARWIN
29 #include <QProcessEnvironment>
30 #endif
31 #include <QTimer>
32 
33 // MythTV
35 #include "libmythui/langsettings.h"
36 #include "libmyth/mythcontext.h"
39 #include "libmythbase/compat.h" // For SIG* on MinGW
40 #include "libmythbase/exitcodes.h"
42 #include "libmythbase/lcddevice.h"
43 #include "libmythbase/mythcdrom.h"
44 #include "libmythbase/mythconfig.h"
45 #include "libmythbase/mythdb.h"
46 #include "libmythbase/mythdbcon.h"
47 #include "libmythbase/mythdirs.h"
49 #include "libmythbase/mythplugin.h"
52 #include "libmythbase/mythversion.h"
55 #include "libmythbase/remoteutil.h"
59 #include "libmythtv/channelutil.h"
60 #include "libmythtv/dbcheck.h"
62 #include "libmythtv/playgroup.h"
65 #include "libmythtv/tv.h"
66 #include "libmythtv/tvremoteutil.h"
67 #include "libmythui/mediamonitor.h"
70 #include "libmythui/mythuihelper.h"
71 #include "libmythupnp/taskqueue.h"
72 
73 // MythFrontend
74 #include "audiogeneralsettings.h"
76 #include "channelrecpriority.h"
77 #include "customedit.h"
78 #include "custompriority.h"
79 #include "exitprompt.h"
80 #include "globalsettings.h"
81 #include "grabbersettings.h"
82 #include "guidegrid.h"
83 #include "idlescreen.h"
84 #include "manualschedule.h"
85 #include "mediarenderer.h"
86 #include "mythcontrols.h"
88 #include "networkcontrol.h"
89 #include "playbackbox.h"
90 #include "prevreclist.h"
91 #include "progfind.h"
92 #include "proglist.h"
93 #include "programrecpriority.h"
94 #include "scheduleeditor.h"
95 #include "settingshelper.h"
96 #include "setupwizard_general.h"
97 #include "statusbox.h"
98 #include "themechooser.h"
99 #include "viewscheduled.h"
100 
101 // Video
102 #include "videodlg.h"
103 #include "videoglobalsettings.h"
104 #include "videofileassoc.h"
105 #include "videoplayersettings.h"
106 #include "videometadatasettings.h"
107 #include "videolist.h"
108 
109 // Gallery
110 #include "gallerythumbview.h"
111 
112 // DVD & Bluray
116 
117 // AirPlay
118 #ifdef USING_AIRPLAY
121 #endif
122 
123 #ifdef USING_LIBDNS_SD
124 #include <QScopedPointer>
126 #endif
127 #if CONFIG_SYSTEMD_NOTIFY
128 #include <systemd/sd-daemon.h>
129 static inline void fe_sd_notify(const char *str) { sd_notify(0, str); };
130 #else
131 static inline void fe_sd_notify(const char */*str*/) {};
132 #endif
133 
138 
139 static MythThemedMenu *g_menu;
140 
141 static MediaRenderer *g_pUPnp = nullptr;
142 static MythPluginManager *g_pmanager = nullptr;
143 
145 
146 static void handleExit(bool prompt);
147 static void resetAllKeys(void);
148 void handleSIGUSR1(void);
149 void handleSIGUSR2(void);
150 
151 #ifdef Q_OS_DARWIN
152 static bool gLoaded = false;
153 #endif
154 
155 static const QString sLocation = QCoreApplication::translate("(Common)",
156  "MythFrontend");
157 
158 namespace
159 {
160  class RunSettingsCompletion : public QObject
161  {
162  Q_OBJECT
163 
164  public:
165  static void Create(bool check)
166  {
167  new RunSettingsCompletion(check);
168  }
169 
170  private:
171  explicit RunSettingsCompletion(bool check)
172  {
173  if (check)
174  {
176  this, &RunSettingsCompletion::OnPasswordResultReady);
178  }
179  else
180  {
181  OnPasswordResultReady(true, ParentalLevel::plHigh);
182  }
183  }
184 
185  ~RunSettingsCompletion() override = default;
186 
187  private slots:
188  void OnPasswordResultReady(bool passwordValid,
189  ParentalLevel::Level newLevel)
190  {
191  (void) newLevel;
192 
193  if (passwordValid)
194  {
196  auto *ssd =
197  new StandardSettingDialog(mainStack, "videogeneralsettings",
198  new VideoGeneralSettings());
199 
200  if (ssd->Create())
201  {
202  mainStack->AddScreen(ssd);
203  }
204  else
205  {
206  delete ssd;
207  }
208  }
209  else
210  {
211  LOG(VB_GENERAL, LOG_WARNING,
212  "Aggressive Parental Controls Warning: "
213  "invalid password. An attempt to enter a "
214  "MythVideo settings screen was prevented.");
215  }
216 
217  deleteLater();
218  }
219 
220  public:
222  };
223 
228  {
229  Q_DECLARE_TR_FUNCTIONS(BookmarkDialog)
230 
231  public:
233  bool bookmarkPresent, bool lastPlayPresent) :
234  MythScreenType(parent, "bookmarkdialog"),
235  m_pgi(pginfo),
236  m_bookmarked(bookmarkPresent),
237  m_lastPlayed(lastPlayPresent),
238  m_btnPlayBookmark(tr("Play from bookmark")),
239  m_btnClearBookmark(tr("Clear bookmark")),
240  m_btnPlayBegin(tr("Play from beginning")),
241  m_btnPlayLast(tr("Play from last played position")),
242  m_btnClearLast(tr("Clear last played position")) {
243  }
244 
245  bool Create() override // MythScreenType
246  {
247  QString msg = tr("DVD/Video contains a bookmark");
248 
249  m_videoDlg = dynamic_cast<VideoDialog*>(GetScreenStack()->GetTopScreen());
250  auto *popup = new MythDialogBox(msg, GetScreenStack(), "bookmarkdialog");
251  if (!popup->Create())
252  {
253  delete popup;
254  return false;
255  }
256 
257  GetScreenStack()->AddScreen(popup);
258 
259  popup->SetReturnEvent(this, "bookmarkdialog");
260  if (m_lastPlayed)
261  popup->AddButton(m_btnPlayLast);
262  if (m_bookmarked)
263  popup->AddButton(m_btnPlayBookmark);
264  popup->AddButton(m_btnPlayBegin);
265  if (m_lastPlayed)
266  popup->AddButton(m_btnClearLast);
267  if (m_bookmarked)
268  popup->AddButton(m_btnClearBookmark);
269  return true;
270  }
271 
272  void customEvent(QEvent *event) override // MythUIType
273  {
274  if (event->type() != DialogCompletionEvent::kEventType)
275  return;
276 
277  auto *dce = (DialogCompletionEvent*)(event);
278  QString buttonText = dce->GetResultText();
279 
280  if (dce->GetId() != "bookmarkdialog")
281  return;
282 
283  if (buttonText == m_btnPlayLast)
285  else if (buttonText == m_btnPlayBookmark)
287  else if (buttonText == m_btnPlayBegin)
289  else if (buttonText == m_btnClearBookmark)
290  {
291  m_pgi->SaveBookmark(0);
292  if (m_videoDlg)
293  {
294  m_videoDlg->playbackStateChanged(m_pgi->GetBasename());
295  }
296  }
297  else if (buttonText == m_btnClearLast)
298  {
299  m_pgi->SaveLastPlayPos(0);
300  if (m_videoDlg)
301  {
302  m_videoDlg->playbackStateChanged(m_pgi->GetBasename());
303  }
304  }
305  delete m_pgi;
306  }
307 
308  private:
309  ProgramInfo* m_pgi {nullptr};
310  bool m_bookmarked {false};
311  bool m_lastPlayed {false};
314  QString m_btnPlayBegin;
315  QString m_btnPlayLast;
316  QString m_btnClearLast;
317  VideoDialog *m_videoDlg {nullptr};
318  };
319 
320  void cleanup()
321  {
322  QCoreApplication::processEvents();
324 #ifdef USING_AIRPLAY
327 #endif
328 
330 
331  if (g_pUPnp)
332  {
333  // This takes a few seconds, so inform the user:
334  LOG(VB_GENERAL, LOG_INFO, "Shutting down UPnP client...");
335  delete g_pUPnp;
336  g_pUPnp = nullptr;
337  }
338 
339  if (g_pmanager)
340  {
341  delete g_pmanager;
342  g_pmanager = nullptr;
343  }
344 
345  if (g_settingsHelper)
346  {
347  delete g_settingsHelper;
348  g_settingsHelper = nullptr;
349  }
350 
351  delete gContext;
352  gContext = nullptr;
353 
355 
357  }
358 }
359 
360 static void startAppearWiz(void)
361 {
362  int curX = gCoreContext->GetNumSetting("GuiOffsetX", 0);
363  int curY = gCoreContext->GetNumSetting("GuiOffsetY", 0);
364  int curW = gCoreContext->GetNumSetting("GuiWidth", 0);
365  int curH = gCoreContext->GetNumSetting("GuiHeight", 0);
366 
367  bool isWindowed =
368  (gCoreContext->GetNumSetting("RunFrontendInWindow", 0) == 1);
369 
370  bool reload = false;
371 
372  if (isWindowed)
373  {
374  ShowOkPopup(QCoreApplication::translate("(MythFrontendMain)",
375  "The ScreenSetupWizard cannot be used while "
376  "mythfrontend is operating in windowed mode."));
377  }
378  else
379  {
380  auto *wizard = new MythSystemLegacy(
381  GetAppBinDir() + "mythscreenwizard",
382  QStringList(),
384  wizard->Run();
385 
386  if (!wizard->Wait())
387  {
388  // no reported errors, check for changed geometry parameters
389  gCoreContext->ClearSettingsCache("GuiOffsetX");
390  gCoreContext->ClearSettingsCache("GuiOffsetY");
391  gCoreContext->ClearSettingsCache("GuiWidth");
392  gCoreContext->ClearSettingsCache("GuiHeight");
393 
394  if ((curX != gCoreContext->GetNumSetting("GuiOffsetX", 0)) ||
395  (curY != gCoreContext->GetNumSetting("GuiOffsetY", 0)) ||
396  (curW != gCoreContext->GetNumSetting("GuiWidth", 0)) ||
397  (curH != gCoreContext->GetNumSetting("GuiHeight", 0)))
398  reload = true;
399  }
400 
401  delete wizard;
402  wizard = nullptr;
403  }
404 
405  if (reload)
406  GetMythMainWindow()->JumpTo("Reload Theme");
407 }
408 
409 static void startKeysSetup()
410 {
412 
413  auto *mythcontrols = new MythControls(mainStack, "mythcontrols");
414 
415  if (mythcontrols->Create())
416  mainStack->AddScreen(mythcontrols);
417  else
418  delete mythcontrols;
419 }
420 
421 static void startGuide(void)
422 {
423  uint chanid = 0;
424  QString channum = gCoreContext->GetSetting("DefaultTVChannel");
425  QDateTime startTime;
426  GuideGrid::RunProgramGuide(chanid, channum, startTime, nullptr, false, true, -2);
427 }
428 
429 static void startFinder(void)
430 {
432 }
433 
434 static void startSearchTitle(void)
435 {
437  auto *pl = new ProgLister(mainStack, plTitleSearch, "", "");
438  if (pl->Create())
439  mainStack->AddScreen(pl);
440  else
441  delete pl;
442 }
443 
444 static void startSearchKeyword(void)
445 {
447  auto *pl = new ProgLister(mainStack, plKeywordSearch, "", "");
448  if (pl->Create())
449  mainStack->AddScreen(pl);
450  else
451  delete pl;
452 }
453 
454 static void startSearchPeople(void)
455 {
457  auto *pl = new ProgLister(mainStack, plPeopleSearch, "", "");
458  if (pl->Create())
459  mainStack->AddScreen(pl);
460  else
461  delete pl;
462 }
463 
464 static void startSearchPower(void)
465 {
467  auto *pl = new ProgLister(mainStack, plPowerSearch, "", "");
468  if (pl->Create())
469  mainStack->AddScreen(pl);
470  else
471  delete pl;
472 }
473 
474 static void startSearchStored(void)
475 {
477  auto *pl = new ProgLister(mainStack, plStoredSearch, "", "");
478  if (pl->Create())
479  mainStack->AddScreen(pl);
480  else
481  delete pl;
482 }
483 
484 static void startSearchChannel(void)
485 {
487  auto *pl = new ProgLister(mainStack, plChannel, "", "");
488  if (pl->Create())
489  mainStack->AddScreen(pl);
490  else
491  delete pl;
492 }
493 
494 static void startSearchCategory(void)
495 {
497  auto *pl = new ProgLister(mainStack, plCategory, "", "");
498  if (pl->Create())
499  mainStack->AddScreen(pl);
500  else
501  delete pl;
502 }
503 
504 static void startSearchMovie(void)
505 {
507  auto *pl = new ProgLister(mainStack, plMovies, "", "");
508  if (pl->Create())
509  mainStack->AddScreen(pl);
510  else
511  delete pl;
512 }
513 
514 static void startSearchNew(void)
515 {
517  auto *pl = new ProgLister(mainStack, plNewListings, "", "");
518  if (pl->Create())
519  mainStack->AddScreen(pl);
520  else
521  delete pl;
522 }
523 
524 static void startSearchTime(void)
525 {
527  auto *pl = new ProgLister(mainStack, plTime, "", "");
528  if (pl->Create())
529  mainStack->AddScreen(pl);
530  else
531  delete pl;
532 }
533 
534 static void startManaged(void)
535 {
537 
538  auto *viewsched = new ViewScheduled(mainStack);
539 
540  if (viewsched->Create())
541  mainStack->AddScreen(viewsched);
542  else
543  delete viewsched;
544 }
545 
546 static void startManageRecordingRules(void)
547 {
549 
550  auto *progRecPrior = new ProgramRecPriority(mainStack, "ManageRecRules");
551 
552  if (progRecPrior->Create())
553  mainStack->AddScreen(progRecPrior);
554  else
555  delete progRecPrior;
556 }
557 
558 static void startChannelRecPriorities(void)
559 {
561 
562  auto *chanRecPrior = new ChannelRecPriority(mainStack);
563 
564  if (chanRecPrior->Create())
565  mainStack->AddScreen(chanRecPrior);
566  else
567  delete chanRecPrior;
568 }
569 
570 static void startCustomPriority(void)
571 {
573 
574  auto *custom = new CustomPriority(mainStack);
575 
576  if (custom->Create())
577  mainStack->AddScreen(custom);
578  else
579  delete custom;
580 }
581 
582 static void startPlaybackWithGroup(const QString& recGroup = "")
583 {
585 
586  auto *pbb = new PlaybackBox(mainStack, "playbackbox");
587 
588  if (pbb->Create())
589  {
590  if (!recGroup.isEmpty())
591  pbb->setInitialRecGroup(recGroup);
592 
593  mainStack->AddScreen(pbb);
594  }
595  else
596  {
597  delete pbb;
598  }
599 }
600 
601 static void startPlayback(void)
602 {
604 }
605 
606 static void startPrevious(void)
607 {
609  auto *pl = new PrevRecordedList(mainStack);
610  if (pl->Create())
611  mainStack->AddScreen(pl);
612  else
613  delete pl;
614 }
615 
616 static void startPreviousOld(void)
617 {
619  auto *pl = new ProgLister(mainStack);
620  if (pl->Create())
621  mainStack->AddScreen(pl);
622  else
623  delete pl;
624 }
625 
626 static void startCustomEdit(void)
627 {
629  auto *custom = new CustomEdit(mainStack);
630 
631  if (custom->Create())
632  mainStack->AddScreen(custom);
633  else
634  delete custom;
635 }
636 
637 static void startManualSchedule(void)
638 {
640 
641  auto *mansched= new ManualSchedule(mainStack);
642 
643  if (mansched->Create())
644  mainStack->AddScreen(mansched);
645  else
646  delete mansched;
647 }
648 
649 static bool isLiveTVAvailable(void)
650 {
651  if (RemoteGetFreeRecorderCount() > 0)
652  return true;
653 
654  QString msg = QCoreApplication::translate("(Common)", "All tuners are currently busy.");
655 
656  if (TV::ConfiguredTunerCards() < 1)
657  msg = QCoreApplication::translate("(Common)", "There are no configured tuners.");
658 
659  ShowOkPopup(msg);
660  return false;
661 }
662 
663 static void startTVNormal(void)
664 {
665  if (!isLiveTVAvailable())
666  return;
667 
668  // Get the default channel keys (callsign(0) and channum(1)) and
669  // use them to generate the ordered list of channels.
670  QStringList keylist = gCoreContext->GetSettingOnHost(
671  "DefaultChanKeys", gCoreContext->GetHostName()).split("[]:[]");
672  while (keylist.size() < 2)
673  keylist << "";
674  uint dummy = 0;
676  0, // startIndex
677  0, // count
678  dummy, // totalAvailable
679  true, // ignoreHidden
682  0, // sourceID
683  0, // channelGroupID
684  true, // liveTVOnly
685  keylist[0], // callsign
686  keylist[1]); // channum
687 
688  TV::StartTV(nullptr, kStartTVNoFlags, livetvchannels);
689 }
690 
691 static void showStatus(void)
692 {
694 
695  auto *statusbox = new StatusBox(mainStack);
696 
697  if (statusbox->Create())
698  mainStack->AddScreen(statusbox);
699  else
700  delete statusbox;
701 }
702 
703 
704 static void standbyScreen(void)
705 {
707 
708  auto *idlescreen = new IdleScreen(mainStack);
709 
710  if (idlescreen->Create())
711  mainStack->AddScreen(idlescreen);
712  else
713  delete idlescreen;
714 }
715 
716 static void RunVideoScreen(VideoDialog::DialogType type, bool fromJump = false)
717 {
718  QString message = QCoreApplication::translate("(MythFrontendMain)",
719  "Loading videos ...");
720 
721  MythScreenStack *popupStack =
722  GetMythMainWindow()->GetStack("popup stack");
723 
724  auto *busyPopup = new MythUIBusyDialog(message, popupStack,
725  "mythvideobusydialog");
726 
727  if (busyPopup->Create())
728  popupStack->AddScreen(busyPopup, false);
729 
731 
732  VideoDialog::VideoListPtr video_list;
733  if (fromJump)
734  {
737  if (!saved.isNull())
738  {
739  video_list = saved->GetSaved();
740  LOG(VB_GENERAL, LOG_INFO,
741  QString("Reusing saved video list because MythVideo was resumed"
742  " within %1ms").arg(VideoListDeathDelay::kDelayTimeMS.count()));
743  }
744  }
745 
746  VideoDialog::BrowseType browse = static_cast<VideoDialog::BrowseType>(
747  gCoreContext->GetNumSetting("mythvideo.db_group_type",
749 
750  if (!video_list)
751  video_list = new VideoList;
752 
753  auto *mythvideo =
754  new VideoDialog(mainStack, "mythvideo", video_list, type, browse);
755 
756  if (mythvideo->Create())
757  {
758  busyPopup->Close();
759  mainStack->AddScreen(mythvideo);
760  }
761  else
762  {
763  busyPopup->Close();
764  }
765 }
766 
772 
773 static void RunGallery()
774 {
776  auto *galleryView = new GalleryThumbView(mainStack, "galleryview");
777  if (galleryView->Create())
778  {
779  mainStack->AddScreen(galleryView);
780  galleryView->Start();
781  }
782  else
783  {
784  delete galleryView;
785  }
786 }
787 
788 static void playDisc()
789 {
790  //
791  // Get the command string to play a DVD
792  //
793 
794  bool isBD = false;
795 
796  QString command_string =
797  gCoreContext->GetSetting("mythdvd.DVDPlayerCommand");
798  QString bluray_mountpoint =
799  gCoreContext->GetSetting("BluRayMountpoint", "/media/cdrom");
800  QDir bdtest(bluray_mountpoint + "/BDMV");
801 
802  if (bdtest.exists() || MythCDROM::inspectImage(bluray_mountpoint) == MythCDROM::kBluray)
803  isBD = true;
804 
805  if (isBD)
806  {
807  GetMythUI()->AddCurrentLocation("playdisc");
808 
809  QString filename = QString("bd:/%1").arg(bluray_mountpoint);
810 
811  GetMythMainWindow()->HandleMedia("Internal", filename, "", "", "", "",
812  0, 0, "", 0min, "", "", true);
813 
815  }
816  else
817  {
818  QString dvd_device = MediaMonitor::defaultDVDdevice();
819 
820  if (dvd_device.isEmpty())
821  return; // User cancelled in the Popup
822 
823  GetMythUI()->AddCurrentLocation("playdisc");
824 
825  if ((command_string.indexOf("internal", 0, Qt::CaseInsensitive) > -1) ||
826  (command_string.length() < 1))
827  {
828 #ifdef Q_OS_DARWIN
829  // Convert a BSD 'leaf' name into a raw device path
830  QString filename = "dvd://dev/r"; // e.g. 'dvd://dev/rdisk2'
831 #elif defined(_WIN32)
832  QString filename = "dvd:"; // e.g. 'dvd:E\\'
833 #else
834  QString filename = "dvd:/"; // e.g. 'dvd://dev/sda'
835 #endif
836  filename += dvd_device;
837 
838  command_string = "Internal";
839  GetMythMainWindow()->HandleMedia(command_string, filename, "", "",
840  "", "", 0, 0, "", 0min, "", "", true);
842 
843  return;
844  }
845 
846  if (command_string.contains("%d"))
847  {
848  //
849  // Need to do device substitution
850  //
851  command_string = command_string.replace("%d", dvd_device);
852  }
855  myth_system(command_string);
858  if (GetMythMainWindow())
859  {
860  GetMythMainWindow()->raise();
861  GetMythMainWindow()->activateWindow();
862  }
864  }
865 }
866 
871 {
872  if (!dvd)
873  return;
874 
875  if (!dvd->isUsable()) // This isn't infallible, on some drives both a mount and libudf fail
876  return;
877 
878  switch (gCoreContext->GetNumSetting("DVDOnInsertDVD", 1))
879  {
880  case 0 : // Do nothing
881  case 1 : // Display menu (mythdvd)*/
882  break;
883  case 2 : // play DVD or Blu-ray
884  playDisc();
885  break;
886  default:
887  LOG(VB_GENERAL, LOG_ERR,
888  "mythdvd main.o: handleMedia() does not know what to do");
889  }
890 }
891 
893 {
894  // Only handle events for media that are newly mounted
895  if (!dev || (dev->getStatus() != MEDIASTAT_MOUNTED
896  && dev->getStatus() != MEDIASTAT_USEABLE))
897  return;
898 
899  // Check if gallery is already running
900  QVector<MythScreenType*> screens;
902 
903 
904  for (const auto *screen : std::as_const(screens))
905  {
906  if (qobject_cast<const GalleryThumbView*>(screen))
907  {
908  // Running gallery will receive this event later
909  LOG(VB_MEDIA, LOG_INFO, "Main: Ignoring new gallery media - already running");
910  return;
911  }
912  }
913 
914  if (gCoreContext->GetBoolSetting("GalleryAutoLoad", false))
915  {
916  LOG(VB_GUI, LOG_INFO, "Main: Autostarting Gallery for new media");
918  }
919  else
920  {
921  LOG(VB_MEDIA, LOG_INFO, "Main: Ignoring new gallery media - autorun not set");
922  }
923 }
924 
925 static void TVMenuCallback([[maybe_unused]] void *data, QString &selection)
926 {
927  QString sel = selection.toLower();
928 
929  if (sel.startsWith("settings ") || sel == "video_settings_general")
930  {
931  if (!g_settingsHelper)
933 
935  }
936 
937  if (sel == "tv_watch_live")
938  startTVNormal();
939  else if (sel.startsWith("tv_watch_recording"))
940  {
941  // use selection here because its case is untouched
942  if ((selection.length() > 19) && (selection.mid(18, 1) == " "))
943  startPlaybackWithGroup(selection.mid(19));
944  else
945  startPlayback();
946  }
947  else if (sel == "tv_schedule")
948  {
949  startGuide();
950  }
951  else if (sel == "tv_manualschedule")
952  {
954  }
955  else if (sel == "tv_custom_record")
956  {
957  startCustomEdit();
958  }
959  else if (sel == "tv_fix_conflicts")
960  {
961  startManaged();
962  }
963  else if (sel == "tv_manage_recording_rules")
964  {
966  }
967  else if (sel == "tv_progfind")
968  {
969  startFinder();
970  }
971  else if (sel == "tv_search_title")
972  {
974  }
975  else if (sel == "tv_search_keyword")
976  {
978  }
979  else if (sel == "tv_search_people")
980  {
982  }
983  else if (sel == "tv_search_power")
984  {
986  }
987  else if (sel == "tv_search_stored")
988  {
990  }
991  else if (sel == "tv_search_channel")
992  {
994  }
995  else if (sel == "tv_search_category")
996  {
998  }
999  else if (sel == "tv_search_movie")
1000  {
1001  startSearchMovie();
1002  }
1003  else if (sel == "tv_search_new")
1004  {
1005  startSearchNew();
1006  }
1007  else if (sel == "tv_search_time")
1008  {
1009  startSearchTime();
1010  }
1011  else if (sel == "tv_previous")
1012  {
1013  startPrevious();
1014  }
1015  else if (sel == "tv_previous_old")
1016  {
1017  startPreviousOld();
1018  }
1019  else if (sel == "settings appearance")
1020  {
1022  auto *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings",
1023  new AppearanceSettings());
1024 
1025  if (ssd->Create())
1026  {
1027  mainStack->AddScreen(ssd);
1028  }
1029  else
1030  {
1031  delete ssd;
1032  }
1033  }
1034  else if (sel == "settings themechooser")
1035  {
1037  auto *tp = new ThemeChooser(mainStack);
1038 
1039  if (tp->Create())
1040  mainStack->AddScreen(tp);
1041  else
1042  delete tp;
1043  }
1044  else if (sel == "settings setupwizard")
1045  {
1047  auto *sw = new GeneralSetupWizard(mainStack, "setupwizard");
1048 
1049  if (sw->Create())
1050  mainStack->AddScreen(sw);
1051  else
1052  delete sw;
1053  }
1054  else if (sel == "settings grabbers")
1055  {
1057  auto *gs = new GrabberSettings(mainStack, "grabbersettings");
1058 
1059  if (gs->Create())
1060  mainStack->AddScreen(gs);
1061  else
1062  delete gs;
1063  }
1064  else if (sel == "screensetupwizard")
1065  {
1066  startAppearWiz();
1067  }
1068  else if (sel == "setup_keys")
1069  {
1070  startKeysSetup();
1071  }
1072  else if (sel == "settings playgroup")
1073  {
1075  auto *ssd = new StandardSettingDialog(mainStack, "playbackgroupsetting",
1076  new PlayGroupEditor());
1077 
1078  if (ssd->Create())
1079  {
1080  mainStack->AddScreen(ssd);
1081  }
1082  else
1083  {
1084  delete ssd;
1085  }
1086  }
1087  else if (sel == "settings general")
1088  {
1090  auto *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings",
1091  new GeneralSettings());
1092 
1093  if (ssd->Create())
1094  {
1095  mainStack->AddScreen(ssd);
1096  }
1097  else
1098  {
1099  delete ssd;
1100  }
1101  }
1102  else if (sel == "settings audiogeneral")
1103  {
1105  StandardSettingDialog *ssd =
1106  new AudioConfigScreen(mainStack, "audiogeneralsettings",
1107  new AudioConfigSettings());
1108 
1109  if (ssd->Create())
1110  {
1111  mainStack->AddScreen(ssd);
1112  }
1113  else
1114  {
1115  delete ssd;
1116  }
1117  }
1118  else if (sel == "settings maingeneral")
1119  {
1121  auto *ssd = new StandardSettingDialog(mainStack, "maingeneralsettings",
1122  new MainGeneralSettings());
1123 
1124  if (ssd->Create())
1125  {
1126  mainStack->AddScreen(ssd);
1127  }
1128  else
1129  {
1130  delete ssd;
1131  }
1132  }
1133  else if (sel == "settings playback")
1134  {
1136  StandardSettingDialog *ssd =
1137  new PlaybackSettingsDialog(mainStack);
1138 
1139  if (ssd->Create())
1140  {
1141  mainStack->AddScreen(ssd);
1142  }
1143  else
1144  {
1145  delete ssd;
1146  }
1147  }
1148  else if (sel == "settings osd")
1149  {
1151  auto *ssd = new StandardSettingDialog(mainStack, "osdsettings",
1152  new OSDSettings());
1153 
1154  if (ssd->Create())
1155  {
1156  mainStack->AddScreen(ssd);
1157  }
1158  else
1159  {
1160  delete ssd;
1161  }
1162  }
1163  else if (sel == "settings epg")
1164  {
1166  auto *ssd = new StandardSettingDialog(mainStack, "epgsettings",
1167  new EPGSettings());
1168 
1169  if (ssd->Create())
1170  {
1171  mainStack->AddScreen(ssd);
1172  }
1173  else
1174  {
1175  delete ssd;
1176  }
1177  }
1178  else if (sel == "settings channelgroups")
1179  {
1181  auto *ssd = new StandardSettingDialog(mainStack, "channelgroupssettings",
1182  new ChannelGroupsSetting());
1183 
1184  if (ssd->Create())
1185  {
1186  mainStack->AddScreen(ssd);
1187  }
1188  else
1189  {
1190  delete ssd;
1191  }
1192  }
1193  else if (sel == "settings generalrecpriorities")
1194  {
1196  auto *ssd = new StandardSettingDialog(mainStack,
1197  "generalrecprioritiessettings",
1199 
1200  if (ssd->Create())
1201  {
1202  mainStack->AddScreen(ssd);
1203  }
1204  else
1205  {
1206  delete ssd;
1207  }
1208  }
1209  else if (sel == "settings channelrecpriorities")
1210  {
1212  }
1213  else if (sel == "settings custompriority")
1214  {
1216  }
1217  else if (sel == "system_events")
1218  {
1220 
1221  auto *msee = new MythSystemEventEditor(mainStack, "System Event Editor");
1222 
1223  if (msee->Create())
1224  mainStack->AddScreen(msee);
1225  else
1226  delete msee;
1227  }
1228  else if (sel == "video_settings_general")
1229  {
1230  RunSettingsCompletion::Create(gCoreContext->
1231  GetBoolSetting("VideoAggressivePC", false));
1232  }
1233  else if (sel == "video_settings_player")
1234  {
1236 
1237  auto *ps = new PlayerSettings(mainStack, "player settings");
1238 
1239  if (ps->Create())
1240  mainStack->AddScreen(ps);
1241  else
1242  delete ps;
1243  }
1244  else if (sel == "video_settings_metadata")
1245  {
1247 
1248  auto *ms = new MetadataSettings(mainStack, "metadata settings");
1249 
1250  if (ms->Create())
1251  mainStack->AddScreen(ms);
1252  else
1253  delete ms;
1254  }
1255  else if (sel == "video_settings_associations")
1256  {
1258 
1259  auto *fa = new FileAssocDialog(mainStack, "fa dialog");
1260 
1261  if (fa->Create())
1262  mainStack->AddScreen(fa);
1263  }
1264  else if (sel == "manager")
1265  {
1267  }
1268  else if (sel == "browser")
1269  {
1271  }
1272  else if (sel == "listing")
1273  {
1275  }
1276  else if (sel == "gallery")
1277  {
1279  }
1280  else if (sel == "disc_play")
1281  {
1282  playDisc();
1283  }
1284  else if (sel == "tv_status")
1285  {
1286  showStatus();
1287  }
1288  else if (sel == "exiting_app_prompt")
1289  {
1290  handleExit(true);
1291  }
1292  else if (sel == "exiting_app")
1293  {
1294  handleExit(false);
1295  }
1296  else if (sel == "standby_mode")
1297  {
1298  standbyScreen();
1299  }
1300  else if (sel == "exiting_menu")
1301  {
1302  //ignore
1303  }
1304  else
1305  {
1306  LOG(VB_GENERAL, LOG_ERR, "Unknown menu action: " + selection);
1307  }
1308 
1309  if (sel.startsWith("settings ") || sel == "video_settings_general")
1310  {
1311  if (g_settingsHelper)
1312  {
1313  QObject::connect(GetMythMainWindow()->GetMainStack()->GetTopScreen(),
1316  }
1317  }
1318 }
1319 
1320 static void handleExit(bool prompt)
1321 {
1322  if (prompt)
1323  {
1324  auto * prompter = new ExitPrompter();
1325  prompter->HandleExit();
1326  }
1327  else
1328  {
1330  }
1331 }
1332 
1333 static bool RunMenu(const QString& themedir, const QString& themename)
1334 {
1335  QByteArray tmp = themedir.toLocal8Bit();
1336  g_menu = new MythThemedMenu(QString(tmp.constData()), "mainmenu.xml",
1337  GetMythMainWindow()->GetMainStack(), "mainmenu");
1338 
1339  if (g_menu->foundTheme())
1340  {
1341  LOG(VB_GENERAL, LOG_NOTICE, QString("Found mainmenu.xml for theme '%1'")
1342  .arg(themename));
1345  return true;
1346  }
1347 
1348  LOG(VB_GENERAL, LOG_ERR, QString("Couldn't find mainmenu.xml for theme '%1'")
1349  .arg(themename));
1350  delete g_menu;
1351  g_menu = nullptr;
1352  return false;
1353 }
1354 
1355 // If any settings are missing from the database, this will write
1356 // the default values
1357 static void WriteDefaults()
1358 {
1359  PlaybackSettings ps;
1360  ps.Load();
1361  ps.Save();
1362  OSDSettings os;
1363  os.Load();
1364  os.Save();
1365  GeneralSettings gs;
1366  gs.Load();
1367  gs.Save();
1368  EPGSettings es;
1369  es.Load();
1370  es.Save();
1371  AppearanceSettings as;
1372  as.Load();
1373  as.Save();
1374  MainGeneralSettings mgs;
1375  mgs.Load();
1376  mgs.Save();
1378  grs.Load();
1379  grs.Save();
1381  vgs.Load();
1382  vgs.Save();
1383  //TODo Playback group not loaded?
1384  //TODo Channel group not loaded?
1385 }
1386 
1387 static int internal_play_media(const QString &mrl, const QString &plot,
1388  const QString &title, const QString &subtitle,
1389  const QString &director, int season, int episode,
1390  const QString &inetref, std::chrono::minutes lenMins,
1391  const QString &year,
1392  const QString &id, const bool useBookmark)
1393 {
1394  int res = -1;
1395 
1396  QFile checkFile(mrl);
1397  if ((!checkFile.exists() && !mrl.startsWith("dvd:")
1398  && !mrl.startsWith("bd:")
1399  && !mrl.startsWith("myth:")
1400  && !mrl.startsWith("http://")
1401  && !mrl.startsWith("https://")))
1402  {
1403  QString errorText = QCoreApplication::translate("(MythFrontendMain)",
1404  "Failed to open \n '%1' in %2 \n"
1405  "Check if the video exists")
1406  .arg(mrl.section('/', -1),
1407  mrl.section('/', 0, -2));
1408 
1409  ShowOkPopup(errorText);
1410  return res;
1411  }
1412 
1413  auto *pginfo = new ProgramInfo(
1414  mrl, plot, title, QString(), subtitle, QString(),
1415  director, season, episode, inetref, lenMins,
1416  (year.toUInt()) ? year.toUInt() : 1900, id);
1417 
1418  pginfo->SetProgramInfoType(pginfo->DiscoverProgramInfoType());
1419 
1420  bool bookmarkPresent = false;
1421  bool lastPlayPresent = false;
1422 
1423  if (pginfo->IsVideoDVD())
1424  {
1425  auto *dvd = new MythDVDInfo(pginfo->GetPlaybackURL());
1426  if (dvd->IsValid())
1427  {
1428  QString name;
1429  QString serialid;
1430  if (dvd->GetNameAndSerialNum(name, serialid))
1431  {
1432  QStringList fields = pginfo->QueryDVDBookmark(serialid);
1433  bookmarkPresent = (fields.count() > 0);
1434  }
1435  }
1436  else
1437  {
1438  ShowNotificationError(QCoreApplication::translate("(MythFrontendMain)",
1439  "DVD Failure"),
1440  sLocation,
1441  dvd->GetLastError());
1442  delete dvd;
1443  delete pginfo;
1444  return res;
1445  }
1446  delete dvd;
1447  }
1448  else if (pginfo->IsVideoBD())
1449  {
1450  MythBDInfo bd(pginfo->GetPlaybackURL());
1451  if (bd.IsValid())
1452  {
1453  QString name;
1454  QString serialid;
1455  if (bd.GetNameAndSerialNum(name, serialid))
1456  {
1457  QStringList fields = pginfo->QueryBDBookmark(serialid);
1458  bookmarkPresent = (fields.count() > 0);
1459  }
1460  }
1461  else
1462  {
1463  ShowNotificationError(QCoreApplication::translate("(MythFrontendMain)",
1464  "BD Failure"),
1465  sLocation,
1466  bd.GetLastError());
1467  delete pginfo;
1468  return res;
1469  }
1470  }
1471  else if (useBookmark && pginfo->IsVideo())
1472  {
1473  pginfo->SetIgnoreLastPlayPos(false);
1474  pginfo->SetIgnoreBookmark(false);
1475  bookmarkPresent = pginfo->QueryBookmark() > 0;
1476  lastPlayPresent = pginfo->QueryLastPlayPos() > 0;
1477  }
1478 
1479  if (useBookmark && (bookmarkPresent || lastPlayPresent))
1480  {
1482  auto *bookmarkdialog = new BookmarkDialog(pginfo, mainStack,
1483  bookmarkPresent,
1484  lastPlayPresent);
1485  if (!bookmarkdialog->Create())
1486  {
1487  delete bookmarkdialog;
1488  delete pginfo;
1489  return res;
1490  }
1491  }
1492  else
1493  {
1495 
1496  res = 0;
1497 
1498  delete pginfo;
1499  }
1500 
1501  return res;
1502 }
1503 
1504 static void gotoMainMenu(void)
1505 {
1506  // Reset the selected button to the first item.
1507  auto *lmenu = qobject_cast<MythThemedMenuState *>
1508  (GetMythMainWindow()->GetMainStack()->GetTopScreen());
1509  if (lmenu)
1510  lmenu->m_buttonList->SetItemCurrent(0);
1511 }
1512 
1513 // If the theme specified in the DB is somehow broken, try a standard one:
1514 //
1515 static bool resetTheme(QString themedir, const QString &badtheme)
1516 {
1517  QString themename = DEFAULT_UI_THEME;
1518 
1519  if (badtheme == DEFAULT_UI_THEME)
1520  themename = FALLBACK_UI_THEME;
1521 
1522  LOG(VB_GENERAL, LOG_WARNING, QString("Overriding broken theme '%1' with '%2'")
1523  .arg(badtheme, themename));
1524 
1525  gCoreContext->OverrideSettingForSession("Theme", themename);
1526  themedir = GetMythUI()->FindThemeDir(themename);
1527 
1530  GetMythMainWindow()->Init();
1531 
1532  return RunMenu(themedir, themename);
1533 }
1534 
1535 static int reloadTheme(void)
1536 {
1537 #ifdef Q_OS_ANDROID
1538  // jni code to launch the application again
1539  // reinitializing the main windows causes a segfault
1540  // with android
1541 
1542 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
1543  auto activity = QtAndroid::androidActivity();
1544 #else
1545  QJniObject activity = QNativeInterface::QAndroidApplication::context();
1546 #endif
1547  auto packageManager = activity.callObjectMethod
1548  ( "getPackageManager",
1549  "()Landroid/content/pm/PackageManager;" );
1550 
1551  auto activityIntent = packageManager.callObjectMethod
1552  ( "getLaunchIntentForPackage",
1553  "(Ljava/lang/String;)Landroid/content/Intent;",
1554  activity.callObjectMethod("getPackageName",
1555  "()Ljava/lang/String;").object() );
1556 
1557  auto pendingIntent = QAndroidJniObject::callStaticObjectMethod
1558  ( "android/app/PendingIntent",
1559  "getActivity",
1560  "(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent;",
1561  activity.object(),
1562  0,
1563  activityIntent.object(),
1564  QAndroidJniObject::getStaticField<jint>("android/content/Intent",
1565  "FLAG_ACTIVITY_CLEAR_TOP") );
1566 
1567  auto alarmManager = activity.callObjectMethod
1568  ( "getSystemService",
1569  "(Ljava/lang/String;)Ljava/lang/Object;",
1570  QAndroidJniObject::getStaticObjectField("android/content/Context",
1571  "ALARM_SERVICE",
1572  "Ljava/lang/String;").object() );
1573 
1574  alarmManager.callMethod<void>
1575  ( "set",
1576  "(IJLandroid/app/PendingIntent;)V",
1577  QAndroidJniObject::getStaticField<jint>("android/app/AlarmManager", "RTC"),
1578  jlong(QDateTime::currentMSecsSinceEpoch() + 100),
1579  pendingIntent.object() );
1580 
1581  qApp->quit();
1582  // QString title = QObject::tr("Your change will take effect the next time "
1583  // "mythfrontend is started.");
1584  // MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythConfirmationDialog *okPopup =
1585  // new MythConfirmationDialog(popupStack, title, false);
1586  // if (okPopup->Create())
1587  // popupStack->AddScreen(okPopup);
1588  return 0;
1589 #else
1591  QString themename = gCoreContext->GetSetting("Theme", DEFAULT_UI_THEME);
1592  QString themedir = GetMythUI()->FindThemeDir(themename);
1593  if (themedir.isEmpty())
1594  {
1595  LOG(VB_GENERAL, LOG_ERR, QString("Couldn't find theme '%1'").arg(themename));
1596  return GENERIC_EXIT_NO_THEME;
1597  }
1598 
1602  if (g_menu)
1603  g_menu->Close();
1604  GetMythMainWindow()->Init();
1606  if (!RunMenu(themedir, themename) && !resetTheme(themedir, themename))
1607  return GENERIC_EXIT_NO_THEME;
1608 
1609  LCD::SetupLCD();
1610  if (LCD *lcd = LCD::Get())
1611  {
1612  lcd->setupLEDs(RemoteGetRecordingMask);
1613  lcd->resetServer();
1614  }
1615 
1616  return 0;
1617 #endif
1618 }
1619 
1620 static void reloadTheme_void(void)
1621 {
1622  int err = reloadTheme();
1623  if (err)
1624  exit(err);
1625 }
1626 
1627 static void setDebugShowBorders(void)
1628 {
1629  MythMainWindow* window = GetMythMainWindow();
1630  MythPainter* painter = window->GetPainter();
1631  painter->SetDebugMode(!painter->ShowBorders(), painter->ShowTypeNames());
1632  if (window->GetMainStack()->GetTopScreen())
1633  window->GetMainStack()->GetTopScreen()->SetRedraw();
1634 }
1635 
1636 static void setDebugShowNames(void)
1637 {
1638  MythMainWindow* window = GetMythMainWindow();
1639  MythPainter* painter = window->GetPainter();
1640  painter->SetDebugMode(painter->ShowBorders(), !painter->ShowTypeNames());
1641  if (window->GetMainStack()->GetTopScreen())
1642  window->GetMainStack()->GetTopScreen()->SetRedraw();
1643 }
1644 
1645 static void InitJumpPoints(void)
1646 {
1647  REG_JUMP(QT_TRANSLATE_NOOP("MythControls", "Reload Theme"),
1648  "", "", reloadTheme_void);
1649  REG_JUMP(QT_TRANSLATE_NOOP("MythControls", "Main Menu"),
1650  "", "", gotoMainMenu);
1651  REG_JUMPLOC(QT_TRANSLATE_NOOP("MythControls", "Program Guide"),
1652  "", "", startGuide, "GUIDE");
1653  REG_JUMPLOC(QT_TRANSLATE_NOOP("MythControls", "Program Finder"),
1654  "", "", startFinder, "FINDER");
1655  //REG_JUMP(QT_TRANSLATE_NOOP("MythControls", "Search Listings"),
1656  // "", "", startSearch);
1657  REG_JUMPLOC(QT_TRANSLATE_NOOP("MythControls", "Manage Recordings / "
1658  "Fix Conflicts"), "", "", startManaged, "VIEWSCHEDULED");
1659  REG_JUMP(QT_TRANSLATE_NOOP("MythControls", "Manage Recording Rules"),
1660  "", "", startManageRecordingRules);
1661  REG_JUMP(QT_TRANSLATE_NOOP("MythControls", "Channel Recording "
1662  "Priorities"), "", "", startChannelRecPriorities);
1663  REG_JUMPLOC(QT_TRANSLATE_NOOP("MythControls", "TV Recording Playback"),
1664  "", "", startPlayback, "JUMPREC");
1665  REG_JUMP(QT_TRANSLATE_NOOP("MythControls", "Live TV"),
1666  "", "", startTVNormal);
1667  REG_JUMP(QT_TRANSLATE_NOOP("MythControls", "Status Screen"),
1668  "", "", showStatus);
1669  REG_JUMP(QT_TRANSLATE_NOOP("MythControls", "Previously Recorded"),
1670  "", "", startPrevious);
1671 
1672  REG_JUMP(QT_TRANSLATE_NOOP("MythControls", "Standby Mode"),
1673  "", "", standbyScreen);
1674 
1675  // Video
1676 
1677  REG_JUMP(JUMP_VIDEO_DEFAULT, QT_TRANSLATE_NOOP("MythControls",
1678  "The Video Default View"), "", jumpScreenVideoDefault);
1679  REG_JUMP(JUMP_VIDEO_MANAGER, QT_TRANSLATE_NOOP("MythControls",
1680  "The Video Manager"), "", jumpScreenVideoManager);
1681  REG_JUMP(JUMP_VIDEO_BROWSER, QT_TRANSLATE_NOOP("MythControls",
1682  "The Video Browser"), "", jumpScreenVideoBrowser);
1683  REG_JUMP(JUMP_VIDEO_TREE, QT_TRANSLATE_NOOP("MythControls",
1684  "The Video Listings"), "", jumpScreenVideoTree);
1685  REG_JUMP(JUMP_VIDEO_GALLERY, QT_TRANSLATE_NOOP("MythControls",
1686  "The Video Gallery"), "", jumpScreenVideoGallery);
1687  REG_JUMP("Play Disc", QT_TRANSLATE_NOOP("MythControls",
1688  "Play an Optical Disc"), "", playDisc);
1689 
1690  // Gallery
1691 
1692  REG_JUMP(JUMP_GALLERY_DEFAULT, QT_TRANSLATE_NOOP("MythControls",
1693  "Image Gallery"), "", RunGallery);
1694 
1695  REG_JUMPEX(QT_TRANSLATE_NOOP("MythControls", "Toggle Show Widget Borders"),
1696  "", "", setDebugShowBorders, false);
1697  REG_JUMPEX(QT_TRANSLATE_NOOP("MythControls", "Toggle Show Widget Names"),
1698  "", "", setDebugShowNames, false);
1699  REG_JUMPEX(QT_TRANSLATE_NOOP("MythControls", "Reset All Keys"),
1700  QT_TRANSLATE_NOOP("MythControls", "Reset all keys to defaults"),
1701  "", resetAllKeys, false);
1702 }
1703 
1704 static void ReloadJumpPoints(void)
1705 {
1706  MythMainWindow *mainWindow = GetMythMainWindow();
1707  mainWindow->ClearAllJumps();
1708  InitJumpPoints();
1709 }
1710 
1711 static void InitKeys(void)
1712 {
1713  REG_KEY("Video","PLAYALT", QT_TRANSLATE_NOOP("MythControls",
1714  "Play selected item in alternate player"), "ALT+P");
1715  REG_KEY("Video","FILTER", QT_TRANSLATE_NOOP("MythControls",
1716  "Open video filter dialog"), "F");
1717  REG_KEY("Video","INCPARENT", QT_TRANSLATE_NOOP("MythControls",
1718  "Increase Parental Level"), "],},F11");
1719  REG_KEY("Video","DECPARENT", QT_TRANSLATE_NOOP("MythControls",
1720  "Decrease Parental Level"), "[,{,F10");
1721  REG_KEY("Video","INCSEARCH", QT_TRANSLATE_NOOP("MythControls",
1722  "Show Incremental Search Dialog"), "Ctrl+S,Search");
1723  REG_KEY("Video","DOWNLOADDATA", QT_TRANSLATE_NOOP("MythControls",
1724  "Download metadata for current item"), "W");
1725  REG_KEY("Video","ITEMDETAIL", QT_TRANSLATE_NOOP("MythControls",
1726  "Display Item Detail Popup"), "");
1727 
1728  // Gallery keybindings
1729  REG_KEY("Images", "PLAY", QT_TRANSLATE_NOOP("MythControls",
1730  "Start/Stop Slideshow"), "P,Media Play");
1731  REG_KEY("Images", "RECURSIVESHOW", QT_TRANSLATE_NOOP("MythControls",
1732  "Start Recursive Slideshow"), "R");
1733  REG_KEY("Images", "ROTRIGHT", QT_TRANSLATE_NOOP("MythControls",
1734  "Rotate image right 90 degrees"), "],3");
1735  REG_KEY("Images", "ROTLEFT", QT_TRANSLATE_NOOP("MythControls",
1736  "Rotate image left 90 degrees"), "[,1");
1737  REG_KEY("Images", "FLIPHORIZONTAL", QT_TRANSLATE_NOOP("MythControls",
1738  "Flip image horizontally"), "");
1739  REG_KEY("Images", "FLIPVERTICAL", QT_TRANSLATE_NOOP("MythControls",
1740  "Flip image vertically"), "");
1741  REG_KEY("Images", "ZOOMOUT", QT_TRANSLATE_NOOP("MythControls",
1742  "Zoom image out"), "7,<,Ctrl+B,Media Rewind");
1743  REG_KEY("Images", "ZOOMIN", QT_TRANSLATE_NOOP("MythControls",
1744  "Zoom image in"), "9,>,Ctrl+F,Media Fast Forward");
1745  REG_KEY("Images", "FULLSIZE", QT_TRANSLATE_NOOP("MythControls",
1746  "Full-size (un-zoom) image"), "0");
1747  REG_KEY("Images", "MARK", QT_TRANSLATE_NOOP("MythControls",
1748  "Mark image"), "T");
1749  REG_KEY("Images", "SCROLLUP", QT_TRANSLATE_NOOP("MythControls",
1750  "Scroll image up"), "2");
1751  REG_KEY("Images", "SCROLLLEFT", QT_TRANSLATE_NOOP("MythControls",
1752  "Scroll image left"), "4");
1753  REG_KEY("Images", "SCROLLRIGHT", QT_TRANSLATE_NOOP("MythControls",
1754  "Scroll image right"), "6");
1755  REG_KEY("Images", "SCROLLDOWN", QT_TRANSLATE_NOOP("MythControls",
1756  "Scroll image down"), "8");
1757  REG_KEY("Images", "RECENTER", QT_TRANSLATE_NOOP("MythControls",
1758  "Recenter image"), "5");
1759  REG_KEY("Images", "COVER", QT_TRANSLATE_NOOP("MythControls",
1760  "Set or clear cover image"), "C");
1761 }
1762 
1763 static void ReloadKeys(void)
1764 {
1765  MythMainWindow* mainwindow = GetMythMainWindow();
1766  if (mainwindow)
1767  mainwindow->ClearKeyContext("Video");
1768  InitKeys();
1769  if (mainwindow)
1770  mainwindow->ReloadKeys();
1771 }
1772 
1773 static void SetFuncPtrs(void)
1774 {
1775  TV::SetFuncPtr("playbackbox", (void *)PlaybackBox::RunPlaybackBox);
1776  TV::SetFuncPtr("viewscheduled", (void *)ViewScheduled::RunViewScheduled);
1777  TV::SetFuncPtr("programguide", (void *)GuideGrid::RunProgramGuide);
1778  TV::SetFuncPtr("programlist", (void *)ProgLister::RunProgramList);
1779  TV::SetFuncPtr("scheduleeditor", (void *)ScheduleEditor::RunScheduleEditor);
1780  TV::SetFuncPtr("programfinder", (void *)RunProgramFinder);
1781 }
1782 
1786 static void clearAllKeys(void)
1787 {
1788  MSqlQuery query(MSqlQuery::InitCon());
1789 
1790  query.prepare("DELETE FROM keybindings "
1791  "WHERE hostname = :HOSTNAME;");
1792  query.bindValue(":HOSTNAME", gCoreContext->GetHostName());
1793  if (!query.exec())
1794  MythDB::DBError("Deleting keybindings", query);
1795  query.prepare("DELETE FROM jumppoints "
1796  "WHERE hostname = :HOSTNAME;");
1797  query.bindValue(":HOSTNAME", gCoreContext->GetHostName());
1798  if (!query.exec())
1799  MythDB::DBError("Deleting jumppoints", query);
1800 }
1801 
1805 static void resetAllKeys(void)
1806 {
1807  clearAllKeys();
1808  // Reload MythMainWindow bindings
1810  // Reload Jump Points
1811  ReloadJumpPoints();
1812  // Reload mythfrontend and TV bindings
1813  ReloadKeys();
1814 }
1815 
1817 {
1818  REG_MEDIAPLAYER("Internal", QT_TRANSLATE_NOOP("MythControls",
1819  "MythTV's native media player."), internal_play_media);
1820  REG_MEDIA_HANDLER(QT_TRANSLATE_NOOP("MythControls",
1821  "MythDVD DVD Media Handler"), "", handleDVDMedia,
1822  MEDIATYPE_DVD, QString());
1823  REG_MEDIA_HANDLER(QT_TRANSLATE_NOOP("MythControls",
1824  "MythImage Media Handler 1/2"), "", handleGalleryMedia,
1825  MEDIATYPE_DATA | MEDIATYPE_MIXED, QString());
1826 
1827  QStringList extensions(ImageAdapterBase::SupportedImages()
1829 
1830  REG_MEDIA_HANDLER(QT_TRANSLATE_NOOP("MythControls",
1831  "MythImage Media Handler 2/2"), "", handleGalleryMedia,
1832  MEDIATYPE_MGALLERY | MEDIATYPE_MVIDEO, extensions.join(","));
1833  return 0;
1834 }
1835 
1836 static void CleanupMyOldInUsePrograms(void)
1837 {
1838  MSqlQuery query(MSqlQuery::InitCon());
1839 
1840  query.prepare("DELETE FROM inuseprograms "
1841  "WHERE hostname = :HOSTNAME and recusage = 'player' ;");
1842  query.bindValue(":HOSTNAME", gCoreContext->GetHostName());
1843  if (!query.exec())
1844  MythDB::DBError("CleanupMyOldInUsePrograms", query);
1845 }
1846 
1847 static bool WasAutomaticStart(void)
1848 {
1849  bool autoStart = false;
1850 
1851  // Is backend running?
1852  //
1854  {
1855  QDateTime startupTime = QDateTime();
1856 
1857  if( gCoreContext->IsMasterHost() )
1858  {
1859  QString s = gCoreContext->GetSetting("MythShutdownWakeupTime", "");
1860  if (!s.isEmpty())
1861  startupTime = MythDate::fromString(s);
1862 
1863  // if we don't have a valid startup time assume we were started manually
1864  if (startupTime.isValid())
1865  {
1866  auto startupSecs = gCoreContext->GetDurSetting<std::chrono::seconds>("StartupSecsBeforeRecording");
1867  startupSecs = std::max(startupSecs, 15 * 60s);
1868  // If we started within 'StartupSecsBeforeRecording' OR 15 minutes
1869  // of the saved wakeup time assume we either started automatically
1870  // to record, to obtain guide data or or for a
1871  // daily wakeup/shutdown period
1872  if (abs(MythDate::secsInPast(startupTime)) < startupSecs)
1873  {
1874  LOG(VB_GENERAL, LOG_INFO,
1875  "Close to auto-start time, AUTO-Startup assumed");
1876 
1877  QString str = gCoreContext->GetSetting("MythFillSuggestedRunTime");
1878  QDateTime guideRunTime = MythDate::fromString(str);
1879  if (MythDate::secsInPast(guideRunTime) < startupSecs)
1880  {
1881  LOG(VB_GENERAL, LOG_INFO,
1882  "Close to MythFillDB suggested run time, AUTO-Startup to fetch guide data?");
1883  }
1884  autoStart = true;
1885  }
1886  else
1887  {
1888  LOG(VB_GENERAL, LOG_DEBUG,
1889  "NOT close to auto-start time, USER-initiated startup assumed");
1890  }
1891  }
1892  }
1893  else
1894  {
1895  QString wakeupCmd = gCoreContext->GetSetting("WakeUpCommand");
1896 
1897  // A slave backend that has no wakeup command cannot be woken
1898  // automatically so can be ignored.
1899  if (!wakeupCmd.isEmpty())
1900  {
1901  ProgramList progList;
1902  bool bConflicts = false;
1903  QDateTime nextRecordingStart;
1904 
1905  if (LoadFromScheduler(progList, bConflicts))
1906  {
1907  // Find the first recording to be recorded
1908  // on this machine
1909  QString hostname = gCoreContext->GetHostName();
1910  for (auto *prog : progList)
1911  {
1912  if ((prog->GetRecordingStatus() == RecStatus::WillRecord ||
1913  prog->GetRecordingStatus() == RecStatus::Pending) &&
1914  (prog->GetHostname() == hostname) &&
1915  (nextRecordingStart.isNull() ||
1916  nextRecordingStart > prog->GetRecordingStartTime()))
1917  {
1918  nextRecordingStart = prog->GetRecordingStartTime();
1919  }
1920  }
1921 
1922  if (!nextRecordingStart.isNull() &&
1923  (abs(MythDate::secsInPast(nextRecordingStart)) < 4min))
1924  {
1925  LOG(VB_GENERAL, LOG_INFO,
1926  "Close to start time, AUTO-Startup assumed");
1927 
1928  // If we started within 4 minutes of the next recording,
1929  // we almost certainly started automatically.
1930  autoStart = true;
1931  }
1932  else
1933  {
1934  LOG(VB_GENERAL, LOG_DEBUG,
1935  "NOT close to auto-start time, USER-initiated startup assumed");
1936  }
1937 
1938  }
1939  }
1940  }
1941  }
1942 
1943  return autoStart;
1944 }
1945 
1946 // from https://www.raspberrypi.org/forums/viewtopic.php?f=33&t=16897
1947 // The old way of revoking root with setuid(getuid())
1948 // causes system hang in certain cases on raspberry pi
1949 
1950 static int revokeRoot (void)
1951 {
1952  if (getuid () == 0 && geteuid () == 0) // Really running as root
1953  return 0;
1954 
1955  if (geteuid () == 0) // Running setuid root
1956  return seteuid (getuid ()) ; // Change effective uid to the uid of the caller
1957  return 0;
1958 }
1959 
1960 
1961 Q_DECL_EXPORT int main(int argc, char **argv)
1962 {
1963  bool bPromptForBackend = false;
1964  bool bBypassAutoDiscovery = false;
1965 
1967  if (!cmdline.Parse(argc, argv))
1968  {
1969  cmdline.PrintHelp();
1971  }
1972 
1973  if (cmdline.toBool("showhelp"))
1974  {
1975  cmdline.PrintHelp();
1976  return GENERIC_EXIT_OK;
1977  }
1978 
1979  if (cmdline.toBool("showversion"))
1980  {
1982  return GENERIC_EXIT_OK;
1983  }
1984 
1986  QApplication::setSetuidAllowed(true);
1987  QApplication a(argc, argv);
1988  QCoreApplication::setApplicationName(MYTH_APPNAME_MYTHFRONTEND);
1989  CleanupGuard callCleanup(cleanup);
1990 
1991 #ifdef Q_OS_DARWIN
1992  QString path = QCoreApplication::applicationDirPath();
1993  setenv("PYTHONPATH",
1994  QString("%1/../Resources/lib/%2:/../Resources/lib/%2/site-packages:/../Resources/lib/%2/lib-dynload:%3")
1995  .arg(path)
1996  .arg(QFileInfo(PYTHON_EXE).fileName())
1997  .arg(QProcessEnvironment::systemEnvironment().value("PYTHONPATH"))
1998  .toUtf8().constData(), 1);
1999 #endif
2000 
2001 #ifndef _WIN32
2005 #endif
2006 
2007 #if defined(Q_OS_ANDROID)
2008  auto config = QSslConfiguration::defaultConfiguration();
2009  config.setCaCertificates(QSslConfiguration::systemCaCertificates());
2010  QSslConfiguration::setDefaultConfiguration(config);
2011 #endif
2012 
2013  int retval = cmdline.ConfigureLogging();
2014  if (retval != GENERIC_EXIT_OK)
2015  return retval;
2016 
2017  bool ResetSettings = false;
2018 
2019  if (cmdline.toBool("prompt"))
2020  bPromptForBackend = true;
2021  if (cmdline.toBool("noautodiscovery"))
2022  bBypassAutoDiscovery = true;
2023 
2024  if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
2025  std::cerr << "Unable to ignore SIGPIPE\n";
2026 
2027  if (!cmdline.toString("geometry").isEmpty())
2029 
2030  fe_sd_notify("STATUS=Connecting to database.");
2031  gContext = new MythContext(MYTH_BINARY_VERSION, true);
2032  gCoreContext->SetAsFrontend(true);
2033 
2035  if (!gContext->Init(true, bPromptForBackend, bBypassAutoDiscovery))
2036  {
2037  LOG(VB_GENERAL, LOG_ERR, "Failed to init MythContext, exiting.");
2038  gCoreContext->SetExiting(true);
2040  }
2041 
2043 
2044  if (!GetMythDB()->HaveSchema())
2045  {
2046  if (!InitializeMythSchema())
2047  return GENERIC_EXIT_DB_ERROR;
2048  }
2049 
2050  if (cmdline.toBool("reset"))
2051  ResetSettings = true;
2052 
2053  if (!cmdline.toBool("noupnp"))
2054  {
2055  fe_sd_notify("STATUS=Creating UPnP media renderer");
2056  g_pUPnp = new MediaRenderer();
2057  if (!g_pUPnp->isInitialized())
2058  {
2059  delete g_pUPnp;
2060  g_pUPnp = nullptr;
2061  }
2062  }
2063 
2064  QString fileprefix = GetConfDir();
2065 
2066  QDir dir(fileprefix);
2067  if (!dir.exists())
2068  dir.mkdir(fileprefix);
2069 
2070  if (ResetSettings)
2071  {
2072  AppearanceSettings as;
2073  as.Save();
2074 
2076  gCoreContext->GetDB()->ClearSetting("Language");
2077  gCoreContext->GetDB()->ClearSettingOnHost("Language", nullptr);
2078  gCoreContext->GetDB()->ClearSetting("Country");
2079  gCoreContext->GetDB()->ClearSettingOnHost("Country", nullptr);
2080 
2081  LOG(VB_GENERAL, LOG_NOTICE, "Appearance settings and language have "
2082  "been reset to defaults. You will need to "
2083  "restart the frontend.");
2084  gContext-> saveSettingsCache();
2085  return GENERIC_EXIT_OK;
2086  }
2087 
2088 #if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
2089  int maxImageSize = gCoreContext->GetNumSetting("ImageMaximumSize", -1);
2090  if (maxImageSize >=0)
2091  QImageReader::setAllocationLimit(maxImageSize);
2092 #endif
2093  LOG(VB_GENERAL, LOG_DEBUG,
2094  QString("Built against zlib %1, linked against %2.")
2095  .arg(ZLIB_VERSION, zlibVersion()));
2096  QList<QByteArray> formats = QImageReader::supportedImageFormats();
2097  QString format_str = formats.takeFirst();
2098  for (const auto& format : std::as_const(formats))
2099  format_str += ", " + format;
2100  LOG(VB_GENERAL, LOG_DEBUG, QString("Supported image formats: %1").arg(format_str));
2101 
2102  QCoreApplication::setSetuidAllowed(true);
2103 
2104  if (revokeRoot() != 0)
2105  {
2106  LOG(VB_GENERAL, LOG_ERR, "Failed to revokeRoot(), exiting.");
2107  return GENERIC_EXIT_NOT_OK;
2108  }
2109 
2110 #ifdef USING_LIBDNS_SD
2111  // this needs to come after gCoreContext has been initialised
2112  // (for hostname) - hence it is not in MediaRenderer
2113  QScopedPointer<BonjourRegister> bonjour(new BonjourRegister());
2114  if (bonjour.data())
2115  {
2116  fe_sd_notify("STATUS=Registering frontend with bonjour");
2117  QByteArray dummy;
2118  int port = gCoreContext->GetNumSetting("UPnP/MythFrontend/ServicePort", 6547);
2119  // frontend upnp server is now ServicePort + 4 (default 6551)
2120  port += 4;
2121  QByteArray name("Mythfrontend on ");
2122  name.append(gCoreContext->GetHostName().toUtf8());
2123  bonjour->Register(port, "_mythfrontend._tcp",
2124  name, dummy);
2125  }
2126 #endif
2127 
2128  fe_sd_notify("STATUS=Initializing LCD");
2129  LCD::SetupLCD();
2130  if (LCD *lcd = LCD::Get())
2131  lcd->setupLEDs(RemoteGetRecordingMask);
2132 
2133  fe_sd_notify("STATUS=Loading translation");
2134  MythTranslation::load("mythfrontend");
2135 
2136  fe_sd_notify("STATUS=Loading themes");
2137  QString themename = gCoreContext->GetSetting("Theme", DEFAULT_UI_THEME);
2138 
2139  QString themedir = GetMythUI()->FindThemeDir(themename);
2140  if (themedir.isEmpty())
2141  {
2142  LOG(VB_GENERAL, LOG_ERR, QString("Couldn't find theme '%1'")
2143  .arg(themename));
2144  return GENERIC_EXIT_NO_THEME;
2145  }
2146 
2147  themename = gCoreContext->GetSetting("Theme", DEFAULT_UI_THEME);
2148  themedir = GetMythUI()->FindThemeDir(themename);
2149  if (themedir.isEmpty())
2150  {
2151  LOG(VB_GENERAL, LOG_ERR, QString("Couldn't find theme '%1'")
2152  .arg(themename));
2153  return GENERIC_EXIT_NO_THEME;
2154  }
2155 
2156  auto * mainWindow = GetMythMainWindow();
2157 
2158  // Force an update of our hardware decoder/render support once the window is
2159  // ready and we have a render device (and after each window re-initialisation
2160  // when we may have a new render device). This also ensures the support checks
2161  // are done immediately and are not reliant on semi-random settings initialisation.
2162  QObject::connect(mainWindow, &MythMainWindow::SignalWindowReady,
2163  []() { MythVideoProfile::InitStatics(true); } );
2164 
2165  mainWindow->Init(false);
2166  mainWindow->setWindowTitle(QCoreApplication::translate("(MythFrontendMain)",
2167  "MythTV Frontend",
2168  "Main window title"));
2169 
2170 #ifdef USING_AIRPLAY
2171  if (gCoreContext->GetBoolSetting("AirPlayEnabled", true))
2172  {
2173  fe_sd_notify("STATUS=Initializing AirPlay");
2175  if (!gCoreContext->GetBoolSetting("AirPlayAudioOnly", false))
2176  {
2178  }
2179  }
2180 #endif
2181 
2182  // We must reload the translation after a language change and this
2183  // also means clearing the cached/loaded theme strings, so reload the
2184  // theme which also triggers a translation reload
2186  {
2187  if (!reloadTheme())
2188  return GENERIC_EXIT_NO_THEME;
2189  }
2190 
2191  if (!UpgradeTVDatabaseSchema(false, false, true))
2192  {
2193  LOG(VB_GENERAL, LOG_ERR,
2194  "Couldn't upgrade database to new schema, exiting.");
2196  }
2197 
2198  WriteDefaults();
2199 
2200  // Refresh Global/Main Menu keys after DB update in case there was no DB
2201  // when they were written originally
2202  mainWindow->ReloadKeys();
2203 
2204  fe_sd_notify("STATUS=Initializing jump points");
2205  InitJumpPoints();
2206  InitKeys();
2207  TV::InitKeys();
2208  SetFuncPtrs();
2209 
2211 
2213 
2214  setHttpProxy();
2215 
2216  fe_sd_notify("STATUS=Initializing plugins");
2217  g_pmanager = new MythPluginManager();
2219 
2220  fe_sd_notify("STATUS=Initializing media monitor");
2222  if (mon)
2223  {
2224  mon->StartMonitoring();
2225  mainWindow->installEventFilter(mon);
2226  }
2227 
2228  fe_sd_notify("STATUS=Initializing network control");
2229  NetworkControl *networkControl = nullptr;
2230  if (gCoreContext->GetBoolSetting("NetworkControlEnabled", false))
2231  {
2232  int port = gCoreContext->GetNumSetting("NetworkControlPort", 6546);
2233  networkControl = new NetworkControl();
2234  if (!networkControl->listen(port))
2235  {
2236  LOG(VB_GENERAL, LOG_ERR,
2237  QString("NetworkControl failed to bind to port %1.")
2238  .arg(port));
2239  }
2240  }
2241 
2242 #ifdef Q_OS_DARWIN
2244  GetMythMainWindow()->Init();
2246  gLoaded = true;
2247 #endif
2248  if (!RunMenu(themedir, themename) && !resetTheme(themedir, themename))
2249  {
2250  return GENERIC_EXIT_NO_THEME;
2251  }
2252  fe_sd_notify("STATUS=Loading theme updates");
2253  std::unique_ptr<ThemeUpdateChecker> themeUpdateChecker;
2254  if (gCoreContext->GetBoolSetting("ThemeUpdateNofications", true))
2255  themeUpdateChecker = std::make_unique<ThemeUpdateChecker>();
2256 
2257  MythSystemEventHandler sysEventHandler {};
2258 
2260 
2262  PreviewGenerator::kRemote, 50, 60s);
2263 
2264  fe_sd_notify("STATUS=Creating housekeeper");
2265  auto *housekeeping = new HouseKeeper();
2266 #ifdef __linux__
2267  #ifdef CONFIG_BINDINGS_PYTHON
2268  housekeeping->RegisterTask(new HardwareProfileTask());
2269  #endif
2270 #endif
2271  housekeeping->Start();
2272 
2273 
2274  if (cmdline.toBool("runplugin"))
2275  {
2276  QStringList plugins = g_pmanager->EnumeratePlugins();
2277 
2278  if (plugins.contains(cmdline.toString("runplugin")))
2279  g_pmanager->run_plugin(cmdline.toString("runplugin"));
2280  else if (plugins.contains("myth" + cmdline.toString("runplugin")))
2281  g_pmanager->run_plugin("myth" + cmdline.toString("runplugin"));
2282  else
2283  {
2284  LOG(VB_GENERAL, LOG_ERR,
2285  QString("Invalid plugin name supplied on command line: '%1'")
2286  .arg(cmdline.toString("runplugin")));
2287  LOG(VB_GENERAL, LOG_ERR,
2288  QString("Available plugins: %1")
2289  .arg(plugins.join(", ")));
2291  }
2292  }
2293  else if (cmdline.toBool("jumppoint"))
2294  {
2296 
2297  if (mmw->DestinationExists(cmdline.toString("jumppoint")))
2298  mmw->JumpTo(cmdline.toString("jumppoint"));
2299  else
2300  {
2301  LOG(VB_GENERAL, LOG_ERR,
2302  QString("Invalid jump point supplied on the command line: %1")
2303  .arg(cmdline.toString("jumppoint")));
2304  LOG(VB_GENERAL, LOG_ERR,
2305  QString("Available jump points: %2")
2306  .arg(mmw->EnumerateDestinations().join(", ")));
2308  }
2309  }
2310 
2311  if (WasAutomaticStart())
2312  {
2313  // We appear to have been started automatically
2314  // so enter standby so that the machine can
2315  // shutdown again as soon as possible if necessary.
2316  standbyScreen();
2317  }
2318 
2319  // Provide systemd ready notification (for type=notify units)
2320  fe_sd_notify("STATUS=");
2321  fe_sd_notify("READY=1");
2322 
2323 
2324  int ret = 0;
2325  {
2326  MythHTTPInstance::Addservices({{ FRONTEND_SERVICE, &MythHTTPService::Create<MythFrontendService> }});
2327 
2328  // Send all unknown requests into the web app. make bookmarks and direct access work.
2329  auto spa_index = [](auto && PH1) { return MythHTTPRewrite::RewriteToSPA(std::forward<decltype(PH1)>(PH1), "mythfrontend.html"); };
2330  MythHTTPInstance::AddErrorPageHandler({ "=404", spa_index });
2331 
2332  auto root = [](auto && PH1) { return MythHTTPRoot::RedirectRoot(std::forward<decltype(PH1)>(PH1), "mythfrontend.html"); };
2333  MythHTTPScopedInstance webserver({{ "/", root}});
2334  ret = QCoreApplication::exec();
2335  }
2336 
2337  fe_sd_notify("STOPPING=1\nSTATUS=Exiting");
2338  if (ret==0)
2339  gContext-> saveSettingsCache();
2340 
2341  DestroyMythUI();
2343 
2344  delete housekeeping;
2345 
2347 
2348  if (mon)
2349  mon->deleteLater();
2350 
2351  delete networkControl;
2352  return ret;
2353 }
2354 
2355 void handleSIGUSR1(void)
2356 {
2357  LOG(VB_GENERAL, LOG_INFO, "Reloading theme");
2358  gCoreContext->SendMessage("CLEAR_SETTINGS_CACHE");
2360  GetMythMainWindow()->JumpTo("Reload Theme");
2362 }
2363 
2364 void handleSIGUSR2(void)
2365 {
2366  LOG(VB_GENERAL, LOG_INFO, "Restarting LIRC handler");
2368 }
2369 
2370 /*
2371 include Qt MOC output for Q_OBJECT class defined in this file;
2372 filenames must match.
2373 */
2374 #include "mythfrontend.moc"
2375 /* vim: set expandtab tabstop=4 shiftwidth=4: */
startChannelRecPriorities
static void startChannelRecPriorities(void)
Definition: mythfrontend.cpp:558
MythMediaDevice::isUsable
bool isUsable() const
Is this device "ready", for a plugin to access?
Definition: mythmedia.h:84
scheduleeditor.h
MythCoreContext::SetPluginManager
void SetPluginManager(MythPluginManager *pmanager)
Definition: mythcorecontext.cpp:2101
themedir
static QString themedir
Definition: mythdirs.cpp:23
globalsettings.h
TV::InitKeys
static void InitKeys()
Definition: tv_play.cpp:494
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:127
startAppearWiz
static void startAppearWiz(void)
Definition: mythfrontend.cpp:360
MythMainWindow::GetMainStack
MythScreenStack * GetMainStack()
Definition: mythmainwindow.cpp:317
hardwareprofile.h
MythVideoProfile::InitStatics
static void InitStatics(bool Reinit=false)
Definition: mythvideoprofile.cpp:1322
PlaybackBox::RunPlaybackBox
static void * RunPlaybackBox(void *player, bool showTV)
Definition: playbackbox.cpp:372
VideoDialog::DLG_BROWSER
@ DLG_BROWSER
Definition: videodlg.h:38
MEDIATYPE_DVD
@ MEDIATYPE_DVD
Definition: mythmedia.h:29
mythfrontendservice.h
HouseKeeper
Manages registered HouseKeeperTasks and queues tasks for operation.
Definition: housekeeper.h:149
GENERIC_EXIT_NO_THEME
@ GENERIC_EXIT_NO_THEME
No Theme available.
Definition: exitcodes.h:17
MythCoreContext::SendMessage
void SendMessage(const QString &message)
Definition: mythcorecontext.cpp:1525
tv.h
plTitleSearch
@ plTitleSearch
Definition: proglist.h:20
videometadatasettings.h
MythHTTPScopedInstance
Definition: mythhttpinstance.h:35
MythUILocation::RemoveCurrentLocation
QString RemoveCurrentLocation()
Definition: mythuilocation.cpp:12
GuideGrid::RunProgramGuide
static void RunProgramGuide(uint startChanId, const QString &startChanNum, const QDateTime &startTime, TV *player=nullptr, bool embedVideo=false, bool allowFinder=true, int changrpid=-1)
Definition: guidegrid.cpp:411
ThemeChooser
View and select installed themes.
Definition: themechooser.h:27
GeneralSetupWizard
Definition: setupwizard_general.h:14
REG_KEY
static void REG_KEY(const QString &Context, const QString &Action, const QString &Description, const QString &Key)
Definition: mythmainwindow.h:175
setHttpProxy
void setHttpProxy(void)
Get network proxy settings from OS, and use for [Q]Http[Comms].
Definition: mythmiscutil.cpp:803
MythPluginManager
Definition: mythplugin.h:62
MythMainWindow::Init
void Init(bool MayReInit=true)
Definition: mythmainwindow.cpp:641
MythUIScreenBounds::ParseGeometryOverride
static void ParseGeometryOverride(const QString &Geometry)
Parse an X11 style command line geometry string.
Definition: mythuiscreenbounds.cpp:40
startManageRecordingRules
static void startManageRecordingRules(void)
Definition: mythfrontend.cpp:546
LoadFromScheduler
bool LoadFromScheduler(AutoDeleteDeque< TYPE * > &destination, bool &hasConflicts, const QString &altTable="", int recordid=-1)
Definition: programinfo.h:937
ShowNotificationError
void ShowNotificationError(const QString &msg, const QString &from, const QString &detail, const VNMask visibility, const MythNotification::Priority priority)
convenience utility to display error message as notification
Definition: mythnotificationcenter.cpp:1426
ManualSchedule
Definition: manualschedule.h:20
customedit.h
jumpScreenVideoManager
static void jumpScreenVideoManager()
Definition: mythfrontend.cpp:767
guidegrid.h
PreviewGenerator::kRemote
@ kRemote
Definition: previewgenerator.h:44
mythdb.h
handleExit
static void handleExit(bool prompt)
Definition: mythfrontend.cpp:1320
MythTranslation::reload
static void reload()
Reload all active translators based on the current language setting.
Definition: mythtranslation.cpp:97
PlaybackSettingsDialog
Definition: globalsettings.h:18
anonymous_namespace{mythfrontend.cpp}::RunSettingsCompletion::m_plcc
ParentalLevelChangeChecker m_plcc
Definition: mythfrontend.cpp:221
MythSystemLegacy
Definition: mythsystemlegacy.h:67
MythAirplayServer::Create
static bool Create(void)
Definition: mythairplayserver.cpp:352
exitprompt.h
anonymous_namespace{mythfrontend.cpp}::RunSettingsCompletion::RunSettingsCompletion
RunSettingsCompletion(bool check)
Definition: mythfrontend.cpp:171
RunGallery
static void RunGallery()
Definition: mythfrontend.cpp:773
ChannelUtil::LoadChannels
static ChannelInfoList LoadChannels(uint startIndex, uint count, uint &totalAvailable, bool ignoreHidden=true, OrderBy orderBy=kChanOrderByChanNum, GroupBy groupBy=kChanGroupByChanid, uint sourceID=0, uint channelGroupID=0, bool liveTVOnly=false, const QString &callsign="", const QString &channum="", bool ignoreUntunable=true)
Load channels from database into a list of ChannelInfo objects.
Definition: channelutil.cpp:2469
reloadTheme
static int reloadTheme(void)
Definition: mythfrontend.cpp:1535
MythScreenType::Close
virtual void Close()
Definition: mythscreentype.cpp:383
MediaMonitor::GetMediaMonitor
static MediaMonitor * GetMediaMonitor(void)
Definition: mediamonitor.cpp:75
cmdline
MythCommFlagCommandLineParser cmdline
Definition: mythcommflag.cpp:72
ReloadKeys
static void ReloadKeys(void)
Definition: mythfrontend.cpp:1763
GrabberSettings
Definition: grabbersettings.h:13
MythMainWindow::SignalWindowReady
void SignalWindowReady()
MythPluginManager::run_plugin
bool run_plugin(const QString &plugname)
Definition: mythplugin.cpp:162
simple_ref_ptr< class VideoList >
MythCoreContext::emitTVPlaybackStopped
void emitTVPlaybackStopped(void)
Definition: mythcorecontext.h:291
internal_play_media
static int internal_play_media(const QString &mrl, const QString &plot, const QString &title, const QString &subtitle, const QString &director, int season, int episode, const QString &inetref, std::chrono::minutes lenMins, const QString &year, const QString &id, const bool useBookmark)
Definition: mythfrontend.cpp:1387
RunProgramFinder
void RunProgramFinder(TV *player, bool embedVideo, bool allowEPG)
Definition: progfind.cpp:31
startSearchPower
static void startSearchPower(void)
Definition: mythfrontend.cpp:464
ProgramRecPriority
Definition: programrecpriority.h:64
mythplugin.h
startSearchTitle
static void startSearchTitle(void)
Definition: mythfrontend.cpp:434
MythMainWindow::JumpTo
void JumpTo(const QString &Destination, bool Pop=true)
Definition: mythmainwindow.cpp:1457
plCategory
@ plCategory
Definition: proglist.h:27
mythcdrom.h
MEDIASTAT_USEABLE
@ MEDIASTAT_USEABLE
Definition: mythmedia.h:19
NetworkControl
Definition: networkcontrol.h:95
startSearchNew
static void startSearchNew(void)
Definition: mythfrontend.cpp:514
ChannelGroupsSetting
Definition: globalsettings.h:326
MythContext
Startup context for MythTV.
Definition: mythcontext.h:43
PlaybackSettings
Definition: globalsettings.h:33
ExitPrompter
Definition: exitprompt.h:6
MEDIATYPE_MIXED
@ MEDIATYPE_MIXED
Definition: mythmedia.h:27
MythCoreContext::OverrideSettingForSession
void OverrideSettingForSession(const QString &key, const QString &value)
Definition: mythcorecontext.cpp:1345
MediaMonitor::StartMonitoring
virtual void StartMonitoring(void)
Start the monitoring thread if needed.
Definition: mediamonitor.cpp:442
playDisc
static void playDisc()
Definition: mythfrontend.cpp:788
MythMainWindow::ClearAllJumps
void ClearAllJumps()
Definition: mythmainwindow.cpp:1449
mythhttpinstance.h
mythdvdbuffer.h
RemoteGetFreeRecorderCount
int RemoteGetFreeRecorderCount(void)
Definition: tvremoteutil.cpp:168
jumpScreenVideoDefault
static void jumpScreenVideoDefault()
Definition: mythfrontend.cpp:771
setupwizard_general.h
BackendConnectionManager
Definition: backendconnectionmanager.h:7
setenv
#define setenv(x, y, z)
Definition: compat.h:89
MythScreenStack
Definition: mythscreenstack.h:16
mythdbcon.h
jumpScreenVideoTree
static void jumpScreenVideoTree()
Definition: mythfrontend.cpp:769
standbyScreen
static void standbyScreen(void)
Definition: mythfrontend.cpp:704
ChannelUtil::kChanOrderByLiveTV
@ kChanOrderByLiveTV
Definition: channelutil.h:210
ProgLister
Definition: proglist.h:35
MythMainWindow::ReloadKeys
void ReloadKeys()
Definition: mythmainwindow.cpp:953
PreviewGeneratorQueue::CreatePreviewGeneratorQueue
static void CreatePreviewGeneratorQueue(PreviewGenerator::Mode mode, uint maxAttempts, std::chrono::seconds minBlockSeconds)
Create the singleton queue of preview generators.
Definition: previewgeneratorqueue.cpp:42
anonymous_namespace{mythfrontend.cpp}::RunSettingsCompletion
Definition: mythfrontend.cpp:160
MythCoreContext::emitTVPlaybackStarted
void emitTVPlaybackStarted(void)
Definition: mythcorecontext.h:290
MSqlQuery::exec
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:618
grabbersettings.h
ReferenceCounter::PrintDebug
static void PrintDebug(void)
Print out any leaks if that level of debugging is enabled.
Definition: referencecounter.cpp:72
RemoteGetRecordingMask
int RemoteGetRecordingMask(void)
Definition: remoteutil.cpp:392
plTime
@ plTime
Definition: proglist.h:29
MythMediaDevice::getStatus
MythMediaStatus getStatus() const
Definition: mythmedia.h:70
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
BonjourRegister
Definition: bonjourregister.h:11
playgroup.h
SettingsHelper::RunEpilog
void RunEpilog(void)
Definition: settingshelper.h:31
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
MythThemedMenu::foundTheme
bool foundTheme(void) const
Returns true iff a theme has been found by a previous call to SetMenuTheme().
Definition: myththemedmenu.cpp:144
VideoDialog::DLG_GALLERY
@ DLG_GALLERY
Definition: videodlg.h:38
cleanup.h
statusbox.h
GetMythDB
MythDB * GetMythDB(void)
Definition: mythdb.cpp:50
mythsystemevent.h
main
Q_DECL_EXPORT int main(int argc, char **argv)
Definition: mythfrontend.cpp:1961
SetFuncPtrs
static void SetFuncPtrs(void)
Definition: mythfrontend.cpp:1773
VideoDialog::GetSavedVideoList
static VideoListDeathDelayPtr & GetSavedVideoList()
Definition: videodlg.cpp:877
mythdirs.h
MythAirplayServer::Cleanup
static void Cleanup(void)
Definition: mythairplayserver.cpp:391
startSearchStored
static void startSearchStored(void)
Definition: mythfrontend.cpp:474
progfind.h
myth_system
uint myth_system(const QString &command, uint flags, std::chrono::seconds timeout)
Definition: mythsystemlegacy.cpp:506
MythMainWindow::GetPainter
MythPainter * GetPainter()
Definition: mythmainwindow.cpp:257
MythBDInfo::IsValid
bool IsValid(void) const
Definition: mythbdinfo.cpp:161
startPlayback
static void startPlayback(void)
Definition: mythfrontend.cpp:601
startSearchCategory
static void startSearchCategory(void)
Definition: mythfrontend.cpp:494
mediamonitor.h
ProgLister::RunProgramList
static void * RunProgramList(void *player, ProgListType pltype, const QString &extraArg)
Definition: proglist.cpp:36
plStoredSearch
@ plStoredSearch
Definition: proglist.h:31
ParentalLevelChangeChecker
Definition: parentalcontrols.h:44
networkcontrol.h
remoteutil.h
LCD::Get
static LCD * Get(void)
Definition: lcddevice.cpp:69
OSDSettings
Definition: globalsettings.h:126
startManaged
static void startManaged(void)
Definition: mythfrontend.cpp:534
MythMainWindow::HandleMedia
bool HandleMedia(const QString &Handler, const QString &Mrl, const QString &Plot="", const QString &Title="", const QString &Subtitle="", const QString &Director="", int Season=0, int Episode=0, const QString &Inetref="", std::chrono::minutes LenMins=2h, const QString &Year="1895", const QString &Id="", bool UseBookmarks=false)
Definition: mythmainwindow.cpp:1496
g_settingsHelper
static SettingsHelper * g_settingsHelper
Definition: mythfrontend.cpp:144
AudioConfigScreen
Definition: audiogeneralsettings.h:24
anonymous_namespace{mythfrontend.cpp}::BookmarkDialog::BookmarkDialog
BookmarkDialog(ProgramInfo *pginfo, MythScreenStack *parent, bool bookmarkPresent, bool lastPlayPresent)
Definition: mythfrontend.cpp:232
plMovies
@ plMovies
Definition: proglist.h:26
TV::StartTV
static bool StartTV(ProgramInfo *TVRec, uint Flags, const ChannelInfoList &Selection=ChannelInfoList())
Start playback of media.
Definition: tv_play.cpp:287
JUMP_VIDEO_TREE
const QString JUMP_VIDEO_TREE
Definition: globals.cpp:38
proglist.h
langsettings.h
tmp
static guint32 * tmp
Definition: goom_core.cpp:26
mythairplayserver.h
channelrecpriority.h
plNewListings
@ plNewListings
Definition: proglist.h:25
MythMainWindow::SetEffectsEnabled
void SetEffectsEnabled(bool Enable)
Definition: mythmainwindow.cpp:1028
prevreclist.h
RunMenu
static bool RunMenu(const QString &themedir, const QString &themename)
Definition: mythfrontend.cpp:1333
mythsystemlegacy.h
startPreviousOld
static void startPreviousOld(void)
Definition: mythfrontend.cpp:616
MythDisplay::ConfigureQtGUI
static void ConfigureQtGUI(int SwapInterval, const MythCommandLineParser &CmdLine)
Shared static initialisation code for all MythTV GUI applications.
Definition: mythdisplay.cpp:1158
handleSIGUSR2
void handleSIGUSR2(void)
Definition: mythfrontend.cpp:2364
PlayGroupEditor
Definition: playgroup.h:25
RecStatus::WillRecord
@ WillRecord
Definition: recordingstatus.h:31
fe_sd_notify
static void fe_sd_notify(const char *)
Definition: mythfrontend.cpp:131
MythScreenStack::GetScreenList
void GetScreenList(QVector< MythScreenType * > &screens)
Definition: mythscreenstack.cpp:200
quit
@ quit
Definition: lirc_client.h:30
startSearchChannel
static void startSearchChannel(void)
Definition: mythfrontend.cpp:484
anonymous_namespace{mythfrontend.cpp}::RunSettingsCompletion::Create
static void Create(bool check)
Definition: mythfrontend.cpp:165
MythCommandLineParser::Parse
virtual bool Parse(int argc, const char *const *argv)
Loop through argv and populate arguments with values.
Definition: mythcommandlineparser.cpp:1552
sLocation
static const QString sLocation
Definition: mythfrontend.cpp:155
playbackbox.h
IdleScreen
Definition: idlescreen.h:12
StandardSettingDialog
Definition: standardsettings.h:468
InitializeMythSchema
bool InitializeMythSchema(void)
command to get the the initial database layout from an empty database:
Definition: dbcheck.cpp:1254
StandardSettingDialog::Create
bool Create(void) override
Definition: standardsettings.cpp:785
handleGalleryMedia
static void handleGalleryMedia(MythMediaDevice *dev)
Definition: mythfrontend.cpp:892
plKeywordSearch
@ plKeywordSearch
Definition: proglist.h:21
startCustomEdit
static void startCustomEdit(void)
Definition: mythfrontend.cpp:626
MythFrontendCommandLineParser
Definition: mythfrontend_commandlineparser.h:6
MythHTTPInstance::Addservices
static void Addservices(const HTTPServices &Services)
Definition: mythhttpinstance.cpp:102
programinfo.h
InitJumpPoints
static void InitJumpPoints(void)
Definition: mythfrontend.cpp:1645
programrecpriority.h
GENERIC_EXIT_INVALID_CMDLINE
@ GENERIC_EXIT_INVALID_CMDLINE
Command line parse error.
Definition: exitcodes.h:18
anonymous_namespace{mythfrontend.cpp}::BookmarkDialog::m_btnClearBookmark
QString m_btnClearBookmark
Definition: mythfrontend.cpp:313
GetConfDir
QString GetConfDir(void)
Definition: mythdirs.cpp:263
TV::ConfiguredTunerCards
static int ConfiguredTunerCards()
If any cards are configured, return the number.
Definition: tv_play.cpp:118
videolist.h
anonymous_namespace{mythfrontend.cpp}::BookmarkDialog::m_btnPlayLast
QString m_btnPlayLast
Definition: mythfrontend.cpp:315
FileAssocDialog
Definition: videofileassoc.h:13
anonymous_namespace{mythfrontend.cpp}::BookmarkDialog::customEvent
void customEvent(QEvent *event) override
Definition: mythfrontend.cpp:272
MythCoreContext::BackendIsRunning
static bool BackendIsRunning(void)
a backend process is running on this host
Definition: mythcorecontext.cpp:704
jumpScreenVideoGallery
static void jumpScreenVideoGallery()
Definition: mythfrontend.cpp:770
MythCoreContext::SetAsFrontend
void SetAsFrontend(bool frontend)
Definition: mythcorecontext.cpp:653
UpgradeTVDatabaseSchema
bool UpgradeTVDatabaseSchema(const bool upgradeAllowed, const bool upgradeIfNoUI, [[maybe_unused]] const bool informSystemd)
Called from outside dbcheck.cpp to update the schema.
Definition: dbcheck.cpp:362
VideoDialog::VideoListDeathDelayPtr
QPointer< class VideoListDeathDelay > VideoListDeathDelayPtr
Definition: videodlg.h:48
MythCDROM::kBluray
@ kBluray
Definition: mythcdrom.h:29
dbcheck.h
JUMP_VIDEO_MANAGER
const QString JUMP_VIDEO_MANAGER
Definition: globals.cpp:36
signalhandling.h
globals.h
GENERIC_EXIT_OK
@ GENERIC_EXIT_OK
Exited with no error.
Definition: exitcodes.h:13
MythDialogBox
Basic menu dialog, message and a list of options.
Definition: mythdialogbox.h:166
VideoDialog::BrowseType
BrowseType
Definition: videodlg.h:41
startPlaybackWithGroup
static void startPlaybackWithGroup(const QString &recGroup="")
Definition: mythfrontend.cpp:582
MSqlQuery::InitCon
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:550
CleanupGuard
Definition: cleanupguard.h:6
compat.h
WriteDefaults
static void WriteDefaults()
Definition: mythfrontend.cpp:1357
mythcontrols.h
Main header for mythcontrols.
MythDB::DBError
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:225
mythhttprewrite.h
startSearchTime
static void startSearchTime(void)
Definition: mythfrontend.cpp:524
bonjourregister.h
custompriority.h
MythCoreContext::GetDurSetting
std::enable_if_t< std::chrono::__is_duration< T >::value, T > GetDurSetting(const QString &key, T defaultval=T::zero())
Definition: mythcorecontext.h:168
PrevRecordedList
Definition: prevreclist.h:31
anonymous_namespace{mythfrontend.cpp}::BookmarkDialog::m_btnPlayBookmark
QString m_btnPlayBookmark
Definition: mythfrontend.cpp:312
StandardSetting::Load
virtual void Load(void)
Definition: standardsettings.cpp:213
formats
const std::array< const std::string, 8 > formats
Definition: vbilut.cpp:189
SIGUSR1
#define SIGUSR1
Definition: compat.h:137
gotoMainMenu
static void gotoMainMenu(void)
Definition: mythfrontend.cpp:1504
gallerythumbview.h
Implements Gallery Thumbnail screen.
anonymous_namespace{mythfrontend.cpp}::BookmarkDialog::m_btnClearLast
QString m_btnClearLast
Definition: mythfrontend.cpp:316
VideoGeneralSettings
Definition: videoglobalsettings.h:10
mediarenderer.h
MythMainWindow::DestinationExists
bool DestinationExists(const QString &Destination) const
Definition: mythmainwindow.cpp:1470
DestroyMythMainWindow
void DestroyMythMainWindow(void)
Definition: mythmainwindow.cpp:114
MediaRenderer
Definition: mediarenderer.h:29
UPnp::isInitialized
bool isInitialized()
Definition: upnp.h:120
ImageAdapterBase::SupportedImages
static QStringList SupportedImages()
Return recognised pictures.
Definition: imagemanager.cpp:310
isLiveTVAvailable
static bool isLiveTVAvailable(void)
Definition: mythfrontend.cpp:649
handleSIGUSR1
void handleSIGUSR1(void)
Definition: mythfrontend.cpp:2355
showStatus
static void showStatus(void)
Definition: mythfrontend.cpp:691
MEDIATYPE_MVIDEO
@ MEDIATYPE_MVIDEO
Definition: mythmedia.h:32
FRONTEND_SERVICE
#define FRONTEND_SERVICE
Definition: mythfrontendservice.h:7
videofileassoc.h
MythCoreContext::GetDB
MythDB * GetDB(void)
Definition: mythcorecontext.cpp:1761
MythUIThemeHelper::FindThemeDir
QString FindThemeDir(const QString &ThemeName, bool Fallback=true)
Returns the full path to the theme denoted by themename.
Definition: mythuithemehelper.cpp:48
clearAllKeys
static void clearAllKeys(void)
Deletes all key bindings and jump points for this host.
Definition: mythfrontend.cpp:1786
SIGPIPE
#define SIGPIPE
Definition: compat.h:139
MythCommandLineParser::PrintVersion
static void PrintVersion(void)
Print application version information.
Definition: mythcommandlineparser.cpp:1380
ScheduleEditor::RunScheduleEditor
static void * RunScheduleEditor(ProgramInfo *proginfo, void *player=nullptr)
Callback.
Definition: scheduleeditor.cpp:59
PlaybackSettings::Load
void Load(void) override
Definition: globalsettings.cpp:4470
mythtranslation.h
StandardSetting::Save
virtual void Save(void)
Definition: standardsettings.cpp:232
JUMP_VIDEO_GALLERY
const QString JUMP_VIDEO_GALLERY
Definition: globals.cpp:39
HardwareProfileTask
Definition: hardwareprofile.h:52
scheduledrecording.h
MEDIASTAT_MOUNTED
@ MEDIASTAT_MOUNTED
Definition: mythmedia.h:21
internal_media_init
static int internal_media_init()
Definition: mythfrontend.cpp:1816
MythUIBusyDialog
Definition: mythprogressdialog.h:36
MythBDInfo::GetNameAndSerialNum
bool GetNameAndSerialNum(QString &Name, QString &SerialNum)
Definition: mythbdinfo.cpp:166
MythCommandLineParser::PrintHelp
void PrintHelp(void) const
Print command line option help.
Definition: mythcommandlineparser.cpp:1396
VideoDialog::DLG_TREE
@ DLG_TREE
Definition: videodlg.h:39
MythSystemEventEditor
An editor for MythSystemEvent handler commands.
Definition: mythsystemevent.h:50
JUMP_VIDEO_BROWSER
const QString JUMP_VIDEO_BROWSER
Definition: globals.cpp:37
GeneralRecPrioritiesSettings
Definition: globalsettings.h:204
GeneralSettings
Definition: globalsettings.h:134
audiogeneralsettings.h
getuid
#define getuid()
Definition: compat.h:183
VideoDialog
Definition: videodlg.h:32
kMSPropagateLogs
@ kMSPropagateLogs
add arguments for MythTV log propagation
Definition: mythsystem.h:52
GENERIC_EXIT_DB_OUTOFDATE
@ GENERIC_EXIT_DB_OUTOFDATE
Database needs upgrade.
Definition: exitcodes.h:19
startCustomPriority
static void startCustomPriority(void)
Definition: mythfrontend.cpp:570
MythHTTPRoot::RedirectRoot
static HTTPResponse RedirectRoot(const HTTPRequest2 &Request, const QString &File)
A convenience method to seemlessly redirect requests for index.html to a context specific file.
Definition: mythhttproot.cpp:24
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:55
JUMP_GALLERY_DEFAULT
const QString JUMP_GALLERY_DEFAULT
Definition: globals.cpp:42
videoglobalsettings.h
g_pmanager
static MythPluginManager * g_pmanager
Definition: mythfrontend.cpp:142
ParentalLevel::plMedium
@ plMedium
Definition: parentalcontrols.h:13
kStartTVNoFlags
@ kStartTVNoFlags
Definition: tv_play.h:113
ParentalLevelChangeChecker::SigResultReady
void SigResultReady(bool passwordValid, ParentalLevel::Level newLevel)
MythCommandLineParser::ApplySettingsOverride
void ApplySettingsOverride(void)
Apply all overrides to the global context.
Definition: mythcommandlineparser.cpp:2941
MediaMonitor
Definition: mediamonitor.h:45
plPeopleSearch
@ plPeopleSearch
Definition: proglist.h:22
MythMainWindow::EnumerateDestinations
QStringList EnumerateDestinations() const
Definition: mythmainwindow.cpp:1475
VideoList
Definition: videolist.h:23
CustomEdit
A screen to create a fully custom recording.
Definition: customedit.h:17
MythCoreContext::GetNumSetting
int GetNumSetting(const QString &key, int defaultval=0)
Definition: mythcorecontext.cpp:916
ViewScheduled::RunViewScheduled
static void * RunViewScheduled(void *player, bool showTv)
Definition: viewscheduled.cpp:28
referencecounter.h
MythUIThemeHelper::InitThemeHelper
void InitThemeHelper()
Definition: mythuithemehelper.cpp:14
channelutil.h
kStartTVIgnoreLastPlayPos
@ kStartTVIgnoreLastPlayPos
Definition: tv_play.h:118
anonymous_namespace{mythfrontend.cpp}::RunSettingsCompletion::OnPasswordResultReady
void OnPasswordResultReady(bool passwordValid, ParentalLevel::Level newLevel)
Definition: mythfrontend.cpp:188
tvremoteutil.h
mythraopdevice.h
MythDate::fromString
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
Definition: mythdate.cpp:39
settingshelper.h
RecStatus::Pending
@ Pending
Definition: recordingstatus.h:17
taskqueue.h
MythPainter::ShowBorders
bool ShowBorders(void) const
Definition: mythpainter.h:102
revokeRoot
static int revokeRoot(void)
Definition: mythfrontend.cpp:1950
MythCoreContext::GetBoolSetting
bool GetBoolSetting(const QString &key, bool defaultval=false)
Definition: mythcorecontext.cpp:910
SettingsHelper
Definition: settingshelper.h:9
standardsettings.h
AutoDeleteDeque< ProgramInfo * >
anonymous_namespace{mythfrontend.cpp}::BookmarkDialog::m_btnPlayBegin
QString m_btnPlayBegin
Definition: mythfrontend.cpp:314
StatusBox
Reports on various status items.
Definition: statusbox.h:37
MythCDROM::inspectImage
static ImageType inspectImage(const QString &path)
Definition: mythcdrom.cpp:188
ParentalLevel::plHigh
@ plHigh
Definition: parentalcontrols.h:14
PreviewGeneratorQueue::TeardownPreviewGeneratorQueue
static void TeardownPreviewGeneratorQueue()
Destroy the singleton queue of preview generators.
Definition: previewgeneratorqueue.cpp:55
mythuihelper.h
ChannelRecPriority
Screen for managing channel priorities in recording scheduling decisions.
Definition: channelrecpriority.h:21
SignalHandler::Init
static void Init(QObject *parent=nullptr)
Definition: signalhandling.cpp:128
DEFAULT_UI_THEME
static constexpr const char * DEFAULT_UI_THEME
Definition: mythuithemehelper.h:7
setDebugShowBorders
static void setDebugShowBorders(void)
Definition: mythfrontend.cpp:1627
mythbdbuffer.h
startSearchMovie
static void startSearchMovie(void)
Definition: mythfrontend.cpp:504
MythPainter::ShowTypeNames
bool ShowTypeNames(void) const
Definition: mythpainter.h:103
MythPainter::SetDebugMode
void SetDebugMode(bool showBorders, bool showNames)
Definition: mythpainter.h:96
MYTH_APPNAME_MYTHFRONTEND
static constexpr const char * MYTH_APPNAME_MYTHFRONTEND
Definition: mythcorecontext.h:21
PlaybackBox
Definition: playbackbox.h:61
startManualSchedule
static void startManualSchedule(void)
Definition: mythfrontend.cpp:637
kMSDisableUDPListener
@ kMSDisableUDPListener
disable MythMessage UDP listener for the duration of application.
Definition: mythsystem.h:50
ReloadJumpPoints
static void ReloadJumpPoints(void)
Definition: mythfrontend.cpp:1704
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
RunVideoScreen
static void RunVideoScreen(VideoDialog::DialogType type, bool fromJump=false)
Definition: mythfrontend.cpp:716
startTVNormal
static void startTVNormal(void)
Definition: mythfrontend.cpp:663
mythmiscutil.h
seteuid
#define seteuid(x)
Definition: compat.h:186
MythDate::secsInPast
std::chrono::seconds secsInPast(const QDateTime &past)
Definition: mythdate.cpp:212
MetadataSettings
Definition: videometadatasettings.h:12
themechooser.h
MythCommandLineParser::toString
QString toString(const QString &key) const
Returns stored QVariant as a QString, falling to default if not provided.
Definition: mythcommandlineparser.cpp:2354
LCD::SetupLCD
static void SetupLCD(void)
Definition: lcddevice.cpp:76
MythBDInfo
Definition: mythbdinfo.h:16
mythhttproot.h
VideoDialog::DialogType
DialogType
Definition: videodlg.h:37
VideoDialog::DLG_MANAGER
@ DLG_MANAGER
Definition: videodlg.h:39
MythCommandLineParser::toBool
bool toBool(const QString &key) const
Returns stored QVariant as a boolean.
Definition: mythcommandlineparser.cpp:2197
handleDVDMedia
static void handleDVDMedia(MythMediaDevice *dvd)
Definition: mythfrontend.cpp:870
MythPainter
Definition: mythpainter.h:34
cleanupguard.h
MythCoreContext::GetSettingOnHost
QString GetSettingOnHost(const QString &key, const QString &host, const QString &defaultval="")
Definition: mythcorecontext.cpp:930
EPGSettings
Definition: globalsettings.h:142
LanguageSelection::prompt
static bool prompt(bool force=false)
Ask the user for the language to use.
Definition: langsettings.cpp:173
MainGeneralSettings
Definition: globalsettings.h:185
MSqlQuery::bindValue
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:888
MythRAOPDevice::Cleanup
static void Cleanup(void)
Definition: mythraopdevice.cpp:72
MythRAOPDevice::Create
static bool Create(void)
Definition: mythraopdevice.cpp:26
AppearanceSettings
Definition: globalsettings.h:151
DialogCompletionEvent
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
Definition: mythdialogbox.h:41
audiooutput.h
MythPluginManager::EnumeratePlugins
QStringList EnumeratePlugins(void)
Definition: mythplugin.cpp:235
SIGUSR2
#define SIGUSR2
Definition: compat.h:138
AudioConfigSettings
Definition: audiogeneralsettings.h:36
mythfrontend_commandlineparser.h
VideoDialog::BRS_FOLDER
@ BRS_FOLDER
Definition: videodlg.h:42
ViewScheduled
Screen for viewing and managing upcoming and conflicted recordings.
Definition: viewscheduled.h:29
REG_JUMP
static void REG_JUMP(const QString &Destination, const QString &Description, const QString &Key, void(*Callback)(void))
Definition: mythmainwindow.h:188
mythcontext.h
VideoDialog::DLG_DEFAULT
@ DLG_DEFAULT
Definition: videodlg.h:38
MEDIATYPE_MGALLERY
@ MEDIATYPE_MGALLERY
Definition: mythmedia.h:33
ChannelUtil::kChanGroupByChanid
@ kChanGroupByChanid
Definition: channelutil.h:217
TV::SetFuncPtr
static void SetFuncPtr(const char *Name, void *Pointer)
Import pointers to functions used to embed the TV window into other containers e.g.
Definition: tv_play.cpp:477
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
MEDIATYPE_DATA
@ MEDIATYPE_DATA
Definition: mythmedia.h:26
DialogCompletionEvent::kEventType
static const Type kEventType
Definition: mythdialogbox.h:57
GetAppBinDir
QString GetAppBinDir(void)
Definition: mythdirs.cpp:260
jumpScreenVideoBrowser
static void jumpScreenVideoBrowser()
Definition: mythfrontend.cpp:768
resetTheme
static bool resetTheme(QString themedir, const QString &badtheme)
Definition: mythfrontend.cpp:1515
SignalHandler::SetHandler
static void SetHandler(int signum, SigHandlerFunc handler)
Definition: signalhandling.cpp:142
REG_MEDIAPLAYER
static void REG_MEDIAPLAYER(const QString &Name, const QString &Desc, MediaPlayCallback Func)
Definition: mythmainwindow.h:209
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition: mythmainwindow.cpp:104
GENERIC_EXIT_NOT_OK
@ GENERIC_EXIT_NOT_OK
Exited with error.
Definition: exitcodes.h:14
REG_MEDIA_HANDLER
static void REG_MEDIA_HANDLER(const QString &destination, const QString &description, void(*callback)(MythMediaDevice *), int mediaType, const QString &extensions)
Definition: mediamonitor.h:138
previewgeneratorqueue.h
g_pUPnp
static MediaRenderer * g_pUPnp
Definition: mythfrontend.cpp:141
startPrevious
static void startPrevious(void)
Definition: mythfrontend.cpp:606
anonymous_namespace{mythfrontend.cpp}::BookmarkDialog
This dialog is used when playing something from the "Watch Videos" page. Playing from the "Watch Reco...
Definition: mythfrontend.cpp:227
MythBDInfo::GetLastError
QString GetLastError(void) const
Definition: mythbdinfo.cpp:173
REG_JUMPEX
static void REG_JUMPEX(const QString &Destination, const QString &Description, const QString &Key, void(*Callback)(void), bool ExitToMain)
Definition: mythmainwindow.h:202
MythCoreContext::ActivateSettingsCache
void ActivateSettingsCache(bool activate=true)
Definition: mythcorecontext.cpp:837
MythScreenType::Exiting
void Exiting()
startGuide
static void startGuide(void)
Definition: mythfrontend.cpp:421
MediaMonitor::defaultDVDdevice
static QString defaultDVDdevice()
DVDDeviceLocation, user-selected drive, or /dev/dvd.
Definition: mediamonitor.cpp:905
MythMainWindow::GetStack
MythScreenStack * GetStack(const QString &Stackname)
Definition: mythmainwindow.cpp:322
anonymous_namespace{mythfrontend.cpp}::BookmarkDialog::Create
bool Create() override
Definition: mythfrontend.cpp:245
VideoListDeathDelay::kDelayTimeMS
static constexpr std::chrono::milliseconds kDelayTimeMS
Definition: videodlg.h:239
resetAllKeys
static void resetAllKeys(void)
Reset this host's key bindings and jump points to default values.
Definition: mythfrontend.cpp:1805
ServerPool::listen
bool listen(QList< QHostAddress > addrs, quint16 port, bool requireall=true, PoolServerType type=kTCPServer)
Definition: serverpool.cpp:395
MythMainWindow::ClearKeyContext
void ClearKeyContext(const QString &Context)
Definition: mythmainwindow.cpp:1204
MythCoreContext::GetHostName
QString GetHostName(void)
Definition: mythcorecontext.cpp:842
MythThemedMenu
Themed menu class, used for main menus in MythTV frontend.
Definition: myththemedmenu.h:57
CleanupMyOldInUsePrograms
static void CleanupMyOldInUsePrograms(void)
Definition: mythfrontend.cpp:1836
MythCoreContext::ReInitLocale
void ReInitLocale(void)
Definition: mythcorecontext.cpp:1869
SettingsHelper::RunProlog
void RunProlog(const QString &settingsPage)
Definition: settingshelper.h:20
MythMediaDevice
Definition: mythmedia.h:48
myththemedmenu.h
manualschedule.h
MythCommandLineParser::ConfigureLogging
int ConfigureLogging(const QString &mask="general", bool progress=false)
Read in logging options and initialize the logging interface.
Definition: mythcommandlineparser.cpp:2870
MythControls
Screen for managing and configuring keyboard input bindings.
Definition: mythcontrols.h:48
MythCoreContext::ClearSettingsCache
void ClearSettingsCache(const QString &myKey=QString(""))
Definition: mythcorecontext.cpp:832
MythCoreContext::IsMasterHost
bool IsMasterHost(void)
is this the same host as the master
Definition: mythcorecontext.cpp:663
musicbrainzngs.caa.hostname
string hostname
Definition: caa.py:17
FALLBACK_UI_THEME
static constexpr const char * FALLBACK_UI_THEME
Definition: mythuithemehelper.h:8
ParentalLevel::Level
Level
Definition: parentalcontrols.h:12
MythUILocation::AddCurrentLocation
void AddCurrentLocation(const QString &Location)
Definition: mythuilocation.cpp:5
setDebugShowNames
static void setDebugShowNames(void)
Definition: mythfrontend.cpp:1636
MediaMonitor::deleteLater
virtual void deleteLater(void)
Definition: mediamonitor.cpp:367
MythCoreContext::SaveSetting
void SaveSetting(const QString &key, int newValue)
Definition: mythcorecontext.cpp:885
TVMenuCallback
static void TVMenuCallback([[maybe_unused]] void *data, QString &selection)
Definition: mythfrontend.cpp:925
WasAutomaticStart
static bool WasAutomaticStart(void)
Definition: mythfrontend.cpp:1847
lcddevice.h
AudioOutput::Cleanup
static void Cleanup(void)
Definition: audiooutput.cpp:50
CustomPriority
Definition: custompriority.h:13
MythPluginManager::DestroyAllPlugins
void DestroyAllPlugins()
Definition: mythplugin.cpp:223
geteuid
#define geteuid()
Definition: compat.h:184
MythTranslation::load
static void load(const QString &module_name)
Load a QTranslator for the user's preferred language.
Definition: mythtranslation.cpp:37
exitcodes.h
GetMythUI
MythUIHelper * GetMythUI()
Definition: mythuihelper.cpp:66
backendconnectionmanager.h
plChannel
@ plChannel
Definition: proglist.h:28
g_menu
static MythThemedMenu * g_menu
Definition: mythfrontend.cpp:131
build_compdb.filename
filename
Definition: build_compdb.py:21
MythMainWindow::RestartInputHandlers
void RestartInputHandlers()
Definition: mythmainwindow.cpp:2101
mythmainwindow.h
MythSystemEventHandler
Handles incoming MythSystemEvent messages.
Definition: mythsystemevent.h:24
MythScreenStack::AddScreen
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Definition: mythscreenstack.cpp:52
MythUIType::SetRedraw
void SetRedraw(void)
Definition: mythuitype.cpp:313
startFinder
static void startFinder(void)
Definition: mythfrontend.cpp:429
MythDVDInfo
Definition: mythdvdinfo.h:19
startSearchPeople
static void startSearchPeople(void)
Definition: mythfrontend.cpp:454
ShowOkPopup
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
Definition: mythdialogbox.cpp:566
reloadTheme_void
static void reloadTheme_void(void)
Definition: mythfrontend.cpp:1620
REG_JUMPLOC
static void REG_JUMPLOC(const QString &Destination, const QString &Description, const QString &Key, void(*Callback)(void), const QString &LocalAction)
Definition: mythmainwindow.h:195
gContext
MythContext * gContext
This global variable contains the MythContext instance for the application.
Definition: mythcontext.cpp:64
GalleryThumbView
Thumbnail screen.
Definition: gallerythumbview.h:23
MythHTTPRewrite::RewriteToSPA
static HTTPResponse RewriteToSPA(const HTTPRequest2 &Request, const QString &File)
A convenience method to seemlessly redirect requests to a Single Page web app (SPA)
Definition: mythhttprewrite.cpp:50
MythContext::Init
bool Init(bool gui=true, bool promptForBackend=false, bool disableAutoDiscovery=false, bool ignoreDB=false)
Definition: mythcontext.cpp:1608
MythMainWindow
Definition: mythmainwindow.h:28
LCD
Definition: lcddevice.h:169
idlescreen.h
SignalHandler::Done
static void Done(void)
Definition: signalhandling.cpp:135
MythCoreContext::SetExiting
void SetExiting(bool exiting=true)
Definition: mythcorecontext.cpp:2120
startSearchKeyword
static void startSearchKeyword(void)
Definition: mythfrontend.cpp:444
videodlg.h
mythbdinfo.h
DestroyMythUI
void DestroyMythUI()
Definition: mythuihelper.cpp:71
viewscheduled.h
GENERIC_EXIT_DB_ERROR
@ GENERIC_EXIT_DB_ERROR
Database error.
Definition: exitcodes.h:20
JUMP_VIDEO_DEFAULT
const QString JUMP_VIDEO_DEFAULT
Definition: globals.cpp:40
GENERIC_EXIT_NO_MYTHCONTEXT
@ GENERIC_EXIT_NO_MYTHCONTEXT
No MythContext available.
Definition: exitcodes.h:16
MythMainWindow::PauseIdleTimer
void PauseIdleTimer(bool Pause)
Pause the idle timeout timer.
Definition: mythmainwindow.cpp:2154
uint
unsigned int uint
Definition: freesurround.h:24
videoplayersettings.h
kStartTVIgnoreBookmark
@ kStartTVIgnoreBookmark
Definition: tv_play.h:116
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:902
ImageAdapterBase::SupportedVideos
static QStringList SupportedVideos()
Return recognised video extensions.
Definition: imagemanager.cpp:325
MSqlQuery::prepare
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:837
MythScreenStack::GetTopScreen
virtual MythScreenType * GetTopScreen(void) const
Definition: mythscreenstack.cpp:182
MythHTTPInstance::AddErrorPageHandler
static void AddErrorPageHandler(const HTTPHandler &Handler)
Definition: mythhttpinstance.cpp:112
startKeysSetup
static void startKeysSetup()
Definition: mythfrontend.cpp:409
plPowerSearch
@ plPowerSearch
Definition: proglist.h:23
InitKeys
static void InitKeys(void)
Definition: mythfrontend.cpp:1711
ChannelInfoList
std::vector< ChannelInfo > ChannelInfoList
Definition: channelinfo.h:131
anonymous_namespace{mythfrontend.cpp}::cleanup
void cleanup()
Definition: mythfrontend.cpp:320
PlayerSettings
Definition: videoplayersettings.h:11