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