Go to the documentation of this file.
10 #include <QCoreApplication>
20 #include <QtAndroidExtras>
38 #include "libmythbase/mythversion.h"
55 #define LOC QString("MythContext: ")
63 class GUISettingsCache
66 GUISettingsCache() =
default;
67 GUISettingsCache(
const QString& cache_filename, QString cache_path)
68 : m_cachePath(std::move(cache_path))
70 m_cacheFilename = m_cachePath +
'/' + cache_filename;
71 if (m_cachePath.isEmpty() || cache_filename.isEmpty())
73 m_cacheFilename = m_cachePath = QString();
78 void loadOverrides()
const;
79 static void clearOverrides();
82 QString m_cacheFilename {
"cache/contextcache.xml"};
83 QString m_cachePath {
"cache"};
85 static const std::array<QString, 13> kSettings;
99 bool promptForBackend,
100 bool disableAutoDiscovery,
118 int UPnPautoconf(std::chrono::milliseconds milliSeconds = 2s);
122 bool checkPort(QString &host,
int port, std::chrono::seconds timeLimit)
const;
126 bool event(QEvent* )
override;
172 QStringList tokens = cmd.simplified().split(
" ");
175 bool cardidok =
false;
176 int wantcardid = tokens[0].toInt(&cardidok, 10);
178 if (cardidok && wantcardid > 0)
180 strlist << QString(
"LOCK_TUNER %1").arg(wantcardid);
181 s = s.replace(0, tokens[0].length() + 1,
"");
184 strlist <<
"LOCK_TUNER";
187 int cardid = strlist[0].toInt();
191 s = s.arg(qPrintable(strlist[1]),
192 qPrintable(strlist[2]),
193 qPrintable(strlist[3]));
197 strlist = QStringList(QString(
"FREE_TUNER %1").arg(cardid));
208 label = QObject::tr(
"Could not find specified tuner (%1).")
213 label = QObject::tr(
"Specified tuner (%1) is already in use.")
219 label = QObject::tr(
"All tuners are currently in use. If you want "
220 "to watch TV, you can cancel one of the "
221 "in-progress recordings from the delete menu");
224 LOG(VB_GENERAL, LOG_ALERT, QString(
"exec_program_tv: ") + label);
239 QObject::tr(
"Failed to configure plugin"));
253 QObject::tr(
"%1 failed to run for some reason").arg(cmd));
266 m_loop =
new QEventLoop(
this);
349 return checker.
checkPort(host, port, timeLimit);
354 const bool promptForBackend,
355 const bool disableAutoDiscovery,
374 if (!ignoreDB && !
FindDatabase(promptForBackend, disableAutoDiscovery))
433 bool manualSelect = prompt && !noAutodetect;
444 bool autoSelect = !manualSelect && !loaded && !noAutodetect;
454 autoSelect = manualSelect =
false;
456 if (!failure.isEmpty())
457 LOG(VB_GENERAL, LOG_ALERT, failure);
460 if (failure.isEmpty())
474 failure = QObject::tr(
"No UPnP backends found",
"Backend Setup");
479 if (failure.isEmpty())
486 manualSelect |= (count > 1 || count == -1);
492 manualSelect &=
m_gui;
505 manualSelect =
false;
518 if (!failure.isEmpty())
519 LOG(VB_GENERAL, LOG_ALERT, failure);
527 while (!failure.isEmpty());
530 LOG(VB_GENERAL, LOG_DEBUG,
"FindDatabase() - Success!");
546 LOG(VB_GENERAL, LOG_DEBUG,
"FindDatabase() - failed");
569 config.GetDuration<std::chrono::seconds>(
kDefaultWOL +
"SQLReconnectWaitTime", 0s);
582 hostname ==
"my-unique-identifier-goes-here")
584 LOG(VB_GENERAL, LOG_INFO,
"Empty LocalHostName. This is typical.");
585 hostname = QHostInfo::localHostName();
590 LOG(VB_GENERAL, LOG_ALERT,
591 "MCP: Error, could not determine host name." +
ENO);
593 #else //elif defined Q_OS_ANDROID
594 #define ANDROID_EXCEPTION_CHECK \
595 if (env->ExceptionCheck()) \
597 env->ExceptionClear(); \
604 bool exception=
false;
605 QAndroidJniEnvironment env;
607 QAndroidJniObject activity = QtAndroid::androidActivity();
609 QAndroidJniObject appctx = activity.callObjectMethod
610 (
"getApplicationContext",
"()Landroid/content/Context;");
612 QAndroidJniObject contentR = appctx.callObjectMethod
613 (
"getContentResolver",
"()Landroid/content/ContentResolver;");
615 QAndroidJniObject androidId = QAndroidJniObject::callStaticObjectMethod
616 (
"android/provider/Settings$Secure",
"getString",
617 "(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;",
618 contentR.object<jobject>(),
619 myID.object<jstring>());
622 LOG(VB_GENERAL, LOG_ALERT,
623 "Java exception looking for android id");
625 hostname = QString(
"android-%1").arg(androidId.toString());
635 LOG(VB_GENERAL, LOG_INFO, QString(
"Using a profile name of: '%1' (Usually the "
636 "same as this host's name.)")
666 if (addr.setAddress(dbHostName))
668 addr.setScopeId(QString());
669 dbHostName = addr.toString();
671 config.SetValue(
kDefaultDB +
"Host", dbHostName);
684 success = config.Save();
706 bool accepted =
false;
712 if (!
error.isEmpty())
740 std::this_thread::sleep_for(1s);
742 std::cout << std::endl <<
error.toLocal8Bit().constData() << std::endl << std::endl;
743 response =
getResponse(
"Would you like to configure the database "
746 if (!response.startsWith(
'y', Qt::CaseInsensitive))
751 response =
getResponse(
"Should I test connectivity to this host "
752 "using the ping command?",
"yes");
753 params.
m_dbHostPing = response.startsWith(
'y', Qt::CaseInsensitive);
765 "(if empty, the local host name "
770 response =
getResponse(
"Would you like to use Wake-On-LAN to retry "
771 "database connections?",
773 params.
m_wolEnabled = response.startsWith(
'y', Qt::CaseInsensitive);
778 std::chrono::seconds(
intResponse(
"Seconds to wait for "
819 } startupState = st_start;
821 static const std::array<const QString, 7> kGuiStatuses
822 {
"start",
"dbAwake",
"dbStarted",
"dbConnects",
"beWOL",
"beAwake",
"success"};
825 auto msStartupScreenDelay = std::chrono::duration_cast<std::chrono::milliseconds>(secondsStartupScreenDelay);
837 std::chrono::seconds wakeupTime = 3s;
843 startupState = st_start;
846 startupState = st_dbAwake;
854 std::chrono::seconds progressTotal = wakeupTime * attempts;
859 QString beWOLCmd = QString();
860 QString backendIP = QString();
862 QString masterserver;
864 for (
int attempt = 0;
865 attempt < attempts && startupState != st_success;
872 LOG(VB_GENERAL, LOG_INFO,
873 QString(
"Start up testing connections. DB %1, BE %2, attempt %3, status %4, Delay: %5")
874 .arg(host, backendIP, QString::number(attempt),
875 kGuiStatuses[startupState],
876 QString::number(msStartupScreenDelay.count())) );
878 std::chrono::seconds useTimeout = wakeupTime;
884 if (msStartupScreenDelay==0ms || timer.hasExpired(msStartupScreenDelay.count()))
898 switch (startupState)
908 startupState = st_dbAwake;
909 [[clang::fallthrough]];
913 startupState = st_dbStarted;
914 [[clang::fallthrough]];
927 for (std::chrono::seconds temp = 0s; temp < useTimeout * 2 ; temp++)
930 std::this_thread::sleep_for(500ms);
934 startupState = st_dbConnects;
935 [[clang::fallthrough]];
940 if (!beWOLCmd.isEmpty())
943 (
"WOLbackendReconnectWaitTime", 0s);
945 (
"WOLbackendConnectRetry", 0);
946 useTimeout = wakeupTime;
949 progressTotal = wakeupTime * attempts;
952 startupState = st_beWOL;
957 startupState = st_success;
961 (
"MasterServerName");
963 (
"BackendServerAddr", masterserver);
965 [[clang::fallthrough]];
967 if (!beWOLCmd.isEmpty())
971 if (!
checkPort(backendIP, backendPort, useTimeout))
974 startupState = st_beAwake;
975 [[clang::fallthrough]];
977 if (!
checkPort(backendIP, backendPort, useTimeout))
979 startupState = st_success;
980 [[clang::fallthrough]];
995 if (startupState == st_success)
998 QString stateMsg = kGuiStatuses[startupState];
999 stateMsg.append(
"Fail");
1000 LOG(VB_GENERAL, LOG_INFO,
1001 QString(
"Start up failure. host %1, status %2")
1002 .arg(host, stateMsg));
1025 if (startupState < st_dbAwake)
1027 LOG(VB_GENERAL, LOG_WARNING, QString(
"Pinging to %1 failed, database will be unavailable").arg(host));
1030 "Cannot find (ping) database host %1 on the network",
1032 return err.arg(host);
1035 if (startupState < st_dbConnects)
1038 return QObject::tr(
"Cannot login to database",
"Backend Setup");
1041 if (startupState < st_success)
1043 return QObject::tr(
"Cannot connect to backend",
"Backend Setup");
1144 if (!
error.isEmpty())
1146 LOG(VB_GENERAL, LOG_ERR, QString(
"Error: %1").arg(
error));
1150 LOG(VB_GENERAL, LOG_INFO,
"Putting up the UPnP backend chooser");
1169 auto seconds = duration_cast<std::chrono::seconds>(milliSeconds);
1170 LOG(VB_GENERAL, LOG_INFO, QString(
"UPNP Search %1 secs")
1171 .arg(seconds.count()));
1179 while (totalTime.
elapsed() < milliSeconds)
1182 auto ttl = milliSeconds - totalTime.
elapsed();
1183 if ((searchTime.
elapsed() > 249ms) && (ttl > 1s))
1185 auto ttlSeconds = duration_cast<std::chrono::seconds>(ttl);
1186 LOG(VB_GENERAL, LOG_INFO, QString(
"UPNP Search %1 secs")
1187 .arg(ttlSeconds.count()));
1197 LOG(VB_GENERAL, LOG_INFO,
"No UPnP backends found");
1201 int count = backends->
Count();
1204 LOG(VB_GENERAL, LOG_INFO,
1205 QString(
"Found %1 UPnP backends").arg(count));
1209 LOG(VB_GENERAL, LOG_ERR,
1210 "No UPnP backends found, but SSDP::Find() not NULL");
1240 static const QString loc =
"DefaultUPnP() - ";
1253 LOG(VB_UPNP, LOG_INFO, loc +
"No default UPnP backend");
1257 LOG(VB_UPNP, LOG_INFO,
1259 QString(
" has default PIN '%1' and host USN: %2").arg(pin, usn));
1263 std::chrono::milliseconds timeout_ms {2s};
1264 auto timeout_s = duration_cast<std::chrono::seconds>(timeout_ms);
1265 LOG(VB_GENERAL, LOG_INFO, loc + QString(
"UPNP Search up to %1 secs")
1266 .arg(timeout_s.count()));
1278 while (totalTime.
elapsed() < timeout_ms)
1286 auto ttl = timeout_ms - totalTime.
elapsed();
1287 if ((searchTime.
elapsed() > 249ms) && (ttl > 1s))
1289 auto ttlSeconds = duration_cast<std::chrono::seconds>(ttl);
1290 LOG(VB_GENERAL, LOG_INFO, loc + QString(
"UPNP Search up to %1 secs")
1291 .arg(ttlSeconds.count()));
1299 if (!devicelocation)
1301 Error =
"Cannot find default UPnP backend";
1312 Error =
"Cannot connect to default backend via UPnP. Wrong saved PIN?";
1323 QString loc =
"UPnPconnect() - ";
1327 LOG(VB_UPNP, LOG_INFO, loc + QString(
"Trying host at %1").arg(URL));
1332 LOG(VB_UPNP, LOG_INFO, loc +
1340 LOG(VB_UPNP, LOG_ERR, loc +
"Wrong PIN?");
1344 LOG(VB_UPNP, LOG_ERR, loc +
error);
1352 URL = theURL.host();
1356 LOG(VB_UPNP, LOG_INFO,
"Trying default DB credentials at " + URL);
1378 if (me->Message() ==
"VERSION_MISMATCH" && (1 == me->ExtraDataCount()))
1380 else if (me->Message() ==
"CONNECTION_FAILURE")
1382 else if (me->Message() ==
"PERSISTENT_CONNECTION_FAILURE")
1384 else if (me->Message() ==
"CONNECTION_RESTABLISHED")
1389 return QObject::event(e);
1409 QString description = (persistent) ?
1411 "The connection to the master backend "
1412 "server has gone away for some reason. "
1415 "Could not connect to the master backend server. Is "
1416 "it running? Is the IP address set for it in "
1417 "mythtv-setup correct?");
1419 QString message = QObject::tr(
"Could not connect to master backend");
1449 "The server uses network protocol version %1, "
1450 "but this client only understands version %2. "
1451 "Make sure you are running compatible versions of "
1452 "the backend and frontend.")
1453 .arg(remote_version).arg(MYTH_PROTO_VERSION);
1462 LOG(VB_GENERAL, LOG_ERR,
LOC + message);
1474 qApp->processEvents(QEventLoop::AllEvents, 250);
1475 qApp->processEvents(QEventLoop::AllEvents, 250);
1484 const std::array<QString, 13> GUISettingsCache::kSettings
1485 {
"Theme",
"Language",
"Country",
"GuiHeight",
1486 "GuiOffsetX",
"GuiOffsetY",
"GuiWidth",
"RunFrontendInWindow",
1487 "AlwaysOnTop",
"HideMouseCursor",
"ThemePainter",
"libCECEnabled",
1488 "StartupScreenDelay" };
1491 bool GUISettingsCache::save()
1493 QString cacheDirName =
GetConfDir() +
'/' + m_cachePath;
1494 QDir dir(cacheDirName);
1495 dir.mkpath(cacheDirName);
1498 for (
const auto & setting : kSettings)
1500 QString cacheValue = config.
GetValue(
"Settings/" + setting, QString());
1503 if (value != cacheValue)
1505 config.
SetValue(
"Settings/" + setting, value);
1513 #ifndef Q_OS_ANDROID
1516 return config.
Save();
1521 void GUISettingsCache::loadOverrides()
const
1524 for (
const auto & setting : kSettings)
1528 QString value = config.
GetValue(
"Settings/" + setting, QString());
1529 if (!value.isEmpty())
1538 void GUISettingsCache::clearOverrides()
1541 for (
const auto & setting : kSettings)
1559 : m_appBinaryVersion(
std::move(binversion))
1562 static bool WSAStarted =
false;
1566 int res = WSAStartup(MAKEWORD(2, 0), &wsadata);
1567 LOG(VB_SOCKET, LOG_INFO,
1568 QString(
"WSAStartup returned %1").arg(res));
1579 LOG(VB_GENERAL, LOG_EMERG,
LOC +
"Unable to allocate MythCoreContext");
1585 const bool promptForBackend,
1586 const bool disableAutoDiscovery,
1587 const bool ignoreDB)
1591 LOG(VB_GENERAL, LOG_EMERG,
LOC +
"Init() Out-of-memory");
1595 qRegisterMetaType<std::chrono::seconds>(
"std::chrono::seconds");
1596 qRegisterMetaType<std::chrono::milliseconds>(
"std::chrono::milliseconds");
1597 qRegisterMetaType<std::chrono::microseconds>(
"std::chrono::microseconds");
1603 LOG(VB_GENERAL, LOG_EMERG,
1604 QString(
"Application binary version (%1) does not "
1605 "match libraries (%2)")
1608 QString warning = QObject::tr(
1609 "This application is not compatible "
1610 "with the installed MythTV libraries.");
1616 LOG(VB_GENERAL, LOG_WARNING, warning);
1624 QString home = getenv(
"HOME");
1627 home = getenv(
"LOCALAPPDATA");
1629 home = getenv(
"APPDATA");
1631 home = QString(
".");
1633 _putenv(QString(
"HOME=%1").arg(home).toLocal8Bit().constData());
1639 QString homedir = QDir::homePath();
1640 QString
confdir = qEnvironmentVariable(
"MYTHCONFDIR");
1641 if ((homedir.isEmpty() || homedir ==
"/") &&
1644 QString warning =
"Cannot locate your home directory."
1645 " Please set the environment variable HOME";
1651 LOG(VB_GENERAL, LOG_WARNING, warning);
1656 if (!
d->
Init(gui, promptForBackend, disableAutoDiscovery, ignoreDB))
1678 LOG(VB_GENERAL, LOG_INFO,
"Waiting for threads to exit.");
1684 LOG(VB_GENERAL, LOG_INFO,
"Exiting");
void ShowConnectionFailurePopup(bool persistent)
MythScreenStack * GetMainStack()
std::chrono::milliseconds elapsed(void)
Returns milliseconds elapsed since last start() or restart()
MythContext(QString binversion, bool needsBackend=false)
static Type MythEventMessage
#define ENO
This can be appended to the LOG args with "+".
Small class to handle TCP port checking and finding link-local context.
bool Create(void) override
QString m_dbHostName
database server
void VersionMismatchPopupClosed(void)
void Init(bool MayReInit=true)
static void error(const char *str,...)
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
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
friend class MythContextPrivate
void PerformSearch(const QString &sST, std::chrono::seconds timeout=2s)
bool event(QEvent *) override
bool SendReceiveStringList(QStringList &strlist, bool quickTimeout=false, bool block=true)
Send a message to the backend and wait for a response.
int UPnPautoconf(std::chrono::milliseconds milliSeconds=2s)
If there is only a single UPnP backend, use it.
A QElapsedTimer based timer to replace use of QTime as a timer.
bool DefaultUPnP(QString &Error)
Get the default backend from XmlConfiguration::kDefaultFilename, use UPnP to find it.
bool m_forceSave
set to true to force a save of the settings file
void SetDuration(std::chrono::seconds Duration)
Contains a duration during which the notification will be displayed for. The duration is informative ...
MythConfirmationDialog * m_mbeVersionPopup
int Register(void *from)
An application can register in which case it will be assigned a reusable screen, which can be modifie...
MDBManager * GetDBManager(void)
bool IsScreenSetup() const
bool run_plugin(const QString &plugname)
Structure containing the basic Database parameters.
Startup context for MythTV.
static MythMainWindow * getMainWindow(bool UseDB=true)
Return the existing main window, or create one.
void OverrideSettingForSession(const QString &key, const QString &value)
This class is used as a container for messages.
void SetDisableEventPopup(bool check)
QString TestDBconnection(bool prompt=true)
Some quick sanity checks before opening a database connection.
const QString kDefaultWOL
static SSDPCacheEntries * Find(const QString &sURI)
void start(void)
starts measuring elapsed time.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
~MythContextPrivate() override
bool UPnPconnect(const DeviceLocation *backend, const QString &PIN)
Query a backend via UPnP for its database connection parameters.
void ShowVersionMismatchPopup(uint remote_version)
bool checkPort(QString &host, int port, std::chrono::seconds timeLimit) const
Check if a port is open and sort out the link-local scope.
void ShowGuiStartup(void)
uint myth_system(const QString &command, uint flags, std::chrono::seconds timeout)
bool HasMythMainWindow(void)
void InitPower(bool Create=true)
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
std::chrono::seconds m_wolReconnect
seconds to wait for reconnect
void EnableDBerrors(void)
QString m_appBinaryVersion
void InitializeMythDirs(void)
static void exec_program_tv_cb(const QString &cmd)
static void eject_cb(void)
void ClearOverrideSettingForSession(const QString &key)
int m_dbPort
database port
void SetValue(const QString &setting, bool value)
void CloseDatabases(void)
@ GENERIC_EXIT_NO_MYTHCONTEXT
No MythContext available.
bool m_dbHostPing
Can we test connectivity using ping?
static void configplugin_cb(const QString &cmd)
void SetParent(void *Parent)
Contains the parent address. Required if id is set Id provided must match the parent address as provi...
@ GENERIC_EXIT_SOCKET_ERROR
Socket error.
std::enable_if_t< std::chrono::__is_duration< T >::value, T > GetDurSetting(const QString &key, T defaultval=T::zero())
static bool testDBConnection()
Checks DB connection + login (login info via Mythcontext)
MythContextPrivate(MythContext *lparent)
void DestroyMythMainWindow(void)
bool IsFrontend(void) const
is this process a frontend process
QString getResponse(const QString &query, const QString &def)
In an interactive shell, prompt the user to input a string.
bool MythWakeup(const QString &wakeUpCommand, uint flags, std::chrono::seconds timeout)
bool SaveDatabaseParams(const DatabaseParams ¶ms, bool force)
QString m_dbPassword
DB password.
static const QString sLocation
int m_wolRetry
times to retry to reconnect
const QString kBackendURI
QString m_dbName
database name
bool PromptForDatabaseParams(const QString &error)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
@ UPnPResult_ActionNotAuthorized
int GetNumSetting(const QString &key, int defaultval=0)
void logStop(void)
Entry point for stopping logging for an application.
QString m_masterhostname
master backend hostname
static void exec_program_cb(const QString &cmd)
void SetLocalHostname(const QString &hostname)
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
void setTotal(std::chrono::seconds total)
static Decision Prompt(DatabaseParams *dbParams, const QString &config_filename)
static void plugin_cb(const QString &cmd)
bool updateProgress(bool finished)
bool config_plugin(const QString &plugname)
void SilenceDBerrors(void)
Cause MSqlDatabase::OpenDatabase() and MSqlQuery to fail silently.
MythContextSlotHandler * m_sh
static int GetMasterServerPort(void)
Returns the Master Backend control port If no master server port has been defined in the database,...
bool checkPort(QString &host, int port, std::chrono::milliseconds timeLimit=30s, bool linkLocalOnly=false)
Check if a port is open and sort out the link-local scope.
void LoadDefaults(void)
Load sensible connection defaults.
bool setMessageState(const QString &name)
bool FindDatabase(bool prompt, bool noAutodetect)
Get database connection settings and test connectivity.
bool setStatusState(const QString &name)
This class contains the runtime context for MythTV.
QString GetValue(const QString &setting)
GUISettingsCache m_GUISettingsCache
Dialog asking for user confirmation. Ok and optional Cancel button.
bool LoadDatabaseSettings(void)
Load database and host settings from XmlConfiguration::k_default_filename, or set some defaults.
bool SaveDatabaseParams(const DatabaseParams ¶ms)
bool Init(bool gui, bool promptForBackend, bool disableAutoDiscovery, bool ignoreDB)
int intResponse(const QString &query, int def)
In an interactive shell, prompt the user to input a number.
DatabaseParams m_dbParams
Current database host & WOL details.
void HideConnectionFailurePopup(void)
QString m_wolCommand
command to use for wake-on-lan
QString GetSettingOnHost(const QString &key, const QString &host, const QString &defaultval="")
static bool prompt(bool force=false)
Ask the user for the language to use.
QString m_dbUserName
DB user name.
static constexpr auto kDefaultFilename
MythNotificationCenter * GetNotificationCenter(void)
void UnRegister(void *from, int id, bool closeimemdiately=false)
Unregister the client.
virtual void PopScreen(MythScreenType *screen=nullptr, bool allowFade=true, bool deleteScreen=true)
const QString kDefaultUSN
MythMainWindow * GetMythMainWindow(void)
BackendSelection::Decision ChooseBackend(const QString &error)
Search for backends via UPnP, put up a UI for the user to choose one.
void SetId(int Id)
Contains the application registration id.
UPnPResultCode GetConnectionInfo(const QString &sPin, DatabaseParams *pParams, QString &sMsg)
void TempMainWindow(bool languagePrompt=true)
Setup a minimal themed main window, and prompt for user's language.
void ActivateSettingsCache(bool activate=true)
void ResetDatabase(void) const
Called when the user changes the DB connection settings.
const QString kDefaultPIN
void Init(MythUIMenuCallbacks &cbs)
static void processEvents(void)
void ClearSettingsCache(const QString &myKey=QString(""))
bool m_localEnabled
true if localHostName is not default
QString m_dbHostCp
dbHostName backup
bool IsWOLAllowed() const
bool m_wolEnabled
true if wake-on-lan params are used
static void load(const QString &module_name)
Load a QTranslator for the user's preferred language.
MythUIHelper * GetMythUI()
static MThreadPool * globalInstance(void)
MythPluginManager * GetPluginManager(void)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
QString m_localHostName
name used for loading/saving settings
void SaveLocaleDefaults(void)
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
bool m_gui
Should this context use GUI elements?
#define ANDROID_EXCEPTION_CHECK
MythContext * gContext
This global variable contains the MythContext instance for the application.
void cancelPortCheck(void)
Cancel the checkPort operation currently in progress.
bool Init(bool gui=true, bool promptForBackend=false, bool disableAutoDiscovery=false, bool ignoreDB=false)
bool IsValid(const QString &source=QString("Unknown")) const
GUIStartup * m_guiStartup
DeviceLocation * GetFirst(void)
Returns random entry in cache, returns nullptr when list is empty.
bool saveSettingsCache(void)
void cancelPortCheck(void)
QString GetSetting(const QString &key, const QString &defaultval="")
bool Queue(const MythNotification ¬ification)
Queue a notification Queue() is thread-safe and can be called from anywhere.