MythTV  master
mythcontext.cpp
Go to the documentation of this file.
1 #include <QCoreApplication>
2 #include <QDir>
3 #include <QFileInfo>
4 #include <QDebug>
5 #include <QHostInfo>
6 #include <QMutex>
7 #include <QDateTime>
8 #include <QTcpSocket>
9 #include <QEventLoop>
10 
11 #ifdef Q_OS_ANDROID
12 #include <QtAndroidExtras>
13 #endif
14 
15 #include <algorithm>
16 #include <cmath>
17 #include <iostream>
18 #include <queue>
19 #include <thread>
20 #include <vector>
21 
22 #include "config.h"
23 #include "mythcontext.h"
24 #include "exitcodes.h"
25 #include "mythdate.h"
26 #include "remotefile.h"
27 #include "backendselect.h"
28 #include "dbsettings.h"
29 #include "langsettings.h"
30 #include "mythtranslation.h"
31 #include "mythevent.h"
32 #include "dbutil.h"
33 #include "mythmediamonitor.h"
34 
35 #include "mythdb.h"
36 #include "mythdirs.h"
37 #include "mythversion.h"
38 #include "mythdialogbox.h"
39 #include "mythmainwindow.h"
40 #include "mythuihelper.h"
41 #include "mythimage.h"
42 #include "mythxmlclient.h"
43 #include "upnp.h"
44 #include "mythlogging.h"
45 #include "mythsystemlegacy.h"
46 #include "mythmiscutil.h"
47 
48 #include "mythplugin.h"
49 #include "portchecker.h"
50 #include "guistartup.h"
51 
52 #include <unistd.h> // for usleep(), gethostname
53 
54 #ifdef _WIN32
55 #include "compat.h"
56 #endif
57 
58 #define LOC QString("MythContext: ")
59 
60 MythContext *gContext = nullptr;
61 
62 static const QString sLocation = "MythContext";
63 
64 class MythContextPrivate : public QObject
65 {
66  friend class MythContextSlotHandler;
67 
68  public:
69  explicit MythContextPrivate(MythContext *lparent);
70  ~MythContextPrivate() override;
71 
72  bool Init (bool gui,
73  bool prompt, bool noPrompt,
74  bool ignoreDB);
75  bool FindDatabase(bool prompt, bool noAutodetect);
76 
77  void TempMainWindow(bool languagePrompt = true);
78  void EndTempWindow(void);
79 
80  bool LoadDatabaseSettings(void);
81  bool SaveDatabaseParams(const DatabaseParams &params, bool force);
82 
83  bool PromptForDatabaseParams(const QString &error);
84  QString TestDBconnection(bool prompt=true);
85  void SilenceDBerrors(void);
86  void EnableDBerrors(void);
87  void ResetDatabase(void) const;
88 
89  int ChooseBackend(const QString &error);
90  int UPnPautoconf(int milliSeconds = 2000);
91  bool DefaultUPnP(QString &error);
92  bool UPnPconnect(const DeviceLocation *backend, const QString &PIN);
93  void ShowGuiStartup(void);
94  bool checkPort(QString &host, int port, int timeLimit) const;
95  static void processEvents(void);
96  bool saveSettingsCache(void);
97  void loadSettingsCacheOverride(void) const;
98  static void clearSettingsCacheOverride(void);
99 
100 
101  protected:
102  bool event(QEvent* /*e*/) override; // QObject
103 
104  void ShowConnectionFailurePopup(bool persistent);
105  void HideConnectionFailurePopup(void);
106 
107  void ShowVersionMismatchPopup(uint remote_version);
108 
109  public slots:
111 
112  public:
113  MythContext *m_parent {nullptr};
114 
116  bool m_gui {false};
117 
119 
121  QString m_dbHostCp;
122 
124 
125  bool m_disableeventpopup {false};
126 
127  MythUIHelper *m_ui {nullptr};
130  QEventLoop *m_loop {nullptr};
131  bool m_needsBackend {false};
132  bool m_settingsCacheDirty {false};
133 
134  private:
136  int m_registration {-1};
137  QDateTime m_lastCheck;
138  QTcpSocket *m_socket {nullptr};
139  static const std::vector<QString> kSettingsToSave;
140 };
141 
142 static void exec_program_cb(const QString &cmd)
143 {
144  myth_system(cmd);
145 }
146 
147 static void exec_program_tv_cb(const QString &cmd)
148 {
149  QString s = cmd;
150  QStringList tokens = cmd.simplified().split(" ");
151  QStringList strlist;
152 
153  bool cardidok = false;
154  int wantcardid = tokens[0].toInt(&cardidok, 10);
155 
156  if (cardidok && wantcardid > 0)
157  {
158  strlist << QString("LOCK_TUNER %1").arg(wantcardid);
159  s = s.replace(0, tokens[0].length() + 1, "");
160  }
161  else
162  strlist << "LOCK_TUNER";
163 
165  int cardid = strlist[0].toInt();
166 
167  if (cardid >= 0)
168  {
169  s = s.arg(qPrintable(strlist[1]))
170  .arg(qPrintable(strlist[2]))
171  .arg(qPrintable(strlist[3]));
172 
173  myth_system(s);
174 
175  strlist = QStringList(QString("FREE_TUNER %1").arg(cardid));
177  }
178  else
179  {
180  QString label;
181 
182  if (cardidok)
183  {
184  if (cardid == -1)
185  {
186  label = QObject::tr("Could not find specified tuner (%1).")
187  .arg(wantcardid);
188  }
189  else
190  {
191  label = QObject::tr("Specified tuner (%1) is already in use.")
192  .arg(wantcardid);
193  }
194  }
195  else
196  {
197  label = QObject::tr("All tuners are currently in use. If you want "
198  "to watch TV, you can cancel one of the "
199  "in-progress recordings from the delete menu");
200  }
201 
202  LOG(VB_GENERAL, LOG_ALERT, QString("exec_program_tv: ") + label);
203 
204  ShowOkPopup(label);
205  }
206 }
207 
208 static void configplugin_cb(const QString &cmd)
209 {
211  if (!pmanager)
212  return;
213 
214  if (GetNotificationCenter() && pmanager->config_plugin(cmd.trimmed()))
215  {
217  QObject::tr("Failed to configure plugin"));
218  }
219 }
220 
221 static void plugin_cb(const QString &cmd)
222 {
224  if (!pmanager)
225  return;
226 
227  if (GetNotificationCenter() && pmanager->run_plugin(cmd.trimmed()))
228  {
229  ShowNotificationError(QObject::tr("Plugin failure"),
230  sLocation,
231  QObject::tr("%1 failed to run for some reason").arg(cmd));
232  }
233 }
234 
235 static void eject_cb(void)
236 {
238 }
239 
241  : m_parent(lparent),
242  m_sh(new MythContextSlotHandler(this))
243 {
244  m_loop = new QEventLoop(this);
246 }
247 
249 {
250  delete m_pConfig;
252  {
254  }
255 
256  delete m_loop;
257 
258  if (m_ui)
259  DestroyMythUI();
260  if (m_sh)
261  m_sh->deleteLater();
262 }
263 
274 void MythContextPrivate::TempMainWindow(bool languagePrompt)
275 {
276  if (HasMythMainWindow())
277  return;
278 
279  SilenceDBerrors();
280 
281 #ifdef Q_OS_MAC
282  // Qt 4.4 has window-focus problems
283  gCoreContext->OverrideSettingForSession("RunFrontendInWindow", "1");
284 #endif
285  GetMythUI()->Init();
286  MythMainWindow *mainWindow = MythMainWindow::getMainWindow(false);
287  mainWindow->Init();
288 
289  if (languagePrompt)
290  {
291  // ask user for language settings
293  MythTranslation::load("mythfrontend");
294  }
295 }
296 
298 {
299  if (HasMythMainWindow())
300  {
302  {
304  if (mainStack) {
305  mainStack->PopScreen(m_guiStartup, false);
306  m_guiStartup = nullptr;
307  }
308  }
309  }
310  EnableDBerrors();
311 }
312 
322 bool MythContextPrivate::checkPort(QString &host, int port, int timeLimit) const
323 {
324  PortChecker checker;
325  if (m_guiStartup)
327  return checker.checkPort(host, port, timeLimit*1000);
328 }
329 
330 
331 bool MythContextPrivate::Init(const bool gui,
332  const bool promptForBackend,
333  const bool noPrompt,
334  const bool ignoreDB)
335 {
336  gCoreContext->GetDB()->IgnoreDatabase(ignoreDB);
337  m_gui = gui;
339 
340  if (gCoreContext->IsFrontend())
341  m_needsBackend = true;
342 
343  // We don't have a database yet, so lets use the config.xml file.
344  m_pConfig = new XmlConfiguration("config.xml");
345 
346  // Creates screen saver control if we will have a GUI
347  if (gui)
348  m_ui = GetMythUI();
349 
350  // ---- database connection stuff ----
351 
352  if (!ignoreDB && !FindDatabase(promptForBackend, noPrompt))
353  {
354  EndTempWindow();
355  return false;
356  }
357 
358  // ---- keep all DB-using stuff below this line ----
359 
360  // Prompt for language if this is a first time install and
361  // we didn't already do so.
362  if (m_gui && !gCoreContext->GetDB()->HaveSchema())
363  {
364  TempMainWindow(false);
366  MythTranslation::load("mythfrontend");
367  }
370 
371  // Close GUI Startup Window.
372  if (m_guiStartup) {
374  if (mainStack)
375  mainStack->PopScreen(m_guiStartup, false);
376  m_guiStartup=nullptr;
377  }
378  EndTempWindow();
379 
380  if (gui)
381  {
382  MythUIMenuCallbacks cbs {};
384  cbs.exec_program_tv = exec_program_tv_cb;
385  cbs.configplugin = configplugin_cb;
386  cbs.plugin = plugin_cb;
387  cbs.eject = eject_cb;
388 
389  m_ui->Init(cbs);
390  }
391 
392  return true;
393 }
394 
407 bool MythContextPrivate::FindDatabase(bool prompt, bool noAutodetect)
408 {
409  // We can only prompt if autodiscovery is enabled..
410  bool manualSelect = prompt && !noAutodetect;
411 
412  QString failure;
413 
414  // 1. Either load config.xml or use sensible "localhost" defaults:
415  bool loaded = LoadDatabaseSettings();
416  DatabaseParams dbParamsFromFile = m_dbParams;
417 
418  // In addition to the UI chooser, we can also try to autoSelect later,
419  // but only if we're not doing manualSelect and there was no
420  // valid config.xml
421  bool autoSelect = !manualSelect && !loaded && !noAutodetect;
422 
423  // 2. If the user isn't forcing up the chooser UI, look for a default
424  // backend in config.xml, then test DB settings we've got so far:
425  if (!manualSelect)
426  {
427  // config.xml may contain a backend host UUID and PIN.
428  // If so, try to AutoDiscover UPnP server, and use its DB settings:
429 
430  if (DefaultUPnP(failure)) // Probably a valid backend,
431  autoSelect = manualSelect = false; // so disable any further UPnP
432  else
433  if (!failure.isEmpty())
434  LOG(VB_GENERAL, LOG_ALERT, failure);
435 
436  failure = TestDBconnection(loaded);
437  if (failure.isEmpty())
438  goto DBfound;
440  return false;
442  autoSelect=true;
443  }
444 
445  // 3. Try to automatically find the single backend:
446  if (autoSelect)
447  {
448  int count = UPnPautoconf();
449 
450  if (count == 0)
451  failure = QObject::tr("No UPnP backends found", "Backend Setup");
452 
453  if (count == 1)
454  {
455  failure = TestDBconnection();
456  if (failure.isEmpty())
457  goto DBfound;
459  return false;
460  }
461 
462  // Multiple BEs, or needs PIN.
463  manualSelect |= (count > 1 || count == -1);
464  // Search requested
466  manualSelect=true;
467  }
468 
469  manualSelect &= m_gui; // no interactive command-line chooser yet
470 
471  // Queries the user for the DB info
472  do
473  {
474  if (manualSelect)
475  {
476  // Get the user to select a backend from a possible list:
477  auto d = (BackendSelection::Decision)ChooseBackend(failure);
478  switch (d)
479  {
481  break;
483  manualSelect = false;
484  break;
486  goto NoDBfound;
487  }
488  }
489 
490  if (!manualSelect)
491  {
492  if (!PromptForDatabaseParams(failure))
493  goto NoDBfound;
494  }
495  failure = TestDBconnection();
496  if (!failure.isEmpty())
497  LOG(VB_GENERAL, LOG_ALERT, failure);
499  return false;
501  manualSelect=true;
503  manualSelect=false;
504  }
505  while (!failure.isEmpty());
506 
507 DBfound:
508  LOG(VB_GENERAL, LOG_DEBUG, "FindDatabase() - Success!");
509  // If we got the database from UPNP then the wakeup settings are lost.
510  // Restore them.
511  m_dbParams.m_wolEnabled = dbParamsFromFile.m_wolEnabled;
512  m_dbParams.m_wolReconnect = dbParamsFromFile.m_wolReconnect;
513  m_dbParams.m_wolRetry = dbParamsFromFile.m_wolRetry;
514  m_dbParams.m_wolCommand = dbParamsFromFile.m_wolCommand;
515 
517  !loaded || m_dbParams.m_forceSave ||
518  dbParamsFromFile != m_dbParams);
519  EnableDBerrors();
520  ResetDatabase();
521  return true;
522 
523 NoDBfound:
524  LOG(VB_GENERAL, LOG_DEBUG, "FindDatabase() - failed");
525  return false;
526 }
527 
532 {
533  // try new format first
535 
536  m_dbParams.m_localHostName = m_pConfig->GetValue("LocalHostName", "");
539  m_dbParams.m_dbUserName = m_pConfig->GetValue(kDefaultDB + "UserName", "");
540  m_dbParams.m_dbPassword = m_pConfig->GetValue(kDefaultDB + "Password", "");
541  m_dbParams.m_dbName = m_pConfig->GetValue(kDefaultDB + "DatabaseName", "");
543 
545  m_pConfig->GetBoolValue(kDefaultWOL + "Enabled", false);
547  m_pConfig->GetValue(kDefaultWOL + "SQLReconnectWaitTime", 0);
549  m_pConfig->GetValue(kDefaultWOL + "SQLConnectRetry", 5);
551  m_pConfig->GetValue(kDefaultWOL + "Command", "");
552 
553  bool ok = m_dbParams.IsValid("config.xml");
554  if (!ok) // if new format fails, try legacy format
555  {
558  kDefaultMFE + "DBHostName", "");
560  kDefaultMFE + "DBUserName", "");
562  kDefaultMFE + "DBPassword", "");
564  kDefaultMFE + "DBName", "");
566  kDefaultMFE + "DBPort", 0);
567  m_dbParams.m_forceSave = true;
568  ok = m_dbParams.IsValid("config.xml");
569  }
570  if (!ok)
572 
574 
576  if (hostname.isEmpty() ||
577  hostname == "my-unique-identifier-goes-here")
578  {
579  QString localhostname = QHostInfo::localHostName();
580  if (localhostname.isEmpty())
581  {
582  LOG(VB_GENERAL, LOG_ALERT,
583  "MCP: Error, could not determine host name." + ENO);
584  }
585 #ifdef Q_OS_ANDROID
586 #define ANDROID_EXCEPTION_CHECK \
587  if (env->ExceptionCheck()) { \
588  env->ExceptionClear(); \
589  exception=true; \
590  }
591 
592  if ((localhostname == "localhost") || localhostname.isEmpty())
593  {
594  hostname = "android";
595  bool exception=false;
596  QAndroidJniEnvironment env;
597  QAndroidJniObject myID = QAndroidJniObject::fromString("android_id");
598  QAndroidJniObject activity = QtAndroid::androidActivity();
600  QAndroidJniObject appctx = activity.callObjectMethod
601  ("getApplicationContext","()Landroid/content/Context;");
603  QAndroidJniObject contentR = appctx.callObjectMethod
604  ("getContentResolver", "()Landroid/content/ContentResolver;");
606  QAndroidJniObject androidId = QAndroidJniObject::callStaticObjectMethod
607  ("android/provider/Settings$Secure","getString",
608  "(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;",
609  contentR.object<jobject>(),
610  myID.object<jstring>());
612  if (exception)
613  LOG(VB_GENERAL, LOG_ALERT,
614  "Java exception looking for android id");
615  else
616  hostname = QString("android-%1").arg(androidId.toString());
617  }
618  else
619  hostname = localhostname;
620 #else
621  hostname = localhostname;
622 #endif
623  LOG(VB_GENERAL, LOG_INFO, "Empty LocalHostName. This is typical.");
624  }
625  else
626  {
627  m_dbParams.m_localEnabled = true;
628  }
629 
630  LOG(VB_GENERAL, LOG_INFO, QString("Using a profile name of: '%1' (Usually the "
631  "same as this host's name.)")
632  .arg(hostname));
634 
635  return ok;
636 }
637 
639  const DatabaseParams &params, bool force)
640 {
641  bool ret = true;
642 
643  // only rewrite file if it has changed
644  if (params != m_dbParams || force)
645  {
647  "LocalHostName", params.m_localHostName);
648 
650  kDefaultDB + "PingHost", params.m_dbHostPing);
651 
652  // If dbHostName is an IPV6 address with scope,
653  // remove the scope. Unescaped % signs are an
654  // xml violation
655  QString dbHostName(params.m_dbHostName);
656  QHostAddress addr;
657  if (addr.setAddress(dbHostName))
658  {
659  addr.setScopeId(QString());
660  dbHostName = addr.toString();
661  }
663  kDefaultDB + "Host", dbHostName);
665  kDefaultDB + "UserName", params.m_dbUserName);
667  kDefaultDB + "Password", params.m_dbPassword);
669  kDefaultDB + "DatabaseName", params.m_dbName);
671  kDefaultDB + "Port", params.m_dbPort);
672 
674  kDefaultWOL + "Enabled", params.m_wolEnabled);
676  kDefaultWOL + "SQLReconnectWaitTime", params.m_wolReconnect);
678  kDefaultWOL + "SQLConnectRetry", params.m_wolRetry);
680  kDefaultWOL + "Command", params.m_wolCommand);
681 
682  // clear out any legacy nodes..
683  m_pConfig->ClearValue(kDefaultMFE + "DBHostName");
684  m_pConfig->ClearValue(kDefaultMFE + "DBUserName");
685  m_pConfig->ClearValue(kDefaultMFE + "DBPassword");
686  m_pConfig->ClearValue(kDefaultMFE + "DBName");
687  m_pConfig->ClearValue(kDefaultMFE + "DBPort");
688  m_pConfig->ClearValue(kDefaultMFE + "DBHostPing");
689 
690  // actually save the file
691  m_pConfig->Save();
692 
693  // Save the new settings:
694  m_dbParams = params;
696 
697  // If database has changed, force its use:
698  ResetDatabase();
699  }
700  return ret;
701 }
702 
704 {
705  if (d && d->m_loop
706  && d->m_loop->isRunning())
707  d->m_loop->exit();
708 }
709 
710 
712 {
713  bool accepted = false;
714  if (m_gui)
715  {
716  TempMainWindow();
717 
718  // Tell the user what went wrong:
719  if (!error.isEmpty())
721 
722  // ask user for database parameters
723 
724  EnableDBerrors();
726  auto *dbsetting = new DatabaseSettings();
727  auto *ssd = new StandardSettingDialog(mainStack, "databasesettings",
728  dbsetting);
729  if (ssd->Create())
730  {
731  mainStack->AddScreen(ssd);
732  connect(dbsetting, &DatabaseSettings::isClosing,
734  if (!m_loop->isRunning())
735  m_loop->exec();
736  }
737  else
738  delete ssd;
739  SilenceDBerrors();
740  EndTempWindow();
741  accepted = true;
742  }
743  else
744  {
746  QString response;
747  std::this_thread::sleep_for(std::chrono::seconds(1));
748  // give user chance to skip config
749  std::cout << std::endl << error.toLocal8Bit().constData() << std::endl << std::endl;
750  response = getResponse("Would you like to configure the database "
751  "connection now?",
752  "no");
753  if (!response.startsWith('y', Qt::CaseInsensitive))
754  return false;
755 
756  params.m_dbHostName = getResponse("Database host name:",
757  params.m_dbHostName);
758  response = getResponse("Should I test connectivity to this host "
759  "using the ping command?", "yes");
760  params.m_dbHostPing = response.startsWith('y', Qt::CaseInsensitive);
761 
762  params.m_dbPort = intResponse("Database non-default port:",
763  params.m_dbPort);
764  params.m_dbName = getResponse("Database name:",
765  params.m_dbName);
766  params.m_dbUserName = getResponse("Database user name:",
767  params.m_dbUserName);
768  params.m_dbPassword = getResponse("Database password:",
769  params.m_dbPassword);
770 
771  params.m_localHostName = getResponse("Unique identifier for this machine "
772  "(if empty, the local host name "
773  "will be used):",
774  params.m_localHostName);
775  params.m_localEnabled = !params.m_localHostName.isEmpty();
776 
777  response = getResponse("Would you like to use Wake-On-LAN to retry "
778  "database connections?",
779  (params.m_wolEnabled ? "yes" : "no"));
780  params.m_wolEnabled = response.startsWith('y', Qt::CaseInsensitive);
781 
782  if (params.m_wolEnabled)
783  {
784  params.m_wolReconnect = intResponse("Seconds to wait for "
785  "reconnection:",
786  params.m_wolReconnect);
787  params.m_wolRetry = intResponse("Number of times to retry:",
788  params.m_wolRetry);
789  params.m_wolCommand = getResponse("Command to use to wake server or server MAC address:",
790  params.m_wolCommand);
791  }
792 
793  accepted = m_parent->SaveDatabaseParams(params);
794  }
795  return accepted;
796 }
797 
804 {
805  QString err;
806  QString host;
807 
808  // Jan 20, 2017
809  // Changed to use port check instead of ping
810 
811  int port = 0;
812 
813  // 1 = db awake, 2 = db listening, 3 = db connects,
814  // 4 = backend awake, 5 = backend listening
815  // 9 = all ok, 10 = quit
816 
817  enum startupStates {
818  st_start = 0,
819  st_dbAwake = 1,
820  st_dbStarted = 2,
821  st_dbConnects = 3,
822  st_beWOL = 4,
823  st_beAwake = 5,
824  st_success = 6
825  } startupState = st_start;
826 
827  static const std::array<const QString,7> kGuiStatuses
828  {"start","dbAwake","dbStarted","dbConnects","beWOL","beAwake",
829  "success" };
830 
831  int msStartupScreenDelay = gCoreContext->GetNumSetting("StartupScreenDelay",2);
832  if (msStartupScreenDelay > 0)
833  msStartupScreenDelay *= 1000;
834  do
835  {
836  QElapsedTimer timer;
837  timer.start();
838  if (m_dbParams.m_dbHostName.isNull() && !m_dbHostCp.isEmpty())
839  host = m_dbHostCp;
840  else
841  host = m_dbParams.m_dbHostName;
842  port = m_dbParams.m_dbPort;
843  if (port == 0)
844  port = 3306;
845  int wakeupTime = 3;
846  int attempts = 11;
847  if (m_dbParams.m_wolEnabled) {
848  wakeupTime = m_dbParams.m_wolReconnect;
849  attempts = m_dbParams.m_wolRetry + 1;
850  startupState = st_start;
851  }
852  else
853  startupState = st_dbAwake;
854  if (attempts < 6)
855  attempts = 6;
856  if (!prompt)
857  attempts=1;
858  if (wakeupTime < 5)
859  wakeupTime = 5;
860 
861  int progressTotal = wakeupTime * attempts;
862 
864  m_guiStartup->setTotal(progressTotal);
865 
866  QString beWOLCmd = QString();
867  QString backendIP = QString();
868  int backendPort = 0;
869  QString masterserver;
870 
871  for (int attempt = 0;
872  attempt < attempts && startupState != st_success;
873  ++attempt)
874  {
875  // The first time do everything with minimum timeout and
876  // no GUI, for the normal case where all is OK
877  // After that show the GUI (if this is a GUI program)
878 
879  LOG(VB_GENERAL, LOG_INFO,
880  QString("Start up testing connections. DB %1, BE %2, attempt %3, status %4, Delay: %5")
881  .arg(host).arg(backendIP).arg(attempt).arg(kGuiStatuses[startupState]).arg(msStartupScreenDelay) );
882 
883  int useTimeout = wakeupTime;
884  if (attempt == 0)
885  useTimeout=1;
886 
887  if (m_gui && !m_guiStartup)
888  {
889  if (msStartupScreenDelay==0 || timer.hasExpired(msStartupScreenDelay))
890  {
891  ShowGuiStartup();
892  if (m_guiStartup)
893  m_guiStartup->setTotal(progressTotal);
894  }
895  }
897  {
898  if (attempt > 0)
899  m_guiStartup->setStatusState(kGuiStatuses[startupState]);
900  m_guiStartup->setMessageState("empty");
901  processEvents();
902  }
903  switch (startupState) {
904  case st_start:
906  {
907  if (attempt > 0)
909  if (!checkPort(host, port, useTimeout))
910  break;
911  }
912  startupState = st_dbAwake;
913  [[clang::fallthrough]];
914  case st_dbAwake:
915  if (!checkPort(host, port, useTimeout))
916  break;
917  startupState = st_dbStarted;
918  [[clang::fallthrough]];
919  case st_dbStarted:
920  // If the database is connecting with link-local
921  // address, it may have changed
922  if (m_dbParams.m_dbHostName != host)
923  {
924  m_dbParams.m_dbHostName = host;
926  }
927  EnableDBerrors();
928  ResetDatabase();
930  {
931  for (int temp = 0; temp < useTimeout * 2 ; temp++)
932  {
933  processEvents();
934  std::this_thread::sleep_for(std::chrono::milliseconds(500));
935  }
936  break;
937  }
938  startupState = st_dbConnects;
939  [[clang::fallthrough]];
940  case st_dbConnects:
941  if (m_needsBackend)
942  {
943  beWOLCmd = gCoreContext->GetSetting("WOLbackendCommand", "");
944  if (!beWOLCmd.isEmpty())
945  {
946  wakeupTime += gCoreContext->GetNumSetting
947  ("WOLbackendReconnectWaitTime", 0);
948  attempts += gCoreContext->GetNumSetting
949  ("WOLbackendConnectRetry", 0);
950  useTimeout = wakeupTime;
951  if (m_gui && !m_guiStartup && attempt == 0)
952  useTimeout=1;
953  progressTotal = wakeupTime * attempts;
955  m_guiStartup->setTotal(progressTotal);
956  startupState = st_beWOL;
957  }
958  }
959  else {
960  startupState = st_success;
961  break;
962  }
963  masterserver = gCoreContext->GetSetting
964  ("MasterServerName");
965  backendIP = gCoreContext->GetSettingOnHost
966  ("BackendServerAddr", masterserver);
967  backendPort = MythCoreContext::GetMasterServerPort();
968  [[clang::fallthrough]];
969  case st_beWOL:
970  if (!beWOLCmd.isEmpty()) {
971  if (attempt > 0)
972  MythWakeup(beWOLCmd);
973  if (!checkPort(backendIP, backendPort, useTimeout))
974  break;
975  }
976  startupState = st_beAwake;
977  [[clang::fallthrough]];
978  case st_beAwake:
979  if (!checkPort(backendIP, backendPort, useTimeout))
980  break;
981  startupState = st_success;
982  [[clang::fallthrough]];
983  case st_success:
984  // Quiet compiler warning.
985  break;
986  }
987  if (m_guiStartup)
988  {
989  if (m_guiStartup->m_Exit
992  || m_guiStartup->m_Retry)
993  break;
994  }
995  processEvents();
996  }
997  if (startupState == st_success)
998  break;
999 
1000  QString stateMsg = kGuiStatuses[startupState];
1001  stateMsg.append("Fail");
1002  LOG(VB_GENERAL, LOG_INFO,
1003  QString("Start up failure. host %1, status %2")
1004  .arg(host).arg(stateMsg));
1005 
1006  if (m_gui && !m_guiStartup)
1007  {
1008  ShowGuiStartup();
1009  if (m_guiStartup)
1010  m_guiStartup->setTotal(progressTotal);
1011  }
1012 
1013  if (m_guiStartup
1014  && !m_guiStartup->m_Exit
1015  && !m_guiStartup->m_Setup
1016  && !m_guiStartup->m_Search
1017  && !m_guiStartup->m_Retry)
1018  {
1020  m_guiStartup->setStatusState(stateMsg);
1021  m_guiStartup->setMessageState("makeselection");
1022  m_loop->exec();
1023  }
1024  }
1025  while (m_guiStartup && m_guiStartup->m_Retry);
1026 
1027  if (startupState < st_dbAwake)
1028  {
1029  LOG(VB_GENERAL, LOG_WARNING, QString("Pinging to %1 failed, database will be unavailable").arg(host));
1030  SilenceDBerrors();
1031  err = QObject::tr(
1032  "Cannot find (ping) database host %1 on the network",
1033  "Backend Setup");
1034  return err.arg(host);
1035  }
1036 
1037  if (startupState < st_dbConnects)
1038  {
1039  SilenceDBerrors();
1040  return QObject::tr("Cannot login to database", "Backend Setup");
1041  }
1042 
1043  if (startupState < st_success)
1044  {
1045  return QObject::tr("Cannot connect to backend", "Backend Setup");
1046  }
1047 
1048  // Current DB connection may have been silenced (invalid):
1049  EnableDBerrors();
1050  ResetDatabase();
1051 
1052  return QString();
1053 }
1054 
1055 // Show the Gui Startup window.
1056 // This is called if there is a delay in startup for any reason
1057 // such as the database being unavailable
1059 {
1060  if (!m_gui)
1061  return;
1062  TempMainWindow(false);
1063  MythMainWindow *mainWindow = GetMythMainWindow();
1064  MythScreenStack *mainStack = mainWindow->GetMainStack();
1065  if (mainStack) {
1066  if (!m_guiStartup) {
1067  m_guiStartup = new GUIStartup(mainStack,m_loop);
1068  if (!m_guiStartup->Create()) {
1069  delete m_guiStartup;
1070  m_guiStartup = nullptr;
1071  }
1072  if (m_guiStartup) {
1073  mainStack->AddScreen(m_guiStartup, false);
1074  processEvents();
1075  }
1076  }
1077  }
1078 }
1079 
1089 {
1090  // This silences any DB errors from Get*Setting(),
1091  // (which is the vast majority of them)
1093 
1094  // Save the configured hostname, so that we can
1095  // still display it in the DatabaseSettings screens
1096  if (!m_dbParams.m_dbHostName.isEmpty())
1098 
1099  m_dbParams.m_dbHostName.clear();
1101 }
1102 
1104 {
1105  // Restore (possibly) blanked hostname
1106  if (m_dbParams.m_dbHostName.isNull() && !m_dbHostCp.isEmpty())
1107  {
1110  }
1111 
1113 }
1114 
1115 
1128 {
1132 }
1133 
1138 {
1139  TempMainWindow();
1140 
1141  // Tell the user what went wrong:
1142  if (!error.isEmpty())
1143  {
1144  LOG(VB_GENERAL, LOG_ERR, QString("Error: %1").arg(error));
1145  ShowOkPopup(error);
1146  }
1147 
1148  LOG(VB_GENERAL, LOG_INFO, "Putting up the UPnP backend chooser");
1149 
1152 
1153  EndTempWindow();
1154 
1155  return (int)ret;
1156 }
1157 
1164 int MythContextPrivate::UPnPautoconf(const int milliSeconds)
1165 {
1166  LOG(VB_GENERAL, LOG_INFO, QString("UPNP Search %1 secs")
1167  .arg(milliSeconds / 1000));
1168 
1169  SSDP::Instance()->PerformSearch(kBackendURI, milliSeconds / 1000);
1170 
1171  // Search for a total of 'milliSeconds' ms, sending new search packet
1172  // about every 250 ms until less than one second remains.
1173  MythTimer totalTime; totalTime.start();
1174  MythTimer searchTime; searchTime.start();
1175  while (totalTime.elapsed() < milliSeconds)
1176  {
1177  usleep(25000);
1178  int ttl = milliSeconds - totalTime.elapsed();
1179  if ((searchTime.elapsed() > 249) && (ttl > 1000))
1180  {
1181  LOG(VB_GENERAL, LOG_INFO, QString("UPNP Search %1 secs")
1182  .arg(ttl / 1000));
1183  SSDP::Instance()->PerformSearch(kBackendURI, ttl / 1000);
1184  searchTime.start();
1185  }
1186  }
1187 
1189 
1190  if (!backends)
1191  {
1192  LOG(VB_GENERAL, LOG_INFO, "No UPnP backends found");
1193  return 0;
1194  }
1195 
1196  int count = backends->Count();
1197  if (count)
1198  {
1199  LOG(VB_GENERAL, LOG_INFO,
1200  QString("Found %1 UPnP backends").arg(count));
1201  }
1202  else
1203  {
1204  LOG(VB_GENERAL, LOG_ERR,
1205  "No UPnP backends found, but SSDP::Find() not NULL");
1206  }
1207 
1208  if (count != 1)
1209  {
1210  backends->DecrRef();
1211  return count;
1212  }
1213 
1214  // Get this backend's location:
1215  DeviceLocation *BE = backends->GetFirst();
1216  backends->DecrRef();
1217  backends = nullptr;
1218 
1219  // We don't actually know the backend's access PIN, so this will
1220  // only work for ones that have PIN access disabled (i.e. 0000)
1221  int ret = (UPnPconnect(BE, QString())) ? 1 : -1;
1222 
1223  BE->DecrRef();
1224 
1225  return ret;
1226 }
1227 
1234 {
1235  QString loc = "DefaultUPnP() - ";
1236  QString PIN = m_pConfig->GetValue(kDefaultPIN, "");
1237  QString USN = m_pConfig->GetValue(kDefaultUSN, "");
1238 
1239  if (USN.isEmpty())
1240  {
1241  LOG(VB_UPNP, LOG_INFO, loc + "No default UPnP backend");
1242  return false;
1243  }
1244 
1245  LOG(VB_UPNP, LOG_INFO, loc + "config.xml has default " +
1246  QString("PIN '%1' and host USN: %2") .arg(PIN).arg(USN));
1247 
1248  // ----------------------------------------------------------------------
1249 
1250  int timeout_ms = 2000;
1251  LOG(VB_GENERAL, LOG_INFO, QString("UPNP Search up to %1 secs")
1252  .arg(timeout_ms / 1000));
1253  SSDP::Instance()->PerformSearch(kBackendURI, timeout_ms / 1000);
1254 
1255  // ----------------------------------------------------------------------
1256  // We need to give the server time to respond...
1257  // ----------------------------------------------------------------------
1258 
1259  DeviceLocation *pDevLoc = nullptr;
1260  MythTimer totalTime; totalTime.start();
1261  MythTimer searchTime; searchTime.start();
1262  while (totalTime.elapsed() < timeout_ms)
1263  {
1264  pDevLoc = SSDP::Find( kBackendURI, USN );
1265 
1266  if (pDevLoc)
1267  break;
1268 
1269  usleep(25000);
1270 
1271  int ttl = timeout_ms - totalTime.elapsed();
1272  if ((searchTime.elapsed() > 249) && (ttl > 1000))
1273  {
1274  LOG(VB_GENERAL, LOG_INFO, QString("UPNP Search up to %1 secs")
1275  .arg(ttl / 1000));
1276  SSDP::Instance()->PerformSearch(kBackendURI, ttl / 1000);
1277  searchTime.start();
1278  }
1279  }
1280 
1281  // ----------------------------------------------------------------------
1282 
1283  if (!pDevLoc)
1284  {
1285  error = "Cannot find default UPnP backend";
1286  return false;
1287  }
1288 
1289  if (UPnPconnect(pDevLoc, PIN))
1290  {
1291  pDevLoc->DecrRef();
1292  return true;
1293  }
1294 
1295  pDevLoc->DecrRef();
1296 
1297  error = "Cannot connect to default backend via UPnP. Wrong saved PIN?";
1298  return false;
1299 }
1300 
1305  const QString &PIN)
1306 {
1307  QString error;
1308  QString loc = "UPnPconnect() - ";
1309  QString URL = backend->m_sLocation;
1310  MythXMLClient client(URL);
1311 
1312  LOG(VB_UPNP, LOG_INFO, loc + QString("Trying host at %1").arg(URL));
1313  switch (client.GetConnectionInfo(PIN, &m_dbParams, error))
1314  {
1315  case UPnPResult_Success:
1317  LOG(VB_UPNP, LOG_INFO, loc +
1318  "Got database hostname: " + m_dbParams.m_dbHostName);
1319  return true;
1320 
1322  // The stored PIN is probably not correct.
1323  // We could prompt for the PIN and try again, but that needs a UI.
1324  // Easier to fail for now, and put up the full UI selector later
1325  LOG(VB_UPNP, LOG_ERR, loc + "Wrong PIN?");
1326  return false;
1327 
1328  default:
1329  LOG(VB_UPNP, LOG_ERR, loc + error);
1330  break;
1331  }
1332 
1333  // This backend may have a local DB with the default user/pass/DBname.
1334  // For whatever reason, we have failed to get anything back via UPnP,
1335  // so we might as well try the database directly as a last resort.
1336  QUrl theURL(URL);
1337  URL = theURL.host();
1338  if (URL.isEmpty())
1339  return false;
1340 
1341  LOG(VB_UPNP, LOG_INFO, "Trying default DB credentials at " + URL);
1342  m_dbParams.m_dbHostName = URL;
1343 
1344  return true;
1345 }
1346 
1348 {
1349  if (e->type() == MythEvent::MythEventMessage)
1350  {
1351  if (m_disableeventpopup)
1352  return true;
1353 
1355  {
1357  }
1358 
1359  auto *me = dynamic_cast<MythEvent*>(e);
1360  if (me == nullptr)
1361  return true;
1362 
1363  if (me->Message() == "VERSION_MISMATCH" && (1 == me->ExtraDataCount()))
1364  ShowVersionMismatchPopup(me->ExtraData(0).toUInt());
1365  else if (me->Message() == "CONNECTION_FAILURE")
1367  else if (me->Message() == "PERSISTENT_CONNECTION_FAILURE")
1369  else if (me->Message() == "CONNECTION_RESTABLISHED")
1371  return true;
1372  }
1373 
1374  return QObject::event(e);
1375 }
1376 
1378 {
1379  QDateTime now = MythDate::current();
1380 
1381  if (!GetNotificationCenter() || !m_ui || !m_ui->IsScreenSetup())
1382  return;
1383 
1384  if (m_lastCheck.isValid() && now < m_lastCheck)
1385  return;
1386 
1387  // When WOL is disallowed, standy mode,
1388  // we should not show connection failures.
1389  if (!gCoreContext->IsWOLAllowed())
1390  return;
1391 
1392  m_lastCheck = now.addMSecs(5000); // don't refresh notification more than every 5s
1393 
1394  QString description = (persistent) ?
1395  QObject::tr(
1396  "The connection to the master backend "
1397  "server has gone away for some reason. "
1398  "Is it running?") :
1399  QObject::tr(
1400  "Could not connect to the master backend server. Is "
1401  "it running? Is the IP address set for it in "
1402  "mythtv-setup correct?");
1403 
1404  QString message = QObject::tr("Could not connect to master backend");
1405  MythErrorNotification n(message, sLocation, description);
1406  n.SetId(m_registration);
1407  n.SetParent(this);
1409 }
1410 
1412 {
1413  if (!GetNotificationCenter())
1414  return;
1415 
1416  if (!m_lastCheck.isValid())
1417  return;
1418 
1419  MythCheckNotification n(QObject::tr("Backend is online"), sLocation);
1420  n.SetId(m_registration);
1421  n.SetParent(this);
1422  n.SetDuration(5);
1424  m_lastCheck = QDateTime();
1425 }
1426 
1428 {
1429  if (m_mbeVersionPopup)
1430  return;
1431 
1432  QString message =
1433  QObject::tr(
1434  "The server uses network protocol version %1, "
1435  "but this client only understands version %2. "
1436  "Make sure you are running compatible versions of "
1437  "the backend and frontend.")
1438  .arg(remote_version).arg(MYTH_PROTO_VERSION);
1439 
1440  if (HasMythMainWindow() && m_ui && m_ui->IsScreenSetup())
1441  {
1443  message, m_sh, SLOT(VersionMismatchPopupClosed()));
1444  }
1445  else
1446  {
1447  LOG(VB_GENERAL, LOG_ERR, LOC + message);
1448  qApp->exit(GENERIC_EXIT_SOCKET_ERROR);
1449  }
1450 }
1451 
1452 // Process Events while waiting for connection
1453 // return true if progress is 100%
1455 {
1456 // bool ret = false;
1457 // if (m_guiStartup)
1458 // ret = m_guiStartup->updateProgress();
1459  qApp->processEvents(QEventLoop::AllEvents, 250);
1460  qApp->processEvents(QEventLoop::AllEvents, 250);
1461 // return ret;
1462 }
1463 
1464 // cache some settings in cache/contextcache.xml
1465 // only call this if the database is available.
1466 
1467 const std::vector<QString> MythContextPrivate::kSettingsToSave
1468 { "Theme", "Language", "Country", "GuiHeight",
1469  "GuiOffsetX", "GuiOffsetY", "GuiWidth", "RunFrontendInWindow",
1470  "AlwaysOnTop", "HideMouseCursor", "ThemePainter", "libCECEnabled",
1471  "StartupScreenDelay" };
1472 
1473 
1475 {
1476  if (!m_gui)
1477  return true;
1478  QString cacheDirName = GetConfDir() + "/cache/";
1479  QDir dir(cacheDirName);
1480  dir.mkpath(cacheDirName);
1481  XmlConfiguration config = XmlConfiguration("cache/contextcache.xml");
1482  for (const auto & setting : kSettingsToSave)
1483  {
1484  QString cacheValue = config.GetValue("Settings/"+setting,QString());
1486  QString value = gCoreContext->GetSetting(setting,QString());
1487  if (value != cacheValue)
1488  {
1489  config.SetValue("Settings/"+setting,value);
1490  m_settingsCacheDirty = true;
1491  }
1492  }
1494  return config.Save();
1495 }
1496 
1498 {
1499  if (!m_gui)
1500  return;
1501  XmlConfiguration config = XmlConfiguration("cache/contextcache.xml");
1502  for (const auto & setting : kSettingsToSave)
1503  {
1504  if (!gCoreContext->GetSetting(setting,QString()).isEmpty())
1505  continue;
1506  QString value = config.GetValue("Settings/"+setting,QString());
1507  if (!value.isEmpty())
1508  gCoreContext->OverrideSettingForSession(setting, value);
1509  }
1510  // Prevent power off TV after temporary window
1511  gCoreContext->OverrideSettingForSession("PowerOffTVAllowed", nullptr);
1512 
1513  MythTranslation::load("mythfrontend");
1514 }
1515 
1517 {
1518  QString language = gCoreContext->GetSetting("Language",QString());
1519  for (const auto & setting : kSettingsToSave)
1521  // Restore power off TV setting
1522  gCoreContext->ClearOverrideSettingForSession("PowerOffTVAllowed");
1523 
1524  if (language != gCoreContext->GetSetting("Language",QString()))
1525  MythTranslation::load("mythfrontend");
1526 }
1527 
1528 
1530 {
1531  d->m_mbeVersionPopup = nullptr;
1532  qApp->exit(GENERIC_EXIT_SOCKET_ERROR);
1533 }
1534 
1535 MythContext::MythContext(QString binversion, bool needsBackend)
1536  : m_appBinaryVersion(std::move(binversion))
1537 {
1538 #ifdef _WIN32
1539  static bool WSAStarted = false;
1540  if (!WSAStarted) {
1541  WSADATA wsadata;
1542  int res = WSAStartup(MAKEWORD(2, 0), &wsadata);
1543  LOG(VB_SOCKET, LOG_INFO,
1544  QString("WSAStartup returned %1").arg(res));
1545  }
1546 #endif
1547 
1548  d = new MythContextPrivate(this);
1549  d->m_needsBackend = needsBackend;
1550 
1552 
1553  if (!gCoreContext || !gCoreContext->Init())
1554  {
1555  LOG(VB_GENERAL, LOG_EMERG, LOC + "Unable to allocate MythCoreContext");
1556  qApp->exit(GENERIC_EXIT_NO_MYTHCONTEXT);
1557  }
1558 }
1559 
1560 bool MythContext::Init(const bool gui,
1561  const bool promptForBackend,
1562  const bool disableAutoDiscovery,
1563  const bool ignoreDB)
1564 {
1565  if (!d)
1566  {
1567  LOG(VB_GENERAL, LOG_EMERG, LOC + "Init() Out-of-memory");
1568  return false;
1569  }
1570 
1571  SetDisableEventPopup(true);
1572 
1574  {
1575  LOG(VB_GENERAL, LOG_EMERG,
1576  QString("Application binary version (%1) does not "
1577  "match libraries (%2)")
1579 
1580  QString warning = QObject::tr(
1581  "This application is not compatible "
1582  "with the installed MythTV libraries.");
1583  if (gui)
1584  {
1585  d->TempMainWindow(false);
1586  ShowOkPopup(warning);
1587  }
1588  LOG(VB_GENERAL, LOG_WARNING, warning);
1589 
1590  return false;
1591  }
1592 
1593 #ifdef _WIN32
1594  // HOME environment variable might not be defined
1595  // some libraries will fail without it
1596  QString home = getenv("HOME");
1597  if (home.isEmpty())
1598  {
1599  home = getenv("LOCALAPPDATA"); // Vista
1600  if (home.isEmpty())
1601  home = getenv("APPDATA"); // XP
1602  if (home.isEmpty())
1603  home = QString("."); // getenv("TEMP")?
1604 
1605  _putenv(QString("HOME=%1").arg(home).toLocal8Bit().constData());
1606  }
1607 #endif
1608 
1609  // If HOME isn't defined, we won't be able to use default confdir of
1610  // $HOME/.mythtv nor can we rely on a MYTHCONFDIR that references $HOME
1611  QString homedir = QDir::homePath();
1612  QString confdir = getenv("MYTHCONFDIR");
1613  if ((homedir.isEmpty() || homedir == "/") &&
1614  (confdir.isEmpty() || confdir.contains("$HOME")))
1615  {
1616  QString warning = "Cannot locate your home directory."
1617  " Please set the environment variable HOME";
1618  if (gui)
1619  {
1620  d->TempMainWindow(false);
1621  ShowOkPopup(warning);
1622  }
1623  LOG(VB_GENERAL, LOG_WARNING, warning);
1624 
1625  return false;
1626  }
1627 
1628  if (!d->Init(gui, promptForBackend, disableAutoDiscovery, ignoreDB))
1629  {
1630  return false;
1631  }
1632 
1633  SetDisableEventPopup(false);
1635  if (d->m_settingsCacheDirty)
1636  {
1637 #ifndef Q_OS_ANDROID
1639 #endif
1640  d->m_settingsCacheDirty = false;
1641  }
1644 
1645  return true;
1646 }
1647 
1649 {
1650  gCoreContext->InitPower(false /*destroy*/);
1651  if (MThreadPool::globalInstance()->activeThreadCount())
1652  LOG(VB_GENERAL, LOG_INFO, "Waiting for threads to exit.");
1653 
1655  SSDP::Shutdown();
1657 
1658  LOG(VB_GENERAL, LOG_INFO, "Exiting");
1659 
1660  logStop();
1661 
1662  delete gCoreContext;
1663  gCoreContext = nullptr;
1664 
1665  delete d;
1666 }
1667 
1669 {
1670  d->m_disableeventpopup = check;
1671 }
1672 
1674 {
1675  return d->m_dbParams;
1676 }
1677 
1679 {
1680  return d->SaveDatabaseParams(params, false);
1681 }
1682 
1684 {
1685  return d->saveSettingsCache();
1686 }
1687 
1688 /* vim: set expandtab tabstop=4 shiftwidth=4: */
force
bool force
Definition: mythtv/programs/mythcommflag/main.cpp:74
GUIStartup::setTotal
void setTotal(int total)
Definition: guistartup.cpp:128
MythContextPrivate::ShowConnectionFailurePopup
void ShowConnectionFailurePopup(bool persistent)
Definition: mythcontext.cpp:1377
MythMainWindow::GetMainStack
MythScreenStack * GetMainStack()
Definition: mythmainwindow.cpp:321
e
QDomElement e
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:1420
mythevent.h
XmlConfiguration::Save
bool Save(void) override
Definition: configuration.cpp:88
MythContext::MythContext
MythContext(QString binversion, bool needsBackend=false)
Definition: mythcontext.cpp:1535
MythEvent::MythEventMessage
static Type MythEventMessage
Definition: mythevent.h:73
ENO
#define ENO
This can be appended to the LOG args with "+".
Definition: mythlogging.h:72
myth_system
uint myth_system(const QString &command, uint flags, uint timeout)
Definition: mythsystemlegacy.cpp:501
PortChecker
Small class to handle TCP port checking and finding link-local context.
Definition: portchecker.h:44
GUIStartup::Create
bool Create(void) override
Definition: guistartup.cpp:67
MythDB::HaveSchema
bool HaveSchema(void) const
Get a flag indicating that we have discovered tables and that this therefore not a new empty database...
Definition: mythdb.cpp:951
DatabaseParams::m_dbHostName
QString m_dbHostName
database server
Definition: mythdbparams.h:21
MediaMonitor::ejectOpticalDisc
static void ejectOpticalDisc(void)
Eject a disk, unmount a drive, open a tray.
Definition: mythmediamonitor.cpp:987
MythContextSlotHandler::VersionMismatchPopupClosed
void VersionMismatchPopupClosed(void)
Definition: mythcontext.cpp:1529
MythPluginManager
Definition: mythplugin.h:63
dbutil.h
MythDB::IgnoreDatabase
void IgnoreDatabase(bool bIgnore)
Definition: mythdb.cpp:222
error
static void error(const char *str,...)
Definition: vbi.cpp:42
ReferenceCounter::DecrRef
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
Definition: referencecounter.cpp:125
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
ShowOkPopup
MythConfirmationDialog * ShowOkPopup(const QString &message, QObject *parent, const char *slot, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
Definition: mythdialogbox.cpp:551
MythContextPrivate::event
bool event(QEvent *) override
Definition: mythcontext.cpp:1347
mythdb.h
MythContextPrivate::UPnPautoconf
int UPnPautoconf(int milliSeconds=2000)
If there is only a single UPnP backend, use it.
Definition: mythcontext.cpp:1164
MythCoreContext::SendReceiveStringList
bool SendReceiveStringList(QStringList &strlist, bool quickTimeout=false, bool block=true)
Send a message to the backend and wait for a response.
Definition: mythcorecontext.cpp:1376
MythContextPrivate::kSettingsToSave
static const std::vector< QString > kSettingsToSave
Definition: mythcontext.cpp:139
MythTimer
A QElapsedTimer based timer to replace use of QTime as a timer.
Definition: mythtimer.h:14
MythCheckNotification
Definition: mythnotification.h:384
MythContext::GetDatabaseParams
DatabaseParams GetDatabaseParams(void)
Definition: mythcontext.cpp:1673
DatabaseParams::m_forceSave
bool m_forceSave
set to true to force a save of the settings file
Definition: mythdbparams.h:39
MythContextPrivate::m_mbeVersionPopup
MythConfirmationDialog * m_mbeVersionPopup
Definition: mythcontext.cpp:135
MythNotificationCenter::Register
int Register(void *from)
An application can register in which case it will be assigned a reusable screen, which can be modifie...
Definition: mythnotificationcenter.cpp:1370
MythCoreContext::GetDBManager
MDBManager * GetDBManager(void)
Definition: mythcorecontext.cpp:882
MythUIHelper::IsScreenSetup
bool IsScreenSetup() const
Definition: mythuihelper.cpp:98
MythPluginManager::run_plugin
bool run_plugin(const QString &plugname)
Definition: mythplugin.cpp:159
DatabaseParams
Structure containing the basic Database parameters.
Definition: mythdbparams.h:10
dbsettings.h
mythplugin.h
MythCoreContext::InitLocale
void InitLocale(void)
Definition: mythcorecontext.cpp:1827
MythContext
Startup context for MythTV.
Definition: mythcontext.h:43
XmlConfiguration::GetValue
int GetValue(const QString &sSetting, int Default) override
Definition: configuration.cpp:210
MythXMLClient
Definition: mythxmlclient.h:33
MythContextPrivate::saveSettingsCache
bool saveSettingsCache(void)
Definition: mythcontext.cpp:1474
MythCoreContext::OverrideSettingForSession
void OverrideSettingForSession(const QString &key, const QString &value)
Definition: mythcorecontext.cpp:1342
MythEvent
This class is used as a container for messages.
Definition: mythevent.h:17
MythContext::SetDisableEventPopup
void SetDisableEventPopup(bool check)
Definition: mythcontext.cpp:1668
MythContextPrivate::TestDBconnection
QString TestDBconnection(bool prompt=true)
Some quick sanity checks before opening a database connection.
Definition: mythcontext.cpp:803
mythxmlclient.h
kDefaultWOL
const QString kDefaultWOL
Definition: backendselect.h:23
mythdialogbox.h
MythScreenStack
Definition: mythscreenstack.h:16
arg
arg(title).arg(filename).arg(doDelete))
SSDP::Find
static SSDPCacheEntries * Find(const QString &sURI)
Definition: ssdp.h:126
mythmediamonitor.h
MythContextPrivate::m_loop
QEventLoop * m_loop
Definition: mythcontext.cpp:130
MythContextPrivate::m_parent
MythContext * m_parent
Definition: mythcontext.cpp:113
confdir
static QString confdir
Definition: mythdirs.cpp:20
MythTimer::start
void start(void)
starts measuring elapsed time.
Definition: mythtimer.cpp:47
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
MythContextPrivate::~MythContextPrivate
~MythContextPrivate() override
Definition: mythcontext.cpp:248
MythContextPrivate::UPnPconnect
bool UPnPconnect(const DeviceLocation *backend, const QString &PIN)
Query a backend via UPnP for its database connection parameters.
Definition: mythcontext.cpp:1304
DatabaseSettings::isClosing
void isClosing(void)
MythContextPrivate::ShowVersionMismatchPopup
void ShowVersionMismatchPopup(uint remote_version)
Definition: mythcontext.cpp:1427
mythdirs.h
MythContextPrivate::ShowGuiStartup
void ShowGuiStartup(void)
Definition: mythcontext.cpp:1058
DeviceLocation
Definition: upnpdevice.h:208
MythContextPrivate::m_disableeventpopup
bool m_disableeventpopup
Definition: mythcontext.cpp:125
HasMythMainWindow
bool HasMythMainWindow(void)
Definition: mythmainwindow.cpp:110
MythCoreContext::InitPower
void InitPower(bool Create=true)
Definition: mythcorecontext.cpp:1814
GUIStartup::m_Search
bool m_Search
Definition: guistartup.h:57
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
PortChecker::checkPort
bool checkPort(QString &host, int port, int timeLimit=30000, bool linkLocalOnly=false)
Check if a port is open and sort out the link-local scope.
Definition: portchecker.cpp:73
MythContextPrivate::EnableDBerrors
void EnableDBerrors(void)
Definition: mythcontext.cpp:1103
XmlConfiguration
Definition: configuration.h:52
SSDP::Shutdown
static void Shutdown()
Definition: ssdp.cpp:63
langsettings.h
MythContext::m_appBinaryVersion
QString m_appBinaryVersion
Definition: mythcontext.h:61
InitializeMythDirs
void InitializeMythDirs(void)
Definition: mythdirs.cpp:30
DatabaseSettings
Definition: dbsettings.h:11
exec_program_tv_cb
static void exec_program_tv_cb(const QString &cmd)
Definition: mythcontext.cpp:147
mythversion.h
mythsystemlegacy.h
MythMainWindow::getMainWindow
static MythMainWindow * getMainWindow(bool useDB=true)
Return the existing main window, or create one.
Definition: mythmainwindow.cpp:81
eject_cb
static void eject_cb(void)
Definition: mythcontext.cpp:235
MythCoreContext::ClearOverrideSettingForSession
void ClearOverrideSettingForSession(const QString &key)
Definition: mythcorecontext.cpp:1348
SSDP::Instance
static SSDP * Instance()
Definition: ssdp.cpp:53
Configuration::ClearValue
virtual void ClearValue(const QString &sSetting)=0
MythContext::d
MythContextPrivate * d
Definition: mythcontext.h:60
DatabaseParams::m_wolReconnect
int m_wolReconnect
seconds to wait for reconnect
Definition: mythdbparams.h:34
StandardSettingDialog
Definition: standardsettings.h:466
MythWakeup
bool MythWakeup(const QString &wakeUpCommand, uint flags, uint timeout)
Definition: mythmiscutil.cpp:672
MythNotification::SetParent
void SetParent(void *parent)
contains the parent address.
Definition: mythnotification.h:132
DatabaseParams::m_dbPort
int m_dbPort
database port
Definition: mythdbparams.h:23
kDefaultDB
const QString kDefaultDB
Definition: backendselect.h:22
MythNotification::SetId
void SetId(int id)
Optional MythNotification elements.
Definition: mythnotification.cpp:30
mythdate.h
Configuration::SetValue
virtual void SetValue(const QString &sSetting, int value)=0
MDBManager::CloseDatabases
void CloseDatabases(void)
Definition: mythdbcon.cpp:468
upnp.h
guistartup.h
mythlogging.h
MythContextPrivate::m_settingsCacheDirty
bool m_settingsCacheDirty
Definition: mythcontext.cpp:132
MythContextPrivate::OnCloseDialog
void OnCloseDialog()
MythCoreContext::Init
bool Init(void)
Definition: mythcorecontext.cpp:236
GetConfDir
QString GetConfDir(void)
Definition: mythdirs.cpp:224
XmlConfiguration::SetValue
void SetValue(const QString &sSetting, int value) override
Definition: configuration.cpp:250
DatabaseParams::m_dbHostPing
bool m_dbHostPing
Can we test connectivity using ping?
Definition: mythdbparams.h:22
remotefile.h
MythContextPrivate::EndTempWindow
void EndTempWindow(void)
Definition: mythcontext.cpp:297
configplugin_cb
static void configplugin_cb(const QString &cmd)
Definition: mythcontext.cpp:208
MThreadPool::waitForDone
void waitForDone(void)
Definition: mthreadpool.cpp:562
MythContextPrivate::m_pConfig
Configuration * m_pConfig
Definition: mythcontext.cpp:123
compat.h
BackendSelection::kCancelConfigure
@ kCancelConfigure
Definition: backendselect.h:45
MythContextPrivate::m_socket
QTcpSocket * m_socket
Definition: mythcontext.cpp:138
MSqlQuery::testDBConnection
static bool testDBConnection()
Checks DB connection + login (login info via Mythcontext)
Definition: mythdbcon.cpp:852
MythContextPrivate::MythContextPrivate
MythContextPrivate(MythContext *lparent)
Definition: mythcontext.cpp:240
MythContextPrivate::ChooseBackend
int ChooseBackend(const QString &error)
Search for backends via UPnP, put up a UI for the user to choose one.
Definition: mythcontext.cpp:1137
DestroyMythMainWindow
void DestroyMythMainWindow(void)
Definition: mythmainwindow.cpp:115
DeviceLocation::m_sLocation
QString m_sLocation
Definition: upnpdevice.h:233
MythCoreContext::IsFrontend
bool IsFrontend(void) const
is this process a frontend process
Definition: mythcorecontext.cpp:671
BackendSelection::kAcceptConfigure
@ kAcceptConfigure
Definition: backendselect.h:46
MythErrorNotification
Definition: mythnotification.h:362
getResponse
QString getResponse(const QString &query, const QString &def)
In an interactive shell, prompt the user to input a string.
Definition: mythmiscutil.cpp:452
MythCoreContext::GetDB
MythDB * GetDB(void)
Definition: mythcorecontext.cpp:1764
mythtranslation.h
Configuration::GetBoolValue
virtual bool GetBoolValue(const QString &sSetting, bool Default)=0
MythContextPrivate::SaveDatabaseParams
bool SaveDatabaseParams(const DatabaseParams &params, bool force)
Definition: mythcontext.cpp:638
MythContextPrivate::Init
bool Init(bool gui, bool prompt, bool noPrompt, bool ignoreDB)
Definition: mythcontext.cpp:331
DatabaseParams::m_dbPassword
QString m_dbPassword
DB password.
Definition: mythdbparams.h:25
portchecker.h
sLocation
static const QString sLocation
Definition: mythcontext.cpp:62
DatabaseParams::m_wolRetry
int m_wolRetry
times to retry to reconnect
Definition: mythdbparams.h:35
kBackendURI
const QString kBackendURI
Definition: backendselect.h:21
DatabaseParams::m_dbName
QString m_dbName
database name
Definition: mythdbparams.h:26
MythContextPrivate::PromptForDatabaseParams
bool PromptForDatabaseParams(const QString &error)
Definition: mythcontext.cpp:711
TaskQueue::Shutdown
static void Shutdown()
Definition: taskqueue.cpp:68
SSDPCacheEntries
Definition: ssdpcache.h:35
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
UPnPResult_ActionNotAuthorized
@ UPnPResult_ActionNotAuthorized
Definition: upnp.h:49
MythContextPrivate::m_ui
MythUIHelper * m_ui
Definition: mythcontext.cpp:127
MythContextPrivate::clearSettingsCacheOverride
static void clearSettingsCacheOverride(void)
Definition: mythcontext.cpp:1516
MythCoreContext::GetNumSetting
int GetNumSetting(const QString &key, int defaultval=0)
Definition: mythcorecontext.cpp:929
logStop
void logStop(void)
Entry point for stopping logging for an application.
Definition: logging.cpp:738
MythContextPrivate::m_registration
int m_registration
Definition: mythcontext.cpp:136
MythContextPrivate::m_masterhostname
QString m_masterhostname
master backend hostname
Definition: mythcontext.cpp:118
exec_program_cb
static void exec_program_cb(const QString &cmd)
Definition: mythcontext.cpp:142
MythUIMenuCallbacks::exec_program
void(* exec_program)(const QString &cmd)
Definition: mythuihelper.h:16
MythCoreContext::SetLocalHostname
void SetLocalHostname(const QString &hostname)
Definition: mythcorecontext.cpp:1737
MythContextSlotHandler::d
MythContextPrivate * d
Definition: mythcontext.h:30
MythDate::fromString
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
Definition: mythdate.cpp:30
plugin_cb
static void plugin_cb(const QString &cmd)
Definition: mythcontext.cpp:221
GUIStartup::updateProgress
bool updateProgress(bool finished)
Definition: guistartup.cpp:144
MythPluginManager::config_plugin
bool config_plugin(const QString &plugname)
Definition: mythplugin.cpp:177
mythuihelper.h
MythContextPrivate::SilenceDBerrors
void SilenceDBerrors(void)
Cause MSqlDatabase::OpenDatabase() and MSqlQuery to fail silently.
Definition: mythcontext.cpp:1088
MythTimer::elapsed
int elapsed(void)
Returns milliseconds elapsed since last start() or restart()
Definition: mythtimer.cpp:90
MYTH_BINARY_VERSION
#define MYTH_BINARY_VERSION
Update this whenever the plug-in ABI changes.
Definition: mythversion.h:15
MythContextPrivate::m_sh
MythContextSlotHandler * m_sh
Definition: mythcontext.cpp:128
MythCoreContext::GetMasterServerPort
static int GetMasterServerPort(void)
Returns the Master Backend control port If no master server port has been defined in the database,...
Definition: mythcorecontext.cpp:997
MYTH_PROTO_VERSION
#define MYTH_PROTO_VERSION
Increment this whenever the MythTV network protocol changes.
Definition: mythversion.h:47
GUIStartup::m_Retry
bool m_Retry
Definition: guistartup.h:56
mythimage.h
DatabaseParams::LoadDefaults
void LoadDefaults(void)
Load sensible connection defaults.
Definition: mythdbparams.cpp:9
GUIStartup::setMessageState
bool setMessageState(const QString &name)
Definition: guistartup.cpp:117
MythContextPrivate::FindDatabase
bool FindDatabase(bool prompt, bool noAutodetect)
Get database connection settings and test connectivity.
Definition: mythcontext.cpp:407
GUIStartup::setStatusState
bool setStatusState(const QString &name)
Definition: guistartup.cpp:107
MythCoreContext
This class contains the runtime context for MythTV.
Definition: mythcorecontext.h:55
mythmiscutil.h
MythConfirmationDialog
Dialog asking for user confirmation.
Definition: mythdialogbox.h:222
MythContextPrivate::LoadDatabaseSettings
bool LoadDatabaseSettings(void)
Load database and host settings from config.xml, or set some defaults.
Definition: mythcontext.cpp:531
MythContext::SaveDatabaseParams
bool SaveDatabaseParams(const DatabaseParams &params)
Definition: mythcontext.cpp:1678
Configuration
Definition: configuration.h:22
dir
QDir dir
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:1174
GUIStartup
Definition: guistartup.h:49
intResponse
int intResponse(const QString &query, int def)
In an interactive shell, prompt the user to input a number.
Definition: mythmiscutil.cpp:482
MythContextPrivate::m_dbParams
DatabaseParams m_dbParams
Current database host & WOL details.
Definition: mythcontext.cpp:120
MythContextPrivate::HideConnectionFailurePopup
void HideConnectionFailurePopup(void)
Definition: mythcontext.cpp:1411
Configuration::Save
virtual bool Save(void)=0
DatabaseParams::m_wolCommand
QString m_wolCommand
command to use for wake-on-lan
Definition: mythdbparams.h:36
MythCoreContext::GetSettingOnHost
QString GetSettingOnHost(const QString &key, const QString &host, const QString &defaultval="")
Definition: mythcorecontext.cpp:943
LOC
#define LOC
Definition: mythcontext.cpp:58
LanguageSelection::prompt
static bool prompt(bool force=false)
Ask the user for the language to use.
Definition: langsettings.cpp:173
MythDB::SetDatabaseParams
void SetDatabaseParams(const DatabaseParams &params)
Definition: mythdb.cpp:203
MythDB::SetSuppressDBMessages
void SetSuppressDBMessages(bool bUpgraded)
Definition: mythdb.cpp:232
BackendSelection::kManualConfigure
@ kManualConfigure
Definition: backendselect.h:44
DatabaseParams::m_dbUserName
QString m_dbUserName
DB user name.
Definition: mythdbparams.h:24
MythNotification::SetDuration
void SetDuration(int duration)
contains a duration during which the notification will be displayed for.
Definition: mythnotification.h:156
GENERIC_EXIT_SOCKET_ERROR
#define GENERIC_EXIT_SOCKET_ERROR
Socket error.
Definition: exitcodes.h:18
BackendSelection::Decision
Decision
Definition: backendselect.h:43
SSDP::PerformSearch
void PerformSearch(const QString &sST, uint timeout_secs=2)
Definition: ssdp.cpp:200
MythContextPrivate::checkPort
bool checkPort(QString &host, int port, int timeLimit) const
Check if a port is open and sort out the link-local scope.
Definition: mythcontext.cpp:322
GetNotificationCenter
MythNotificationCenter * GetNotificationCenter(void)
Definition: mythmainwindow.cpp:125
mythcontext.h
MythNotificationCenter::UnRegister
void UnRegister(void *from, int id, bool closeimemdiately=false)
Unregister the client.
Definition: mythnotificationcenter.cpp:1375
MythScreenStack::PopScreen
virtual void PopScreen(MythScreenType *screen=nullptr, bool allowFade=true, bool deleteScreen=true)
Definition: mythscreenstack.cpp:83
kDefaultUSN
const QString kDefaultUSN
Definition: backendselect.h:26
GENERIC_EXIT_NO_MYTHCONTEXT
#define GENERIC_EXIT_NO_MYTHCONTEXT
No MythContext available.
Definition: exitcodes.h:13
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition: mythmainwindow.cpp:105
Configuration::GetValue
virtual int GetValue(const QString &sSetting, int Default)=0
BackendSelection::Prompt
static Decision Prompt(DatabaseParams *dbParams, Configuration *pConfig)
Definition: backendselect.cpp:47
MythXMLClient::GetConnectionInfo
UPnPResultCode GetConnectionInfo(const QString &sPin, DatabaseParams *pParams, QString &sMsg)
Definition: mythxmlclient.cpp:34
MythContextPrivate::TempMainWindow
void TempMainWindow(bool languagePrompt=true)
Setup a minimal themed main window, and prompt for user's language.
Definition: mythcontext.cpp:274
MythCoreContext::ActivateSettingsCache
void ActivateSettingsCache(bool activate=true)
Definition: mythcorecontext.cpp:850
MythContextPrivate::m_lastCheck
QDateTime m_lastCheck
Definition: mythcontext.cpp:137
MythContextPrivate::ResetDatabase
void ResetDatabase(void) const
Called when the user changes the DB connection settings.
Definition: mythcontext.cpp:1127
kDefaultPIN
const QString kDefaultPIN
Definition: backendselect.h:25
MythUIHelper::Init
void Init(MythUIMenuCallbacks &cbs)
Definition: mythuihelper.cpp:76
MythContextSlotHandler::OnCloseDialog
void OnCloseDialog(void)
Definition: mythcontext.cpp:703
MythContextPrivate::m_needsBackend
bool m_needsBackend
Definition: mythcontext.cpp:131
MythContextPrivate::processEvents
static void processEvents(void)
Definition: mythcontext.cpp:1454
GUIStartup::m_Setup
bool m_Setup
Definition: guistartup.h:55
MythCoreContext::ClearSettingsCache
void ClearSettingsCache(const QString &myKey=QString(""))
Definition: mythcorecontext.cpp:845
musicbrainzngs.caa.hostname
string hostname
Definition: caa.py:17
DatabaseParams::m_localEnabled
bool m_localEnabled
true if localHostName is not default
Definition: mythdbparams.h:29
UPnPResult_Success
@ UPnPResult_Success
Definition: upnp.h:38
backendselect.h
MythContextPrivate::m_dbHostCp
QString m_dbHostCp
dbHostName backup
Definition: mythcontext.cpp:121
d
static const iso6937table * d
Definition: iso6937tables.cpp:1025
MythCoreContext::IsWOLAllowed
bool IsWOLAllowed() const
Definition: mythcorecontext.cpp:651
MythContextPrivate::DefaultUPnP
bool DefaultUPnP(QString &error)
Get the default backend from config.xml, use UPnP to find it.
Definition: mythcontext.cpp:1233
MythUIHelper
Definition: mythuihelper.h:25
MythContextSlotHandler
Definition: mythcontext.h:15
DatabaseParams::m_wolEnabled
bool m_wolEnabled
true if wake-on-lan params are used
Definition: mythdbparams.h:33
MythTranslation::load
static void load(const QString &module_name)
Load a QTranslator for the user's preferred language.
Definition: mythtranslation.cpp:37
exitcodes.h
SSDPCacheEntries::Count
uint Count(void) const
Definition: ssdpcache.h:44
GetMythUI
MythUIHelper * GetMythUI()
Definition: mythuihelper.cpp:66
kDefaultMFE
const QString kDefaultMFE
Definition: backendselect.h:24
MThreadPool::globalInstance
static MThreadPool * globalInstance(void)
Definition: mthreadpool.cpp:306
MythCoreContext::GetPluginManager
MythPluginManager * GetPluginManager(void)
Definition: mythcorecontext.cpp:2086
mythmainwindow.h
MythScreenStack::AddScreen
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Definition: mythscreenstack.cpp:49
DatabaseParams::m_localHostName
QString m_localHostName
name used for loading/saving settings
Definition: mythdbparams.h:30
MythCoreContext::SaveLocaleDefaults
void SaveLocaleDefaults(void)
Definition: mythcorecontext.cpp:1859
MythContextPrivate::m_gui
bool m_gui
Should this context use GUI elements?
Definition: mythcontext.cpp:116
ANDROID_EXCEPTION_CHECK
#define ANDROID_EXCEPTION_CHECK
Definition: audiooutputaudiotrack.cpp:14
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
PortChecker::cancelPortCheck
void cancelPortCheck(void)
Cancel the checkPort operation currently in progress.
Definition: portchecker.cpp:247
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
DatabaseParams::IsValid
bool IsValid(const QString &source=QString("Unknown")) const
Definition: mythdbparams.cpp:36
MythContextPrivate::m_guiStartup
GUIStartup * m_guiStartup
Definition: mythcontext.cpp:129
SSDPCacheEntries::GetFirst
DeviceLocation * GetFirst(void)
Returns random entry in cache, returns nullptr when list is empty.
Definition: ssdpcache.cpp:80
MythContext::saveSettingsCache
bool saveSettingsCache(void)
Definition: mythcontext.cpp:1683
DestroyMythUI
void DestroyMythUI()
Definition: mythuihelper.cpp:71
GUIStartup::cancelPortCheck
void cancelPortCheck(void)
MythContextPrivate::loadSettingsCacheOverride
void loadSettingsCacheOverride(void) const
Definition: mythcontext.cpp:1497
MythContext::~MythContext
virtual ~MythContext()
Definition: mythcontext.cpp:1648
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:915
MythContextPrivate
Definition: mythcontext.cpp:65
MythNotificationCenter::Queue
bool Queue(const MythNotification &notification)
Queue a notification Queue() is thread-safe and can be called from anywhere.
Definition: mythnotificationcenter.cpp:1351
MythUIMenuCallbacks
Definition: mythuihelper.h:15
GUIStartup::m_Exit
bool m_Exit
Definition: guistartup.h:54
Configuration::SetBoolValue
virtual void SetBoolValue(const QString &sSetting, bool value)=0