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