Go to the documentation of this file.
10 #include <QCoreApplication>
20 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
21 #include <QtAndroidExtras>
23 #include <QJniEnvironment>
25 #define QAndroidJniEnvironment QJniEnvironment
26 #define QAndroidJniObject QJniObject
45 #include "libmythbase/mythversion.h"
62 #define LOC QString("MythContext: ")
70 class GUISettingsCache
73 GUISettingsCache() =
default;
74 GUISettingsCache(
const QString& cache_filename, QString cache_path)
75 : m_cachePath(std::move(cache_path))
77 m_cacheFilename = m_cachePath +
'/' + cache_filename;
78 if (m_cachePath.isEmpty() || cache_filename.isEmpty())
80 m_cacheFilename = m_cachePath = QString();
85 void loadOverrides()
const;
86 static void clearOverrides();
89 QString m_cacheFilename {
"cache/contextcache.xml"};
90 QString m_cachePath {
"cache"};
92 static const std::array<QString, 13> kSettings;
106 bool promptForBackend,
107 bool disableAutoDiscovery,
125 int UPnPautoconf(std::chrono::milliseconds milliSeconds = 2s);
129 bool checkPort(QString &host,
int port, std::chrono::seconds timeLimit)
const;
133 bool event(QEvent* )
override;
179 QStringList tokens = cmd.simplified().split(
" ");
182 bool cardidok =
false;
183 int wantcardid = tokens[0].toInt(&cardidok, 10);
185 if (cardidok && wantcardid > 0)
187 strlist << QString(
"LOCK_TUNER %1").arg(wantcardid);
188 s = s.replace(0, tokens[0].length() + 1,
"");
191 strlist <<
"LOCK_TUNER";
194 int cardid = strlist[0].toInt();
198 s = s.arg(qPrintable(strlist[1]),
199 qPrintable(strlist[2]),
200 qPrintable(strlist[3]));
204 strlist = QStringList(QString(
"FREE_TUNER %1").arg(cardid));
215 label = QObject::tr(
"Could not find specified tuner (%1).")
220 label = QObject::tr(
"Specified tuner (%1) is already in use.")
226 label = QObject::tr(
"All tuners are currently in use. If you want "
227 "to watch TV, you can cancel one of the "
228 "in-progress recordings from the delete menu");
231 LOG(VB_GENERAL, LOG_ALERT, QString(
"exec_program_tv: ") + label);
246 QObject::tr(
"Failed to configure plugin"));
260 QObject::tr(
"%1 failed to run for some reason").arg(cmd));
273 m_loop =
new QEventLoop(
this);
356 return checker.
checkPort(host, port, timeLimit);
361 const bool promptForBackend,
362 const bool disableAutoDiscovery,
381 if (!ignoreDB && !
FindDatabase(promptForBackend, disableAutoDiscovery))
440 bool manualSelect = prompt && !noAutodetect;
451 bool autoSelect = !manualSelect && !loaded && !noAutodetect;
461 autoSelect = manualSelect =
false;
463 if (!failure.isEmpty())
464 LOG(VB_GENERAL, LOG_ALERT, failure);
467 if (failure.isEmpty())
481 failure = QObject::tr(
"No UPnP backends found",
"Backend Setup");
486 if (failure.isEmpty())
493 manualSelect |= (count > 1 || count == -1);
499 manualSelect &=
m_gui;
512 manualSelect =
false;
529 if (!failure.isEmpty())
530 LOG(VB_GENERAL, LOG_ALERT, failure);
538 while (!failure.isEmpty());
541 LOG(VB_GENERAL, LOG_DEBUG,
"FindDatabase() - Success!");
557 LOG(VB_GENERAL, LOG_DEBUG,
"FindDatabase() - failed");
580 config.GetDuration<std::chrono::seconds>(
kDefaultWOL +
"SQLReconnectWaitTime", 0s);
593 hostname ==
"my-unique-identifier-goes-here")
595 LOG(VB_GENERAL, LOG_INFO,
"Empty LocalHostName. This is typical.");
596 hostname = QHostInfo::localHostName();
601 LOG(VB_GENERAL, LOG_ALERT,
602 "MCP: Error, could not determine host name." +
ENO);
604 #else //elif defined Q_OS_ANDROID
605 #define ANDROID_EXCEPTION_CHECK \
606 if (env->ExceptionCheck()) \
608 env->ExceptionClear(); \
615 bool exception=
false;
618 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
621 QJniObject activity = QNativeInterface::QAndroidApplication::context();
625 (
"getApplicationContext",
"()Landroid/content/Context;");
628 (
"getContentResolver",
"()Landroid/content/ContentResolver;");
631 (
"android/provider/Settings$Secure",
"getString",
632 "(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;",
633 contentR.object<jobject>(),
634 myID.object<jstring>());
637 LOG(VB_GENERAL, LOG_ALERT,
638 "Java exception looking for android id");
640 hostname = QString(
"android-%1").arg(androidId.toString());
650 LOG(VB_GENERAL, LOG_INFO, QString(
"Using a profile name of: '%1' (Usually the "
651 "same as this host's name.)")
681 if (addr.setAddress(dbHostName))
683 addr.setScopeId(QString());
684 dbHostName = addr.toString();
686 config.SetValue(
kDefaultDB +
"Host", dbHostName);
699 success = config.Save();
725 bool accepted =
false;
731 if (!
error.isEmpty())
759 std::this_thread::sleep_for(1s);
761 std::cout << std::endl <<
error.toLocal8Bit().constData() << std::endl << std::endl;
762 response =
getResponse(
"Would you like to configure the database "
765 if (!response.startsWith(
'y', Qt::CaseInsensitive))
770 response =
getResponse(
"Should I test connectivity to this host "
771 "using the ping command?",
"yes");
772 params.
m_dbHostPing = response.startsWith(
'y', Qt::CaseInsensitive);
784 "(if empty, the local host name "
789 response =
getResponse(
"Would you like to use Wake-On-LAN to retry "
790 "database connections?",
792 params.
m_wolEnabled = response.startsWith(
'y', Qt::CaseInsensitive);
797 std::chrono::seconds(
intResponse(
"Seconds to wait for "
838 } startupState = st_start;
840 static const std::array<const QString, 7> kGuiStatuses
841 {
"start",
"dbAwake",
"dbStarted",
"dbConnects",
"beWOL",
"beAwake",
"success"};
844 auto msStartupScreenDelay = std::chrono::duration_cast<std::chrono::milliseconds>(secondsStartupScreenDelay);
856 std::chrono::seconds wakeupTime = 3s;
862 startupState = st_start;
865 startupState = st_dbAwake;
873 std::chrono::seconds progressTotal = wakeupTime * attempts;
878 QString beWOLCmd = QString();
879 QString backendIP = QString();
881 QString masterserver;
883 for (
int attempt = 0;
884 attempt < attempts && startupState != st_success;
891 LOG(VB_GENERAL, LOG_INFO,
892 QString(
"Start up testing connections. DB %1, BE %2, attempt %3, status %4, Delay: %5")
893 .arg(host, backendIP, QString::number(attempt),
894 kGuiStatuses[startupState],
895 QString::number(msStartupScreenDelay.count())) );
897 std::chrono::seconds useTimeout = wakeupTime;
903 if (msStartupScreenDelay==0ms || timer.hasExpired(msStartupScreenDelay.count()))
917 switch (startupState)
927 startupState = st_dbAwake;
932 startupState = st_dbStarted;
946 for (std::chrono::seconds temp = 0s; temp < useTimeout * 2 ; temp++)
949 std::this_thread::sleep_for(500ms);
953 startupState = st_dbConnects;
959 if (!beWOLCmd.isEmpty())
962 (
"WOLbackendReconnectWaitTime", 0s);
964 (
"WOLbackendConnectRetry", 0);
965 useTimeout = wakeupTime;
968 progressTotal = wakeupTime * attempts;
971 startupState = st_beWOL;
976 startupState = st_success;
980 (
"MasterServerName");
982 (
"BackendServerAddr", masterserver);
986 if (!beWOLCmd.isEmpty())
990 if (!
checkPort(backendIP, backendPort, useTimeout))
993 startupState = st_beAwake;
996 if (!
checkPort(backendIP, backendPort, useTimeout))
998 startupState = st_success;
1014 if (startupState == st_success)
1017 QString stateMsg = kGuiStatuses[startupState];
1018 stateMsg.append(
"Fail");
1019 LOG(VB_GENERAL, LOG_INFO,
1020 QString(
"Start up failure. host %1, status %2")
1021 .arg(host, stateMsg));
1044 if (startupState < st_dbAwake)
1046 LOG(VB_GENERAL, LOG_WARNING, QString(
"Pinging to %1 failed, database will be unavailable").arg(host));
1049 "Cannot find (ping) database host %1 on the network",
1051 return err.arg(host);
1054 if (startupState < st_dbConnects)
1057 return QObject::tr(
"Cannot login to database",
"Backend Setup");
1060 if (startupState < st_success)
1062 return QObject::tr(
"Cannot connect to backend",
"Backend Setup");
1163 if (!
error.isEmpty())
1165 LOG(VB_GENERAL, LOG_ERR, QString(
"Error: %1").arg(
error));
1169 LOG(VB_GENERAL, LOG_INFO,
"Putting up the UPnP backend chooser");
1188 auto seconds = duration_cast<std::chrono::seconds>(milliSeconds);
1189 LOG(VB_GENERAL, LOG_INFO, QString(
"UPNP Search %1 secs")
1190 .arg(seconds.count()));
1198 while (totalTime.
elapsed() < milliSeconds)
1201 auto ttl = milliSeconds - totalTime.
elapsed();
1202 if ((searchTime.
elapsed() > 249ms) && (ttl > 1s))
1204 auto ttlSeconds = duration_cast<std::chrono::seconds>(ttl);
1205 LOG(VB_GENERAL, LOG_INFO, QString(
"UPNP Search %1 secs")
1206 .arg(ttlSeconds.count()));
1216 LOG(VB_GENERAL, LOG_INFO,
"No UPnP backends found");
1220 int count = backends->
Count();
1223 LOG(VB_GENERAL, LOG_INFO,
1224 QString(
"Found %1 UPnP backends").arg(count));
1228 LOG(VB_GENERAL, LOG_ERR,
1229 "No UPnP backends found, but SSDP::Find() not NULL");
1259 static const QString loc =
"DefaultUPnP() - ";
1272 LOG(VB_UPNP, LOG_INFO, loc +
"No default UPnP backend");
1276 LOG(VB_UPNP, LOG_INFO,
1278 QString(
" has default PIN '%1' and host USN: %2").arg(pin, usn));
1282 std::chrono::milliseconds timeout_ms {2s};
1283 auto timeout_s = duration_cast<std::chrono::seconds>(timeout_ms);
1284 LOG(VB_GENERAL, LOG_INFO, loc + QString(
"UPNP Search up to %1 secs")
1285 .arg(timeout_s.count()));
1297 while (totalTime.
elapsed() < timeout_ms)
1305 auto ttl = timeout_ms - totalTime.
elapsed();
1306 if ((searchTime.
elapsed() > 249ms) && (ttl > 1s))
1308 auto ttlSeconds = duration_cast<std::chrono::seconds>(ttl);
1309 LOG(VB_GENERAL, LOG_INFO, loc + QString(
"UPNP Search up to %1 secs")
1310 .arg(ttlSeconds.count()));
1318 if (!devicelocation)
1320 Error =
"Cannot find default UPnP backend";
1331 Error =
"Cannot connect to default backend via UPnP. Wrong saved PIN?";
1342 QString loc =
"UPnPconnect() - ";
1346 LOG(VB_UPNP, LOG_INFO, loc + QString(
"Trying host at %1").arg(URL));
1351 LOG(VB_UPNP, LOG_INFO, loc +
1359 LOG(VB_UPNP, LOG_ERR, loc +
"Wrong PIN?");
1363 LOG(VB_UPNP, LOG_ERR, loc +
error);
1371 URL = theURL.host();
1375 LOG(VB_UPNP, LOG_INFO,
"Trying default DB credentials at " + URL);
1397 if (me->Message() ==
"VERSION_MISMATCH" && (1 == me->ExtraDataCount()))
1399 else if (me->Message() ==
"CONNECTION_FAILURE")
1401 else if (me->Message() ==
"PERSISTENT_CONNECTION_FAILURE")
1403 else if (me->Message() ==
"CONNECTION_RESTABLISHED")
1408 return QObject::event(e);
1428 QString description = (persistent) ?
1430 "The connection to the master backend "
1431 "server has gone away for some reason. "
1434 "Could not connect to the master backend server. Is "
1435 "it running? Is the IP address set for it in "
1436 "mythtv-setup correct?");
1438 QString message = QObject::tr(
"Could not connect to master backend");
1468 "The server uses network protocol version %1, "
1469 "but this client only understands version %2. "
1470 "Make sure you are running compatible versions of "
1471 "the backend and frontend.")
1472 .arg(remote_version).arg(MYTH_PROTO_VERSION);
1481 LOG(VB_GENERAL, LOG_ERR,
LOC + message);
1493 qApp->processEvents(QEventLoop::AllEvents, 250);
1494 qApp->processEvents(QEventLoop::AllEvents, 250);
1503 const std::array<QString, 13> GUISettingsCache::kSettings
1504 {
"Theme",
"Language",
"Country",
"GuiHeight",
1505 "GuiOffsetX",
"GuiOffsetY",
"GuiWidth",
"RunFrontendInWindow",
1506 "AlwaysOnTop",
"HideMouseCursor",
"ThemePainter",
"libCECEnabled",
1507 "StartupScreenDelay" };
1510 bool GUISettingsCache::save()
1512 QString cacheDirName =
GetConfDir() +
'/' + m_cachePath;
1513 QDir dir(cacheDirName);
1514 dir.mkpath(cacheDirName);
1517 for (
const auto & setting : kSettings)
1519 QString cacheValue = config.
GetValue(
"Settings/" + setting, QString());
1522 if (value != cacheValue)
1524 config.
SetValue(
"Settings/" + setting, value);
1532 #ifndef Q_OS_ANDROID
1535 return config.
Save();
1540 void GUISettingsCache::loadOverrides()
const
1543 for (
const auto & setting : kSettings)
1547 QString value = config.
GetValue(
"Settings/" + setting, QString());
1548 if (!value.isEmpty())
1557 void GUISettingsCache::clearOverrides()
1560 for (
const auto & setting : kSettings)
1578 : m_appBinaryVersion(
std::move(binversion))
1581 static bool WSAStarted =
false;
1585 int res = WSAStartup(MAKEWORD(2, 0), &wsadata);
1586 LOG(VB_SOCKET, LOG_INFO,
1587 QString(
"WSAStartup returned %1").arg(res));
1598 LOG(VB_GENERAL, LOG_EMERG,
LOC +
"Unable to allocate MythCoreContext");
1604 const bool promptForBackend,
1605 const bool disableAutoDiscovery,
1606 const bool ignoreDB)
1610 LOG(VB_GENERAL, LOG_EMERG,
LOC +
"Init() Out-of-memory");
1614 qRegisterMetaType<std::chrono::seconds>(
"std::chrono::seconds");
1615 qRegisterMetaType<std::chrono::milliseconds>(
"std::chrono::milliseconds");
1616 qRegisterMetaType<std::chrono::microseconds>(
"std::chrono::microseconds");
1623 QString warning = QObject::tr(
"mythtv-setup is deprecated.\n"
1624 "To set up MythTV, start mythbackend and use:\n"
1625 "http://localhost:6544/setupwizard");
1631 LOG(VB_GENERAL, LOG_EMERG,
1632 QString(
"Application binary version (%1) does not "
1633 "match libraries (%2)")
1636 QString warning = QObject::tr(
1637 "This application is not compatible "
1638 "with the installed MythTV libraries.");
1644 LOG(VB_GENERAL, LOG_WARNING, warning);
1652 QString home = getenv(
"HOME");
1655 home = getenv(
"LOCALAPPDATA");
1657 home = getenv(
"APPDATA");
1659 home = QString(
".");
1661 _putenv(QString(
"HOME=%1").arg(home).toLocal8Bit().constData());
1667 QString homedir = QDir::homePath();
1668 QString
confdir = qEnvironmentVariable(
"MYTHCONFDIR");
1669 if ((homedir.isEmpty() || homedir ==
"/") &&
1672 QString warning =
"Cannot locate your home directory."
1673 " Please set the environment variable HOME";
1679 LOG(VB_GENERAL, LOG_WARNING, warning);
1684 if (!
d->
Init(gui, promptForBackend, disableAutoDiscovery, ignoreDB))
1706 LOG(VB_GENERAL, LOG_INFO,
"Waiting for threads to exit.");
1712 LOG(VB_GENERAL, LOG_INFO,
"Exiting");
void ShowConnectionFailurePopup(bool persistent)
bool WaitFor(MythConfirmationDialog *dialog)
Blocks until confirmation dialog exits.
MythScreenStack * GetMainStack()
std::chrono::milliseconds elapsed(void)
Returns milliseconds elapsed since last start() or restart()
MythContext(QString binversion, bool needsBackend=false)
#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)
static const Type kMythEventMessage
void Init(bool MayReInit=true)
#define QAndroidJniEnvironment
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)
bool SaveDatabaseParams(const DatabaseParams ¶ms, bool force=false)
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 constexpr const char * MYTH_APPNAME_MYTHTV_SETUP
static void eject_cb(void)
void ClearOverrideSettingForSession(const QString &key)
#define QAndroidJniObject
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 Init(bool gui, bool promptForBackend, bool disableAutoDiscovery, bool ignoreDB)
bool IsBackend(void) const
is this process a backend process
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.