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