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 #if QT_VERSION < QT_VERSION_CHECK(5,10,0)
61 #define qEnvironmentVariable getenv
62 #endif
63 
64 MythContext *gContext = nullptr;
65 
66 static const QString sLocation = "MythContext";
67 
68 class MythContextPrivate : public QObject
69 {
70  friend class MythContextSlotHandler;
71 
72  public:
73  explicit MythContextPrivate(MythContext *lparent);
74  ~MythContextPrivate() override;
75 
76  bool Init (bool gui,
77  bool prompt, bool noPrompt,
78  bool ignoreDB);
79  bool FindDatabase(bool prompt, bool noAutodetect);
80 
81  void TempMainWindow(bool languagePrompt = true);
82  void EndTempWindow(void);
83 
84  bool LoadDatabaseSettings(void);
85  bool SaveDatabaseParams(const DatabaseParams &params, bool force);
86 
87  bool PromptForDatabaseParams(const QString &error);
88  QString TestDBconnection(bool prompt=true);
89  void SilenceDBerrors(void);
90  void EnableDBerrors(void);
91  void ResetDatabase(void) const;
92 
93  int ChooseBackend(const QString &error);
94  int UPnPautoconf(int milliSeconds = 2000);
95  bool DefaultUPnP(QString& Error);
96  bool UPnPconnect(const DeviceLocation *backend, const QString &PIN);
97  void ShowGuiStartup(void);
98  bool checkPort(QString &host, int port, int timeLimit) const;
99  static void processEvents(void);
100  bool saveSettingsCache(void);
101  void loadSettingsCacheOverride(void) const;
102  static void clearSettingsCacheOverride(void);
103 
104 
105  protected:
106  bool event(QEvent* /*e*/) override; // QObject
107 
108  void ShowConnectionFailurePopup(bool persistent);
109  void HideConnectionFailurePopup(void);
110 
111  void ShowVersionMismatchPopup(uint remote_version);
112 
113  public slots:
114  void OnCloseDialog();
115 
116  public:
117  MythContext *m_parent {nullptr};
118 
120  bool m_gui {false};
121 
123 
125  QString m_dbHostCp;
126 
128 
129  bool m_disableeventpopup {false};
130 
131  MythUIHelper *m_ui {nullptr};
134  QEventLoop *m_loop {nullptr};
135  bool m_needsBackend {false};
136  bool m_settingsCacheDirty {false};
137 
138  private:
140  int m_registration {-1};
141  QDateTime m_lastCheck;
142  QTcpSocket *m_socket {nullptr};
143  static const std::vector<QString> kSettingsToSave;
144 };
145 
146 static void exec_program_cb(const QString &cmd)
147 {
148  myth_system(cmd);
149 }
150 
151 static void exec_program_tv_cb(const QString &cmd)
152 {
153  QString s = cmd;
154  QStringList tokens = cmd.simplified().split(" ");
155  QStringList strlist;
156 
157  bool cardidok = false;
158  int wantcardid = tokens[0].toInt(&cardidok, 10);
159 
160  if (cardidok && wantcardid > 0)
161  {
162  strlist << QString("LOCK_TUNER %1").arg(wantcardid);
163  s = s.replace(0, tokens[0].length() + 1, "");
164  }
165  else
166  strlist << "LOCK_TUNER";
167 
169  int cardid = strlist[0].toInt();
170 
171  if (cardid >= 0)
172  {
173  s = s.arg(qPrintable(strlist[1]))
174  .arg(qPrintable(strlist[2]))
175  .arg(qPrintable(strlist[3]));
176 
177  myth_system(s);
178 
179  strlist = QStringList(QString("FREE_TUNER %1").arg(cardid));
181  }
182  else
183  {
184  QString label;
185 
186  if (cardidok)
187  {
188  if (cardid == -1)
189  {
190  label = QObject::tr("Could not find specified tuner (%1).")
191  .arg(wantcardid);
192  }
193  else
194  {
195  label = QObject::tr("Specified tuner (%1) is already in use.")
196  .arg(wantcardid);
197  }
198  }
199  else
200  {
201  label = QObject::tr("All tuners are currently in use. If you want "
202  "to watch TV, you can cancel one of the "
203  "in-progress recordings from the delete menu");
204  }
205 
206  LOG(VB_GENERAL, LOG_ALERT, QString("exec_program_tv: ") + label);
207 
208  ShowOkPopup(label);
209  }
210 }
211 
212 static void configplugin_cb(const QString &cmd)
213 {
215  if (!pmanager)
216  return;
217 
218  if (GetNotificationCenter() && pmanager->config_plugin(cmd.trimmed()))
219  {
221  QObject::tr("Failed to configure plugin"));
222  }
223 }
224 
225 static void plugin_cb(const QString &cmd)
226 {
228  if (!pmanager)
229  return;
230 
231  if (GetNotificationCenter() && pmanager->run_plugin(cmd.trimmed()))
232  {
233  ShowNotificationError(QObject::tr("Plugin failure"),
234  sLocation,
235  QObject::tr("%1 failed to run for some reason").arg(cmd));
236  }
237 }
238 
239 static void eject_cb(void)
240 {
242 }
243 
245  : m_parent(lparent),
246  m_sh(new MythContextSlotHandler(this))
247 {
248  m_loop = new QEventLoop(this);
250 }
251 
253 {
254  delete m_pConfig;
256  {
258  }
259 
260  delete m_loop;
261 
262  if (m_ui)
263  DestroyMythUI();
264  if (m_sh)
265  m_sh->deleteLater();
266 }
267 
278 void MythContextPrivate::TempMainWindow(bool languagePrompt)
279 {
280  if (HasMythMainWindow())
281  return;
282 
283  SilenceDBerrors();
284 
285 #ifdef Q_OS_MAC
286  // Qt 4.4 has window-focus problems
287  gCoreContext->OverrideSettingForSession("RunFrontendInWindow", "1");
288 #endif
289  GetMythUI()->Init();
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)
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.isEmpty())
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 
578 
580  if (hostname.isEmpty() ||
581  hostname == "my-unique-identifier-goes-here")
582  {
583  QString localhostname = QHostInfo::localHostName();
584  if (localhostname.isEmpty())
585  {
586  LOG(VB_GENERAL, LOG_ALERT,
587  "MCP: Error, could not determine host name." + ENO);
588  }
589 #ifdef Q_OS_ANDROID
590 #define ANDROID_EXCEPTION_CHECK \
591  if (env->ExceptionCheck()) { \
592  env->ExceptionClear(); \
593  exception=true; \
594  }
595 
596  if ((localhostname == "localhost") || localhostname.isEmpty())
597  {
598  hostname = "android";
599  bool exception=false;
600  QAndroidJniEnvironment env;
601  QAndroidJniObject myID = QAndroidJniObject::fromString("android_id");
602  QAndroidJniObject activity = QtAndroid::androidActivity();
604  QAndroidJniObject appctx = activity.callObjectMethod
605  ("getApplicationContext","()Landroid/content/Context;");
607  QAndroidJniObject contentR = appctx.callObjectMethod
608  ("getContentResolver", "()Landroid/content/ContentResolver;");
610  QAndroidJniObject androidId = QAndroidJniObject::callStaticObjectMethod
611  ("android/provider/Settings$Secure","getString",
612  "(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;",
613  contentR.object<jobject>(),
614  myID.object<jstring>());
616  if (exception)
617  LOG(VB_GENERAL, LOG_ALERT,
618  "Java exception looking for android id");
619  else
620  hostname = QString("android-%1").arg(androidId.toString());
621  }
622  else
623  hostname = localhostname;
624 #else
625  hostname = localhostname;
626 #endif
627  LOG(VB_GENERAL, LOG_INFO, "Empty LocalHostName. This is typical.");
628  }
629  else
630  {
631  m_dbParams.m_localEnabled = true;
632  }
633 
634  LOG(VB_GENERAL, LOG_INFO, QString("Using a profile name of: '%1' (Usually the "
635  "same as this host's name.)")
636  .arg(hostname));
638 
639  return ok;
640 }
641 
643  const DatabaseParams &params, bool force)
644 {
645  bool ret = true;
646 
647  // only rewrite file if it has changed
648  if (params != m_dbParams || force)
649  {
651  "LocalHostName", params.m_localHostName);
652 
654  kDefaultDB + "PingHost", params.m_dbHostPing);
655 
656  // If dbHostName is an IPV6 address with scope,
657  // remove the scope. Unescaped % signs are an
658  // xml violation
659  QString dbHostName(params.m_dbHostName);
660  QHostAddress addr;
661  if (addr.setAddress(dbHostName))
662  {
663  addr.setScopeId(QString());
664  dbHostName = addr.toString();
665  }
667  kDefaultDB + "Host", dbHostName);
669  kDefaultDB + "UserName", params.m_dbUserName);
671  kDefaultDB + "Password", params.m_dbPassword);
673  kDefaultDB + "DatabaseName", params.m_dbName);
675  kDefaultDB + "Port", params.m_dbPort);
676 
678  kDefaultWOL + "Enabled", params.m_wolEnabled);
680  kDefaultWOL + "SQLReconnectWaitTime", params.m_wolReconnect);
682  kDefaultWOL + "SQLConnectRetry", params.m_wolRetry);
684  kDefaultWOL + "Command", params.m_wolCommand);
685 
686  // clear out any legacy nodes..
687  m_pConfig->ClearValue(kDefaultMFE + "DBHostName");
688  m_pConfig->ClearValue(kDefaultMFE + "DBUserName");
689  m_pConfig->ClearValue(kDefaultMFE + "DBPassword");
690  m_pConfig->ClearValue(kDefaultMFE + "DBName");
691  m_pConfig->ClearValue(kDefaultMFE + "DBPort");
692  m_pConfig->ClearValue(kDefaultMFE + "DBHostPing");
693 
694  // actually save the file
695  m_pConfig->Save();
696 
697  // Save the new settings:
698  m_dbParams = params;
700 
701  // If database has changed, force its use:
702  ResetDatabase();
703  }
704  return ret;
705 }
706 
708 {
709  if (d && d->m_loop
710  && d->m_loop->isRunning())
711  d->m_loop->exit();
712 }
713 
714 
716 {
717  bool accepted = false;
718  if (m_gui)
719  {
720  TempMainWindow();
721 
722  // Tell the user what went wrong:
723  if (!error.isEmpty())
725 
726  // ask user for database parameters
727 
728  EnableDBerrors();
730  auto *dbsetting = new DatabaseSettings();
731  auto *ssd = new StandardSettingDialog(mainStack, "databasesettings",
732  dbsetting);
733  if (ssd->Create())
734  {
735  mainStack->AddScreen(ssd);
736  connect(dbsetting, &DatabaseSettings::isClosing,
738  if (!m_loop->isRunning())
739  m_loop->exec();
740  }
741  else
742  delete ssd;
743  SilenceDBerrors();
744  EndTempWindow();
745  accepted = true;
746  }
747  else
748  {
750  QString response;
751  std::this_thread::sleep_for(std::chrono::seconds(1));
752  // give user chance to skip config
753  std::cout << std::endl << error.toLocal8Bit().constData() << std::endl << std::endl;
754  response = getResponse("Would you like to configure the database "
755  "connection now?",
756  "no");
757  if (!response.startsWith('y', Qt::CaseInsensitive))
758  return false;
759 
760  params.m_dbHostName = getResponse("Database host name:",
761  params.m_dbHostName);
762  response = getResponse("Should I test connectivity to this host "
763  "using the ping command?", "yes");
764  params.m_dbHostPing = response.startsWith('y', Qt::CaseInsensitive);
765 
766  params.m_dbPort = intResponse("Database non-default port:",
767  params.m_dbPort);
768  params.m_dbName = getResponse("Database name:",
769  params.m_dbName);
770  params.m_dbUserName = getResponse("Database user name:",
771  params.m_dbUserName);
772  params.m_dbPassword = getResponse("Database password:",
773  params.m_dbPassword);
774 
775  params.m_localHostName = getResponse("Unique identifier for this machine "
776  "(if empty, the local host name "
777  "will be used):",
778  params.m_localHostName);
779  params.m_localEnabled = !params.m_localHostName.isEmpty();
780 
781  response = getResponse("Would you like to use Wake-On-LAN to retry "
782  "database connections?",
783  (params.m_wolEnabled ? "yes" : "no"));
784  params.m_wolEnabled = response.startsWith('y', Qt::CaseInsensitive);
785 
786  if (params.m_wolEnabled)
787  {
788  params.m_wolReconnect = intResponse("Seconds to wait for "
789  "reconnection:",
790  params.m_wolReconnect);
791  params.m_wolRetry = intResponse("Number of times to retry:",
792  params.m_wolRetry);
793  params.m_wolCommand = getResponse("Command to use to wake server or server MAC address:",
794  params.m_wolCommand);
795  }
796 
797  accepted = m_parent->SaveDatabaseParams(params);
798  }
799  return accepted;
800 }
801 
808 {
809  QString err;
810  QString host;
811 
812  // Jan 20, 2017
813  // Changed to use port check instead of ping
814 
815  int port = 0;
816 
817  // 1 = db awake, 2 = db listening, 3 = db connects,
818  // 4 = backend awake, 5 = backend listening
819  // 9 = all ok, 10 = quit
820 
821  enum startupStates {
822  st_start = 0,
823  st_dbAwake = 1,
824  st_dbStarted = 2,
825  st_dbConnects = 3,
826  st_beWOL = 4,
827  st_beAwake = 5,
828  st_success = 6
829  } startupState = st_start;
830 
831  static const std::array<const QString,7> kGuiStatuses
832  {"start","dbAwake","dbStarted","dbConnects","beWOL","beAwake",
833  "success" };
834 
835  int msStartupScreenDelay = gCoreContext->GetNumSetting("StartupScreenDelay",2);
836  if (msStartupScreenDelay > 0)
837  msStartupScreenDelay *= 1000;
838  do
839  {
840  QElapsedTimer timer;
841  timer.start();
842  if (m_dbParams.m_dbHostName.isNull() && !m_dbHostCp.isEmpty())
843  host = m_dbHostCp;
844  else
845  host = m_dbParams.m_dbHostName;
846  port = m_dbParams.m_dbPort;
847  if (port == 0)
848  port = 3306;
849  int wakeupTime = 3;
850  int attempts = 11;
851  if (m_dbParams.m_wolEnabled) {
852  wakeupTime = m_dbParams.m_wolReconnect;
853  attempts = m_dbParams.m_wolRetry + 1;
854  startupState = st_start;
855  }
856  else
857  startupState = st_dbAwake;
858  if (attempts < 6)
859  attempts = 6;
860  if (!prompt)
861  attempts=1;
862  if (wakeupTime < 5)
863  wakeupTime = 5;
864 
865  int progressTotal = wakeupTime * attempts;
866 
868  m_guiStartup->setTotal(progressTotal);
869 
870  QString beWOLCmd = QString();
871  QString backendIP = QString();
872  int backendPort = 0;
873  QString masterserver;
874 
875  for (int attempt = 0;
876  attempt < attempts && startupState != st_success;
877  ++attempt)
878  {
879  // The first time do everything with minimum timeout and
880  // no GUI, for the normal case where all is OK
881  // After that show the GUI (if this is a GUI program)
882 
883  LOG(VB_GENERAL, LOG_INFO,
884  QString("Start up testing connections. DB %1, BE %2, attempt %3, status %4, Delay: %5")
885  .arg(host).arg(backendIP).arg(attempt).arg(kGuiStatuses[startupState]).arg(msStartupScreenDelay) );
886 
887  int useTimeout = wakeupTime;
888  if (attempt == 0)
889  useTimeout=1;
890 
891  if (m_gui && !m_guiStartup)
892  {
893  if (msStartupScreenDelay==0 || timer.hasExpired(msStartupScreenDelay))
894  {
895  ShowGuiStartup();
896  if (m_guiStartup)
897  m_guiStartup->setTotal(progressTotal);
898  }
899  }
901  {
902  if (attempt > 0)
903  m_guiStartup->setStatusState(kGuiStatuses[startupState]);
904  m_guiStartup->setMessageState("empty");
905  processEvents();
906  }
907  switch (startupState) {
908  case st_start:
910  {
911  if (attempt > 0)
913  if (!checkPort(host, port, useTimeout))
914  break;
915  }
916  startupState = st_dbAwake;
917  [[clang::fallthrough]];
918  case st_dbAwake:
919  if (!checkPort(host, port, useTimeout))
920  break;
921  startupState = st_dbStarted;
922  [[clang::fallthrough]];
923  case st_dbStarted:
924  // If the database is connecting with link-local
925  // address, it may have changed
926  if (m_dbParams.m_dbHostName != host)
927  {
928  m_dbParams.m_dbHostName = host;
930  }
931  EnableDBerrors();
932  ResetDatabase();
934  {
935  for (int temp = 0; temp < useTimeout * 2 ; temp++)
936  {
937  processEvents();
938  std::this_thread::sleep_for(std::chrono::milliseconds(500));
939  }
940  break;
941  }
942  startupState = st_dbConnects;
943  [[clang::fallthrough]];
944  case st_dbConnects:
945  if (m_needsBackend)
946  {
947  beWOLCmd = gCoreContext->GetSetting("WOLbackendCommand", "");
948  if (!beWOLCmd.isEmpty())
949  {
950  wakeupTime += gCoreContext->GetNumSetting
951  ("WOLbackendReconnectWaitTime", 0);
952  attempts += gCoreContext->GetNumSetting
953  ("WOLbackendConnectRetry", 0);
954  useTimeout = wakeupTime;
955  if (m_gui && !m_guiStartup && attempt == 0)
956  useTimeout=1;
957  progressTotal = wakeupTime * attempts;
959  m_guiStartup->setTotal(progressTotal);
960  startupState = st_beWOL;
961  }
962  }
963  else {
964  startupState = st_success;
965  break;
966  }
967  masterserver = gCoreContext->GetSetting
968  ("MasterServerName");
969  backendIP = gCoreContext->GetSettingOnHost
970  ("BackendServerAddr", masterserver);
971  backendPort = MythCoreContext::GetMasterServerPort();
972  [[clang::fallthrough]];
973  case st_beWOL:
974  if (!beWOLCmd.isEmpty()) {
975  if (attempt > 0)
976  MythWakeup(beWOLCmd);
977  if (!checkPort(backendIP, backendPort, useTimeout))
978  break;
979  }
980  startupState = st_beAwake;
981  [[clang::fallthrough]];
982  case st_beAwake:
983  if (!checkPort(backendIP, backendPort, useTimeout))
984  break;
985  startupState = st_success;
986  [[clang::fallthrough]];
987  case st_success:
988  // Quiet compiler warning.
989  break;
990  }
991  if (m_guiStartup)
992  {
993  if (m_guiStartup->m_Exit
996  || m_guiStartup->m_Retry)
997  break;
998  }
999  processEvents();
1000  }
1001  if (startupState == st_success)
1002  break;
1003 
1004  QString stateMsg = kGuiStatuses[startupState];
1005  stateMsg.append("Fail");
1006  LOG(VB_GENERAL, LOG_INFO,
1007  QString("Start up failure. host %1, status %2")
1008  .arg(host).arg(stateMsg));
1009 
1010  if (m_gui && !m_guiStartup)
1011  {
1012  ShowGuiStartup();
1013  if (m_guiStartup)
1014  m_guiStartup->setTotal(progressTotal);
1015  }
1016 
1017  if (m_guiStartup
1018  && !m_guiStartup->m_Exit
1019  && !m_guiStartup->m_Setup
1020  && !m_guiStartup->m_Search
1021  && !m_guiStartup->m_Retry)
1022  {
1024  m_guiStartup->setStatusState(stateMsg);
1025  m_guiStartup->setMessageState("makeselection");
1026  m_loop->exec();
1027  }
1028  }
1029  while (m_guiStartup && m_guiStartup->m_Retry);
1030 
1031  if (startupState < st_dbAwake)
1032  {
1033  LOG(VB_GENERAL, LOG_WARNING, QString("Pinging to %1 failed, database will be unavailable").arg(host));
1034  SilenceDBerrors();
1035  err = QObject::tr(
1036  "Cannot find (ping) database host %1 on the network",
1037  "Backend Setup");
1038  return err.arg(host);
1039  }
1040 
1041  if (startupState < st_dbConnects)
1042  {
1043  SilenceDBerrors();
1044  return QObject::tr("Cannot login to database", "Backend Setup");
1045  }
1046 
1047  if (startupState < st_success)
1048  {
1049  return QObject::tr("Cannot connect to backend", "Backend Setup");
1050  }
1051 
1052  // Current DB connection may have been silenced (invalid):
1053  EnableDBerrors();
1054  ResetDatabase();
1055 
1056  return QString();
1057 }
1058 
1059 // Show the Gui Startup window.
1060 // This is called if there is a delay in startup for any reason
1061 // such as the database being unavailable
1063 {
1064  if (!m_gui)
1065  return;
1066  TempMainWindow(false);
1067  MythMainWindow *mainWindow = GetMythMainWindow();
1068  MythScreenStack *mainStack = mainWindow->GetMainStack();
1069  if (mainStack) {
1070  if (!m_guiStartup) {
1071  m_guiStartup = new GUIStartup(mainStack,m_loop);
1072  if (!m_guiStartup->Create()) {
1073  delete m_guiStartup;
1074  m_guiStartup = nullptr;
1075  }
1076  if (m_guiStartup) {
1077  mainStack->AddScreen(m_guiStartup, false);
1078  processEvents();
1079  }
1080  }
1081  }
1082 }
1083 
1093 {
1094  // This silences any DB errors from Get*Setting(),
1095  // (which is the vast majority of them)
1097 
1098  // Save the configured hostname, so that we can
1099  // still display it in the DatabaseSettings screens
1100  if (!m_dbParams.m_dbHostName.isEmpty())
1102 
1103  m_dbParams.m_dbHostName.clear();
1105 }
1106 
1108 {
1109  // Restore (possibly) blanked hostname
1110  if (m_dbParams.m_dbHostName.isNull() && !m_dbHostCp.isEmpty())
1111  {
1114  }
1115 
1117 }
1118 
1119 
1132 {
1136 }
1137 
1142 {
1143  TempMainWindow();
1144 
1145  // Tell the user what went wrong:
1146  if (!error.isEmpty())
1147  {
1148  LOG(VB_GENERAL, LOG_ERR, QString("Error: %1").arg(error));
1149  ShowOkPopup(error);
1150  }
1151 
1152  LOG(VB_GENERAL, LOG_INFO, "Putting up the UPnP backend chooser");
1153 
1156 
1157  EndTempWindow();
1158 
1159  return (int)ret;
1160 }
1161 
1168 int MythContextPrivate::UPnPautoconf(const int milliSeconds)
1169 {
1170  LOG(VB_GENERAL, LOG_INFO, QString("UPNP Search %1 secs")
1171  .arg(milliSeconds / 1000));
1172 
1173  SSDP::Instance()->PerformSearch(kBackendURI, milliSeconds / 1000);
1174 
1175  // Search for a total of 'milliSeconds' ms, sending new search packet
1176  // about every 250 ms until less than one second remains.
1177  MythTimer totalTime; totalTime.start();
1178  MythTimer searchTime; searchTime.start();
1179  while (totalTime.elapsed() < milliSeconds)
1180  {
1181  usleep(25000);
1182  int ttl = milliSeconds - totalTime.elapsed();
1183  if ((searchTime.elapsed() > 249) && (ttl > 1000))
1184  {
1185  LOG(VB_GENERAL, LOG_INFO, QString("UPNP Search %1 secs")
1186  .arg(ttl / 1000));
1187  SSDP::Instance()->PerformSearch(kBackendURI, ttl / 1000);
1188  searchTime.start();
1189  }
1190  }
1191 
1193 
1194  if (!backends)
1195  {
1196  LOG(VB_GENERAL, LOG_INFO, "No UPnP backends found");
1197  return 0;
1198  }
1199 
1200  int count = backends->Count();
1201  if (count)
1202  {
1203  LOG(VB_GENERAL, LOG_INFO,
1204  QString("Found %1 UPnP backends").arg(count));
1205  }
1206  else
1207  {
1208  LOG(VB_GENERAL, LOG_ERR,
1209  "No UPnP backends found, but SSDP::Find() not NULL");
1210  }
1211 
1212  if (count != 1)
1213  {
1214  backends->DecrRef();
1215  return count;
1216  }
1217 
1218  // Get this backend's location:
1219  DeviceLocation *BE = backends->GetFirst();
1220  backends->DecrRef();
1221  backends = nullptr;
1222 
1223  // We don't actually know the backend's access PIN, so this will
1224  // only work for ones that have PIN access disabled (i.e. 0000)
1225  int ret = (UPnPconnect(BE, QString())) ? 1 : -1;
1226 
1227  BE->DecrRef();
1228 
1229  return ret;
1230 }
1231 
1238 {
1239  static const QString loc = "DefaultUPnP() - ";
1240  QString pin = m_pConfig->GetValue(kDefaultPIN, "");
1241  QString usn = m_pConfig->GetValue(kDefaultUSN, "");
1242 
1243  if (usn.isEmpty())
1244  {
1245  LOG(VB_UPNP, LOG_INFO, loc + "No default UPnP backend");
1246  return false;
1247  }
1248 
1249  LOG(VB_UPNP, LOG_INFO, loc + QString("config.xml has default PIN '%1' and host USN: %2")
1250  .arg(pin).arg(usn));
1251 
1252  // ----------------------------------------------------------------------
1253 
1254  int timeout_ms = 2000;
1255  LOG(VB_GENERAL, LOG_INFO, loc + QString("UPNP Search up to %1 secs").arg(timeout_ms / 1000));
1256  SSDP::Instance()->PerformSearch(kBackendURI, static_cast<uint>(timeout_ms / 1000));
1257 
1258  // ----------------------------------------------------------------------
1259  // We need to give the server time to respond...
1260  // ----------------------------------------------------------------------
1261 
1262  DeviceLocation* devicelocation = nullptr;
1263  MythTimer totalTime;
1264  MythTimer searchTime;
1265  totalTime.start();
1266  searchTime.start();
1267  while (totalTime.elapsed() < timeout_ms)
1268  {
1269  devicelocation = SSDP::Find(kBackendURI, usn);
1270  if (devicelocation)
1271  break;
1272 
1273  usleep(25000);
1274 
1275  int ttl = timeout_ms - totalTime.elapsed();
1276  if ((searchTime.elapsed() > 249) && (ttl > 1000))
1277  {
1278  LOG(VB_GENERAL, LOG_INFO, loc + QString("UPNP Search up to %1 secs").arg(ttl / 1000));
1279  SSDP::Instance()->PerformSearch(kBackendURI, static_cast<uint>(ttl / 1000));
1280  searchTime.start();
1281  }
1282  }
1283 
1284  // ----------------------------------------------------------------------
1285 
1286  if (!devicelocation)
1287  {
1288  Error = "Cannot find default UPnP backend";
1289  return false;
1290  }
1291 
1292  if (UPnPconnect(devicelocation, pin))
1293  {
1294  devicelocation->DecrRef();
1295  return true;
1296  }
1297 
1298  devicelocation->DecrRef();
1299  Error = "Cannot connect to default backend via UPnP. Wrong saved PIN?";
1300  return false;
1301 }
1302 
1307  const QString &PIN)
1308 {
1309  QString error;
1310  QString loc = "UPnPconnect() - ";
1311  QString URL = backend->m_sLocation;
1312  MythXMLClient client(URL);
1313 
1314  LOG(VB_UPNP, LOG_INFO, loc + QString("Trying host at %1").arg(URL));
1315  switch (client.GetConnectionInfo(PIN, &m_dbParams, error))
1316  {
1317  case UPnPResult_Success:
1319  LOG(VB_UPNP, LOG_INFO, loc +
1320  "Got database hostname: " + m_dbParams.m_dbHostName);
1321  return true;
1322 
1324  // The stored PIN is probably not correct.
1325  // We could prompt for the PIN and try again, but that needs a UI.
1326  // Easier to fail for now, and put up the full UI selector later
1327  LOG(VB_UPNP, LOG_ERR, loc + "Wrong PIN?");
1328  return false;
1329 
1330  default:
1331  LOG(VB_UPNP, LOG_ERR, loc + error);
1332  break;
1333  }
1334 
1335  // This backend may have a local DB with the default user/pass/DBname.
1336  // For whatever reason, we have failed to get anything back via UPnP,
1337  // so we might as well try the database directly as a last resort.
1338  QUrl theURL(URL);
1339  URL = theURL.host();
1340  if (URL.isEmpty())
1341  return false;
1342 
1343  LOG(VB_UPNP, LOG_INFO, "Trying default DB credentials at " + URL);
1344  m_dbParams.m_dbHostName = URL;
1345 
1346  return true;
1347 }
1348 
1350 {
1351  if (e->type() == MythEvent::MythEventMessage)
1352  {
1353  if (m_disableeventpopup)
1354  return true;
1355 
1357  {
1359  }
1360 
1361  auto *me = dynamic_cast<MythEvent*>(e);
1362  if (me == nullptr)
1363  return true;
1364 
1365  if (me->Message() == "VERSION_MISMATCH" && (1 == me->ExtraDataCount()))
1366  ShowVersionMismatchPopup(me->ExtraData(0).toUInt());
1367  else if (me->Message() == "CONNECTION_FAILURE")
1369  else if (me->Message() == "PERSISTENT_CONNECTION_FAILURE")
1371  else if (me->Message() == "CONNECTION_RESTABLISHED")
1373  return true;
1374  }
1375 
1376  return QObject::event(e);
1377 }
1378 
1380 {
1381  QDateTime now = MythDate::current();
1382 
1383  if (!GetNotificationCenter() || !m_ui || !m_ui->IsScreenSetup())
1384  return;
1385 
1386  if (m_lastCheck.isValid() && now < m_lastCheck)
1387  return;
1388 
1389  // When WOL is disallowed, standy mode,
1390  // we should not show connection failures.
1391  if (!gCoreContext->IsWOLAllowed())
1392  return;
1393 
1394  m_lastCheck = now.addMSecs(5000); // don't refresh notification more than every 5s
1395 
1396  QString description = (persistent) ?
1397  QObject::tr(
1398  "The connection to the master backend "
1399  "server has gone away for some reason. "
1400  "Is it running?") :
1401  QObject::tr(
1402  "Could not connect to the master backend server. Is "
1403  "it running? Is the IP address set for it in "
1404  "mythtv-setup correct?");
1405 
1406  QString message = QObject::tr("Could not connect to master backend");
1407  MythErrorNotification n(message, sLocation, description);
1408  n.SetId(m_registration);
1409  n.SetParent(this);
1411 }
1412 
1414 {
1415  if (!GetNotificationCenter())
1416  return;
1417 
1418  if (!m_lastCheck.isValid())
1419  return;
1420 
1421  MythCheckNotification n(QObject::tr("Backend is online"), sLocation);
1422  n.SetId(m_registration);
1423  n.SetParent(this);
1424  n.SetDuration(5);
1426  m_lastCheck = QDateTime();
1427 }
1428 
1430 {
1431  if (m_mbeVersionPopup)
1432  return;
1433 
1434  QString message =
1435  QObject::tr(
1436  "The server uses network protocol version %1, "
1437  "but this client only understands version %2. "
1438  "Make sure you are running compatible versions of "
1439  "the backend and frontend.")
1440  .arg(remote_version).arg(MYTH_PROTO_VERSION);
1441 
1442  if (HasMythMainWindow() && m_ui && m_ui->IsScreenSetup())
1443  {
1446  }
1447  else
1448  {
1449  LOG(VB_GENERAL, LOG_ERR, LOC + message);
1450  qApp->exit(GENERIC_EXIT_SOCKET_ERROR);
1451  }
1452 }
1453 
1454 // Process Events while waiting for connection
1455 // return true if progress is 100%
1457 {
1458 // bool ret = false;
1459 // if (m_guiStartup)
1460 // ret = m_guiStartup->updateProgress();
1461  qApp->processEvents(QEventLoop::AllEvents, 250);
1462  qApp->processEvents(QEventLoop::AllEvents, 250);
1463 // return ret;
1464 }
1465 
1466 // cache some settings in cache/contextcache.xml
1467 // only call this if the database is available.
1468 
1469 const std::vector<QString> MythContextPrivate::kSettingsToSave
1470 { "Theme", "Language", "Country", "GuiHeight",
1471  "GuiOffsetX", "GuiOffsetY", "GuiWidth", "RunFrontendInWindow",
1472  "AlwaysOnTop", "HideMouseCursor", "ThemePainter", "libCECEnabled",
1473  "StartupScreenDelay" };
1474 
1475 
1477 {
1478  if (!m_gui)
1479  return true;
1480  QString cacheDirName = GetConfDir() + "/cache/";
1481  QDir dir(cacheDirName);
1482  dir.mkpath(cacheDirName);
1483  XmlConfiguration config = XmlConfiguration("cache/contextcache.xml");
1484  for (const auto & setting : kSettingsToSave)
1485  {
1486  QString cacheValue = config.GetValue("Settings/"+setting,QString());
1488  QString value = gCoreContext->GetSetting(setting,QString());
1489  if (value != cacheValue)
1490  {
1491  config.SetValue("Settings/"+setting,value);
1492  m_settingsCacheDirty = true;
1493  }
1494  }
1496  return config.Save();
1497 }
1498 
1500 {
1501  if (!m_gui)
1502  return;
1503  XmlConfiguration config = XmlConfiguration("cache/contextcache.xml");
1504  for (const auto & setting : kSettingsToSave)
1505  {
1506  if (!gCoreContext->GetSetting(setting,QString()).isEmpty())
1507  continue;
1508  QString value = config.GetValue("Settings/"+setting,QString());
1509  if (!value.isEmpty())
1510  gCoreContext->OverrideSettingForSession(setting, value);
1511  }
1512  // Prevent power off TV after temporary window
1513  gCoreContext->OverrideSettingForSession("PowerOffTVAllowed", nullptr);
1514 
1515  MythTranslation::load("mythfrontend");
1516 }
1517 
1519 {
1520  QString language = gCoreContext->GetSetting("Language",QString());
1521  for (const auto & setting : kSettingsToSave)
1523  // Restore power off TV setting
1524  gCoreContext->ClearOverrideSettingForSession("PowerOffTVAllowed");
1525 
1526  if (language != gCoreContext->GetSetting("Language",QString()))
1527  MythTranslation::load("mythfrontend");
1528 }
1529 
1530 
1532 {
1533  d->m_mbeVersionPopup = nullptr;
1534  qApp->exit(GENERIC_EXIT_SOCKET_ERROR);
1535 }
1536 
1537 MythContext::MythContext(QString binversion, bool needsBackend)
1538  : m_appBinaryVersion(std::move(binversion))
1539 {
1540 #ifdef _WIN32
1541  static bool WSAStarted = false;
1542  if (!WSAStarted) {
1543  WSADATA wsadata;
1544  int res = WSAStartup(MAKEWORD(2, 0), &wsadata);
1545  LOG(VB_SOCKET, LOG_INFO,
1546  QString("WSAStartup returned %1").arg(res));
1547  }
1548 #endif
1549 
1550  d = new MythContextPrivate(this);
1551  d->m_needsBackend = needsBackend;
1552 
1554 
1555  if (!gCoreContext || !gCoreContext->Init())
1556  {
1557  LOG(VB_GENERAL, LOG_EMERG, LOC + "Unable to allocate MythCoreContext");
1558  qApp->exit(GENERIC_EXIT_NO_MYTHCONTEXT);
1559  }
1560 }
1561 
1562 bool MythContext::Init(const bool gui,
1563  const bool promptForBackend,
1564  const bool disableAutoDiscovery,
1565  const bool ignoreDB)
1566 {
1567  if (!d)
1568  {
1569  LOG(VB_GENERAL, LOG_EMERG, LOC + "Init() Out-of-memory");
1570  return false;
1571  }
1572 
1573  SetDisableEventPopup(true);
1574 
1576  {
1577  LOG(VB_GENERAL, LOG_EMERG,
1578  QString("Application binary version (%1) does not "
1579  "match libraries (%2)")
1581 
1582  QString warning = QObject::tr(
1583  "This application is not compatible "
1584  "with the installed MythTV libraries.");
1585  if (gui)
1586  {
1587  d->TempMainWindow(false);
1588  ShowOkPopup(warning);
1589  }
1590  LOG(VB_GENERAL, LOG_WARNING, warning);
1591 
1592  return false;
1593  }
1594 
1595 #ifdef _WIN32
1596  // HOME environment variable might not be defined
1597  // some libraries will fail without it
1598  QString home = getenv("HOME");
1599  if (home.isEmpty())
1600  {
1601  home = getenv("LOCALAPPDATA"); // Vista
1602  if (home.isEmpty())
1603  home = getenv("APPDATA"); // XP
1604  if (home.isEmpty())
1605  home = QString("."); // getenv("TEMP")?
1606 
1607  _putenv(QString("HOME=%1").arg(home).toLocal8Bit().constData());
1608  }
1609 #endif
1610 
1611  // If HOME isn't defined, we won't be able to use default confdir of
1612  // $HOME/.mythtv nor can we rely on a MYTHCONFDIR that references $HOME
1613  QString homedir = QDir::homePath();
1614  QString confdir = qEnvironmentVariable("MYTHCONFDIR");
1615  if ((homedir.isEmpty() || homedir == "/") &&
1616  (confdir.isEmpty() || confdir.contains("$HOME")))
1617  {
1618  QString warning = "Cannot locate your home directory."
1619  " Please set the environment variable HOME";
1620  if (gui)
1621  {
1622  d->TempMainWindow(false);
1623  ShowOkPopup(warning);
1624  }
1625  LOG(VB_GENERAL, LOG_WARNING, warning);
1626 
1627  return false;
1628  }
1629 
1630  if (!d->Init(gui, promptForBackend, disableAutoDiscovery, ignoreDB))
1631  {
1632  return false;
1633  }
1634 
1635  SetDisableEventPopup(false);
1637  if (d->m_settingsCacheDirty)
1638  {
1639 #ifndef Q_OS_ANDROID
1641 #endif
1642  d->m_settingsCacheDirty = false;
1643  }
1646 
1647  return true;
1648 }
1649 
1651 {
1652  gCoreContext->InitPower(false /*destroy*/);
1653  if (MThreadPool::globalInstance()->activeThreadCount())
1654  LOG(VB_GENERAL, LOG_INFO, "Waiting for threads to exit.");
1655 
1657  SSDP::Shutdown();
1659 
1660  LOG(VB_GENERAL, LOG_INFO, "Exiting");
1661 
1662  logStop();
1663 
1664  delete gCoreContext;
1665  gCoreContext = nullptr;
1666 
1667  delete d;
1668 }
1669 
1671 {
1672  d->m_disableeventpopup = check;
1673 }
1674 
1676 {
1677  return d->m_dbParams;
1678 }
1679 
1681 {
1682  return d->SaveDatabaseParams(params, false);
1683 }
1684 
1686 {
1687  return d->saveSettingsCache();
1688 }
1689 
1690 /* 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:133
MythContextPrivate::ShowConnectionFailurePopup
void ShowConnectionFailurePopup(bool persistent)
Definition: mythcontext.cpp:1379
MythMainWindow::GetMainStack
MythScreenStack * GetMainStack()
Definition: mythmainwindow.cpp:315
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:1537
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:43
GUIStartup::Create
bool Create(void) override
Definition: guistartup.cpp:72
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:982
MythContextSlotHandler::VersionMismatchPopupClosed
void VersionMismatchPopupClosed(void)
Definition: mythcontext.cpp:1531
MythPluginManager
Definition: mythplugin.h:62
dbutil.h
MythMainWindow::Init
void Init(bool MayReInit=true)
Definition: mythmainwindow.cpp:638
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
MythContextSlotHandler::MythContextPrivate
friend class MythContextPrivate
Definition: mythcontext.h:16
MythContextPrivate::event
bool event(QEvent *) override
Definition: mythcontext.cpp:1349
mythdb.h
MythContextPrivate::UPnPautoconf
int UPnPautoconf(int milliSeconds=2000)
If there is only a single UPnP backend, use it.
Definition: mythcontext.cpp:1168
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:1380
MythContextPrivate::kSettingsToSave
static const std::vector< QString > kSettingsToSave
Definition: mythcontext.cpp:143
MythNotification::SetDuration
void SetDuration(int Duration)
Contains a duration during which the notification will be displayed for. The duration is informative ...
Definition: mythnotification.cpp:136
MythTimer
A QElapsedTimer based timer to replace use of QTime as a timer.
Definition: mythtimer.h:13
MythCheckNotification
Definition: mythnotification.h:205
MythContextPrivate::DefaultUPnP
bool DefaultUPnP(QString &Error)
Get the default backend from config.xml, use UPnP to find it.
Definition: mythcontext.cpp:1237
MythContext::GetDatabaseParams
DatabaseParams GetDatabaseParams(void)
Definition: mythcontext.cpp:1675
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:139
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:886
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:9
dbsettings.h
mythplugin.h
MythCoreContext::InitLocale
void InitLocale(void)
Definition: mythcorecontext.cpp:1831
MythContext
Startup context for MythTV.
Definition: mythcontext.h:43
XmlConfiguration::GetValue
int GetValue(const QString &sSetting, int Default) override
Definition: configuration.cpp:210
MythMainWindow::getMainWindow
static MythMainWindow * getMainWindow(bool UseDB=true)
Return the existing main window, or create one.
Definition: mythmainwindow.cpp:80
MythXMLClient
Definition: mythxmlclient.h:32
MythContextPrivate::saveSettingsCache
bool saveSettingsCache(void)
Definition: mythcontext.cpp:1476
MythCoreContext::OverrideSettingForSession
void OverrideSettingForSession(const QString &key, const QString &value)
Definition: mythcorecontext.cpp:1346
MythEvent
This class is used as a container for messages.
Definition: mythevent.h:16
MythContext::SetDisableEventPopup
void SetDisableEventPopup(bool check)
Definition: mythcontext.cpp:1670
MythContextPrivate::TestDBconnection
QString TestDBconnection(bool prompt=true)
Some quick sanity checks before opening a database connection.
Definition: mythcontext.cpp:807
mythxmlclient.h
kDefaultWOL
const QString kDefaultWOL
Definition: backendselect.h:23
mythdialogbox.h
MythScreenStack
Definition: mythscreenstack.h:15
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:134
MythContextPrivate::m_parent
MythContext * m_parent
Definition: mythcontext.cpp:117
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:252
MythContextPrivate::UPnPconnect
bool UPnPconnect(const DeviceLocation *backend, const QString &PIN)
Query a backend via UPnP for its database connection parameters.
Definition: mythcontext.cpp:1306
DatabaseSettings::isClosing
void isClosing(void)
MythContextPrivate::ShowVersionMismatchPopup
void ShowVersionMismatchPopup(uint remote_version)
Definition: mythcontext.cpp:1429
mythdirs.h
MythContextPrivate::ShowGuiStartup
void ShowGuiStartup(void)
Definition: mythcontext.cpp:1062
DeviceLocation
Definition: upnpdevice.h:207
MythContextPrivate::m_disableeventpopup
bool m_disableeventpopup
Definition: mythcontext.cpp:129
HasMythMainWindow
bool HasMythMainWindow(void)
Definition: mythmainwindow.cpp:109
MythCoreContext::InitPower
void InitPower(bool Create=true)
Definition: mythcorecontext.cpp:1818
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:1107
XmlConfiguration
Definition: configuration.h:51
SSDP::Shutdown
static void Shutdown()
Definition: ssdp.cpp:63
langsettings.h
MythContext::m_appBinaryVersion
QString m_appBinaryVersion
Definition: mythcontext.h:63
InitializeMythDirs
void InitializeMythDirs(void)
Definition: mythdirs.cpp:30
DatabaseSettings
Definition: dbsettings.h:10
exec_program_tv_cb
static void exec_program_tv_cb(const QString &cmd)
Definition: mythcontext.cpp:151
mythversion.h
mythsystemlegacy.h
eject_cb
static void eject_cb(void)
Definition: mythcontext.cpp:239
MythCoreContext::ClearOverrideSettingForSession
void ClearOverrideSettingForSession(const QString &key)
Definition: mythcorecontext.cpp:1352
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:62
DatabaseParams::m_wolReconnect
int m_wolReconnect
seconds to wait for reconnect
Definition: mythdbparams.h:34
StandardSettingDialog
Definition: standardsettings.h:468
MythWakeup
bool MythWakeup(const QString &wakeUpCommand, uint flags, uint timeout)
Definition: mythmiscutil.cpp:676
DatabaseParams::m_dbPort
int m_dbPort
database port
Definition: mythdbparams.h:23
kDefaultDB
const QString kDefaultDB
Definition: backendselect.h:22
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:136
MythContextPrivate::OnCloseDialog
void OnCloseDialog()
MythCoreContext::Init
bool Init(void)
Definition: mythcorecontext.cpp:240
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:301
configplugin_cb
static void configplugin_cb(const QString &cmd)
Definition: mythcontext.cpp:212
MThreadPool::waitForDone
void waitForDone(void)
Definition: mthreadpool.cpp:562
MythContextPrivate::m_pConfig
Configuration * m_pConfig
Definition: mythcontext.cpp:127
compat.h
BackendSelection::kCancelConfigure
@ kCancelConfigure
Definition: backendselect.h:45
MythNotification::SetParent
void SetParent(void *Parent)
Contains the parent address. Required if id is set Id provided must match the parent address as provi...
Definition: mythnotification.cpp:98
MythContextPrivate::m_socket
QTcpSocket * m_socket
Definition: mythcontext.cpp:142
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:244
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:1141
DestroyMythMainWindow
void DestroyMythMainWindow(void)
Definition: mythmainwindow.cpp:114
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:675
BackendSelection::kAcceptConfigure
@ kAcceptConfigure
Definition: backendselect.h:46
MythErrorNotification
Definition: mythnotification.h:191
getResponse
QString getResponse(const QString &query, const QString &def)
In an interactive shell, prompt the user to input a string.
Definition: mythmiscutil.cpp:456
MythCoreContext::GetDB
MythDB * GetDB(void)
Definition: mythcorecontext.cpp:1768
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:642
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:66
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:715
TaskQueue::Shutdown
static void Shutdown()
Definition: taskqueue.cpp:68
SSDPCacheEntries
Definition: ssdpcache.h:34
uint
unsigned int uint
Definition: compat.h:141
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:60
UPnPResult_ActionNotAuthorized
@ UPnPResult_ActionNotAuthorized
Definition: upnp.h:49
MythContextPrivate::m_ui
MythUIHelper * m_ui
Definition: mythcontext.cpp:131
MythContextPrivate::clearSettingsCacheOverride
static void clearSettingsCacheOverride(void)
Definition: mythcontext.cpp:1518
MythCoreContext::GetNumSetting
int GetNumSetting(const QString &key, int defaultval=0)
Definition: mythcorecontext.cpp:933
logStop
void logStop(void)
Entry point for stopping logging for an application.
Definition: logging.cpp:735
MythContextPrivate::m_registration
int m_registration
Definition: mythcontext.cpp:140
MythContextPrivate::m_masterhostname
QString m_masterhostname
master backend hostname
Definition: mythcontext.cpp:122
exec_program_cb
static void exec_program_cb(const QString &cmd)
Definition: mythcontext.cpp:146
MythUIMenuCallbacks::exec_program
void(* exec_program)(const QString &cmd)
Definition: mythuihelper.h:16
MythCoreContext::SetLocalHostname
void SetLocalHostname(const QString &hostname)
Definition: mythcorecontext.cpp:1741
MythContextSlotHandler::d
MythContextPrivate * d
Definition: mythcontext.h:31
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:225
GUIStartup::updateProgress
bool updateProgress(bool finished)
Definition: guistartup.cpp:149
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:1092
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:132
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:1001
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:122
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:112
MythCoreContext
This class contains the runtime context for MythTV.
Definition: mythcorecontext.h:62
mythmiscutil.h
MythConfirmationDialog
Dialog asking for user confirmation. Ok and optional Cancel button.
Definition: mythdialogbox.h:271
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:1680
Configuration
Definition: configuration.h:21
dir
QDir dir
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:1174
GUIStartup
Definition: guistartup.h:48
intResponse
int intResponse(const QString &query, int def)
In an interactive shell, prompt the user to input a number.
Definition: mythmiscutil.cpp:486
MythContextPrivate::m_dbParams
DatabaseParams m_dbParams
Current database host & WOL details.
Definition: mythcontext.cpp:124
MythContextPrivate::HideConnectionFailurePopup
void HideConnectionFailurePopup(void)
Definition: mythcontext.cpp:1413
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:947
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
GENERIC_EXIT_SOCKET_ERROR
#define GENERIC_EXIT_SOCKET_ERROR
Socket error.
Definition: exitcodes.h:18
BackendSelection::Decision
Decision
Definition: backendselect.h:42
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:326
GetNotificationCenter
MythNotificationCenter * GetNotificationCenter(void)
Definition: mythmainwindow.cpp:124
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:86
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:104
Configuration::GetValue
virtual int GetValue(const QString &sSetting, int Default)=0
BackendSelection::Prompt
static Decision Prompt(DatabaseParams *dbParams, Configuration *pConfig)
Definition: backendselect.cpp:47
MythNotification::SetId
void SetId(int Id)
Contains the application registration id.
Definition: mythnotification.cpp:85
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:278
MythCoreContext::ActivateSettingsCache
void ActivateSettingsCache(bool activate=true)
Definition: mythcorecontext.cpp:854
MythContextPrivate::m_lastCheck
QDateTime m_lastCheck
Definition: mythcontext.cpp:141
MythContextPrivate::ResetDatabase
void ResetDatabase(void) const
Called when the user changes the DB connection settings.
Definition: mythcontext.cpp:1131
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:707
MythContextPrivate::m_needsBackend
bool m_needsBackend
Definition: mythcontext.cpp:135
MythContextPrivate::processEvents
static void processEvents(void)
Definition: mythcontext.cpp:1456
GUIStartup::m_Setup
bool m_Setup
Definition: guistartup.h:55
MythCoreContext::ClearSettingsCache
void ClearSettingsCache(const QString &myKey=QString(""))
Definition: mythcorecontext.cpp:849
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:125
d
static const iso6937table * d
Definition: iso6937tables.cpp:1025
MythCoreContext::IsWOLAllowed
bool IsWOLAllowed() const
Definition: mythcorecontext.cpp:655
MythUIHelper
Definition: mythuihelper.h:23
MythContextSlotHandler
Definition: mythcontext.h:14
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:2088
mythmainwindow.h
MythScreenStack::AddScreen
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Definition: mythscreenstack.cpp:52
DatabaseParams::m_localHostName
QString m_localHostName
name used for loading/saving settings
Definition: mythdbparams.h:30
MythCoreContext::SaveLocaleDefaults
void SaveLocaleDefaults(void)
Definition: mythcorecontext.cpp:1863
ShowOkPopup
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
Definition: mythdialogbox.cpp:557
MythContextPrivate::m_gui
bool m_gui
Should this context use GUI elements?
Definition: mythcontext.cpp:120
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:64
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:1562
MythMainWindow
Definition: mythmainwindow.h:34
DatabaseParams::IsValid
bool IsValid(const QString &source=QString("Unknown")) const
Definition: mythdbparams.cpp:36
MythContextPrivate::m_guiStartup
GUIStartup * m_guiStartup
Definition: mythcontext.cpp:133
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:1685
DestroyMythUI
void DestroyMythUI()
Definition: mythuihelper.cpp:71
GUIStartup::cancelPortCheck
void cancelPortCheck(void)
MythContextPrivate::loadSettingsCacheOverride
void loadSettingsCacheOverride(void) const
Definition: mythcontext.cpp:1499
MythContext::~MythContext
virtual ~MythContext()
Definition: mythcontext.cpp:1650
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:919
MythContextPrivate
Definition: mythcontext.cpp:68
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:14
GUIStartup::m_Exit
bool m_Exit
Definition: guistartup.h:54
Configuration::SetBoolValue
virtual void SetBoolValue(const QString &sSetting, bool value)=0