Go to the documentation of this file.
9 #include <QCoreApplication>
19 #include <QtAndroidExtras>
53 #define LOC QString("MythContext: ")
55 #if QT_VERSION < QT_VERSION_CHECK(5,10,0)
56 #define qEnvironmentVariable getenv
72 bool promptForBackend,
73 bool disableAutoDiscovery,
90 int UPnPautoconf(std::chrono::milliseconds milliSeconds = 2s);
94 bool checkPort(QString &host,
int port, std::chrono::seconds timeLimit)
const;
102 bool event(QEvent* )
override;
150 QStringList tokens = cmd.simplified().split(
" ");
153 bool cardidok =
false;
154 int wantcardid = tokens[0].toInt(&cardidok, 10);
156 if (cardidok && wantcardid > 0)
158 strlist << QString(
"LOCK_TUNER %1").arg(wantcardid);
159 s = s.replace(0, tokens[0].length() + 1,
"");
162 strlist <<
"LOCK_TUNER";
165 int cardid = strlist[0].toInt();
169 s = s.arg(qPrintable(strlist[1]),
170 qPrintable(strlist[2]),
171 qPrintable(strlist[3]));
175 strlist = QStringList(QString(
"FREE_TUNER %1").arg(cardid));
186 label = QObject::tr(
"Could not find specified tuner (%1).")
191 label = QObject::tr(
"Specified tuner (%1) is already in use.")
197 label = QObject::tr(
"All tuners are currently in use. If you want "
198 "to watch TV, you can cancel one of the "
199 "in-progress recordings from the delete menu");
202 LOG(VB_GENERAL, LOG_ALERT, QString(
"exec_program_tv: ") + label);
217 QObject::tr(
"Failed to configure plugin"));
231 QObject::tr(
"%1 failed to run for some reason").arg(cmd));
244 m_loop =
new QEventLoop(
this);
327 return checker.
checkPort(host, port, timeLimit);
332 const bool promptForBackend,
333 const bool disableAutoDiscovery,
352 if (!ignoreDB && !
FindDatabase(promptForBackend, disableAutoDiscovery))
410 bool manualSelect = prompt && !noAutodetect;
421 bool autoSelect = !manualSelect && !loaded && !noAutodetect;
431 autoSelect = manualSelect =
false;
433 if (!failure.isEmpty())
434 LOG(VB_GENERAL, LOG_ALERT, failure);
437 if (failure.isEmpty())
451 failure = QObject::tr(
"No UPnP backends found",
"Backend Setup");
456 if (failure.isEmpty())
463 manualSelect |= (count > 1 || count == -1);
469 manualSelect &=
m_gui;
483 manualSelect =
false;
496 if (!failure.isEmpty())
497 LOG(VB_GENERAL, LOG_ALERT, failure);
505 while (!failure.isEmpty());
508 LOG(VB_GENERAL, LOG_DEBUG,
"FindDatabase() - Success!");
524 LOG(VB_GENERAL, LOG_DEBUG,
"FindDatabase() - failed");
577 hostname ==
"my-unique-identifier-goes-here")
579 QString localhostname = QHostInfo::localHostName();
580 if (localhostname.isEmpty())
582 LOG(VB_GENERAL, LOG_ALERT,
583 "MCP: Error, could not determine host name." +
ENO);
586 #define ANDROID_EXCEPTION_CHECK \
587 if (env->ExceptionCheck()) { \
588 env->ExceptionClear(); \
592 if ((localhostname ==
"localhost") || localhostname.isEmpty())
595 bool exception=
false;
596 QAndroidJniEnvironment env;
598 QAndroidJniObject activity = QtAndroid::androidActivity();
600 QAndroidJniObject appctx = activity.callObjectMethod
601 (
"getApplicationContext",
"()Landroid/content/Context;");
603 QAndroidJniObject contentR = appctx.callObjectMethod
604 (
"getContentResolver",
"()Landroid/content/ContentResolver;");
606 QAndroidJniObject androidId = QAndroidJniObject::callStaticObjectMethod
607 (
"android/provider/Settings$Secure",
"getString",
608 "(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;",
609 contentR.object<jobject>(),
610 myID.object<jstring>());
613 LOG(VB_GENERAL, LOG_ALERT,
614 "Java exception looking for android id");
616 hostname = QString(
"android-%1").arg(androidId.toString());
623 LOG(VB_GENERAL, LOG_INFO,
"Empty LocalHostName. This is typical.");
630 LOG(VB_GENERAL, LOG_INFO, QString(
"Using a profile name of: '%1' (Usually the "
631 "same as this host's name.)")
657 if (addr.setAddress(dbHostName))
659 addr.setScopeId(QString());
660 dbHostName = addr.toString();
713 bool accepted =
false;
719 if (!
error.isEmpty())
747 std::this_thread::sleep_for(1s);
749 std::cout << std::endl <<
error.toLocal8Bit().constData() << std::endl << std::endl;
750 response =
getResponse(
"Would you like to configure the database "
753 if (!response.startsWith(
'y', Qt::CaseInsensitive))
758 response =
getResponse(
"Should I test connectivity to this host "
759 "using the ping command?",
"yes");
760 params.
m_dbHostPing = response.startsWith(
'y', Qt::CaseInsensitive);
772 "(if empty, the local host name "
777 response =
getResponse(
"Would you like to use Wake-On-LAN to retry "
778 "database connections?",
780 params.
m_wolEnabled = response.startsWith(
'y', Qt::CaseInsensitive);
785 std::chrono::seconds(
intResponse(
"Seconds to wait for "
826 } startupState = st_start;
828 static const std::array<const QString,7> kGuiStatuses
829 {
"start",
"dbAwake",
"dbStarted",
"dbConnects",
"beWOL",
"beAwake",
833 auto msStartupScreenDelay = std::chrono::duration_cast<std::chrono::milliseconds>(secondsStartupScreenDelay);
845 std::chrono::seconds wakeupTime = 3s;
850 startupState = st_start;
853 startupState = st_dbAwake;
861 std::chrono::seconds progressTotal = wakeupTime * attempts;
866 QString beWOLCmd = QString();
867 QString backendIP = QString();
869 QString masterserver;
871 for (
int attempt = 0;
872 attempt < attempts && startupState != st_success;
879 LOG(VB_GENERAL, LOG_INFO,
880 QString(
"Start up testing connections. DB %1, BE %2, attempt %3, status %4, Delay: %5")
881 .arg(host, backendIP, QString::number(attempt),
882 kGuiStatuses[startupState],
883 QString::number(msStartupScreenDelay.count())) );
885 std::chrono::seconds useTimeout = wakeupTime;
891 if (msStartupScreenDelay==0ms || timer.hasExpired(msStartupScreenDelay.count()))
905 switch (startupState) {
914 startupState = st_dbAwake;
915 [[clang::fallthrough]];
919 startupState = st_dbStarted;
920 [[clang::fallthrough]];
933 for (std::chrono::seconds temp = 0s; temp < useTimeout * 2 ; temp++)
936 std::this_thread::sleep_for(500ms);
940 startupState = st_dbConnects;
941 [[clang::fallthrough]];
946 if (!beWOLCmd.isEmpty())
949 (
"WOLbackendReconnectWaitTime", 0s);
951 (
"WOLbackendConnectRetry", 0);
952 useTimeout = wakeupTime;
955 progressTotal = wakeupTime * attempts;
958 startupState = st_beWOL;
962 startupState = st_success;
966 (
"MasterServerName");
968 (
"BackendServerAddr", masterserver);
970 [[clang::fallthrough]];
972 if (!beWOLCmd.isEmpty()) {
975 if (!
checkPort(backendIP, backendPort, useTimeout))
978 startupState = st_beAwake;
979 [[clang::fallthrough]];
981 if (!
checkPort(backendIP, backendPort, useTimeout))
983 startupState = st_success;
984 [[clang::fallthrough]];
999 if (startupState == st_success)
1002 QString stateMsg = kGuiStatuses[startupState];
1003 stateMsg.append(
"Fail");
1004 LOG(VB_GENERAL, LOG_INFO,
1005 QString(
"Start up failure. host %1, status %2")
1006 .arg(host, stateMsg));
1029 if (startupState < st_dbAwake)
1031 LOG(VB_GENERAL, LOG_WARNING, QString(
"Pinging to %1 failed, database will be unavailable").arg(host));
1034 "Cannot find (ping) database host %1 on the network",
1036 return err.arg(host);
1039 if (startupState < st_dbConnects)
1042 return QObject::tr(
"Cannot login to database",
"Backend Setup");
1045 if (startupState < st_success)
1047 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");
1168 auto seconds = duration_cast<std::chrono::seconds>(milliSeconds);
1169 LOG(VB_GENERAL, LOG_INFO, QString(
"UPNP Search %1 secs")
1170 .arg(seconds.count()));
1178 while (totalTime.
elapsed() < milliSeconds)
1181 auto ttl = milliSeconds - totalTime.
elapsed();
1182 if ((searchTime.
elapsed() > 249ms) && (ttl > 1s))
1184 auto ttlSeconds = duration_cast<std::chrono::seconds>(ttl);
1185 LOG(VB_GENERAL, LOG_INFO, QString(
"UPNP Search %1 secs")
1186 .arg(ttlSeconds.count()));
1196 LOG(VB_GENERAL, LOG_INFO,
"No UPnP backends found");
1200 int count = backends->
Count();
1203 LOG(VB_GENERAL, LOG_INFO,
1204 QString(
"Found %1 UPnP backends").arg(count));
1208 LOG(VB_GENERAL, LOG_ERR,
1209 "No UPnP backends found, but SSDP::Find() not NULL");
1239 static const QString loc =
"DefaultUPnP() - ";
1245 LOG(VB_UPNP, LOG_INFO, loc +
"No default UPnP backend");
1249 LOG(VB_UPNP, LOG_INFO, loc + QString(
"config.xml has default PIN '%1' and host USN: %2")
1254 std::chrono::milliseconds timeout_ms { 2s };
1255 auto timeout_s = duration_cast<std::chrono::seconds>(timeout_ms);
1256 LOG(VB_GENERAL, LOG_INFO, loc + QString(
"UPNP Search up to %1 secs")
1257 .arg(timeout_s.count()));
1269 while (totalTime.
elapsed() < timeout_ms)
1277 auto ttl = timeout_ms - totalTime.
elapsed();
1278 if ((searchTime.
elapsed() > 249ms) && (ttl > 1s))
1280 auto ttlSeconds = duration_cast<std::chrono::seconds>(ttl);
1281 LOG(VB_GENERAL, LOG_INFO, loc + QString(
"UPNP Search up to %1 secs")
1282 .arg(ttlSeconds.count()));
1290 if (!devicelocation)
1292 Error =
"Cannot find default UPnP backend";
1303 Error =
"Cannot connect to default backend via UPnP. Wrong saved PIN?";
1314 QString loc =
"UPnPconnect() - ";
1318 LOG(VB_UPNP, LOG_INFO, loc + QString(
"Trying host at %1").arg(URL));
1323 LOG(VB_UPNP, LOG_INFO, loc +
1331 LOG(VB_UPNP, LOG_ERR, loc +
"Wrong PIN?");
1335 LOG(VB_UPNP, LOG_ERR, loc +
error);
1343 URL = theURL.host();
1347 LOG(VB_UPNP, LOG_INFO,
"Trying default DB credentials at " + URL);
1369 if (me->Message() ==
"VERSION_MISMATCH" && (1 == me->ExtraDataCount()))
1371 else if (me->Message() ==
"CONNECTION_FAILURE")
1373 else if (me->Message() ==
"PERSISTENT_CONNECTION_FAILURE")
1375 else if (me->Message() ==
"CONNECTION_RESTABLISHED")
1380 return QObject::event(e);
1400 QString description = (persistent) ?
1402 "The connection to the master backend "
1403 "server has gone away for some reason. "
1406 "Could not connect to the master backend server. Is "
1407 "it running? Is the IP address set for it in "
1408 "mythtv-setup correct?");
1410 QString message = QObject::tr(
"Could not connect to master backend");
1440 "The server uses network protocol version %1, "
1441 "but this client only understands version %2. "
1442 "Make sure you are running compatible versions of "
1443 "the backend and frontend.")
1453 LOG(VB_GENERAL, LOG_ERR,
LOC + message);
1465 qApp->processEvents(QEventLoop::AllEvents, 250);
1466 qApp->processEvents(QEventLoop::AllEvents, 250);
1474 {
"Theme",
"Language",
"Country",
"GuiHeight",
1475 "GuiOffsetX",
"GuiOffsetY",
"GuiWidth",
"RunFrontendInWindow",
1476 "AlwaysOnTop",
"HideMouseCursor",
"ThemePainter",
"libCECEnabled",
1477 "StartupScreenDelay" };
1484 QString cacheDirName =
GetConfDir() +
"/cache/";
1485 QDir dir(cacheDirName);
1486 dir.mkpath(cacheDirName);
1490 QString cacheValue = config.
GetValue(
"Settings/"+setting,QString());
1493 if (value != cacheValue)
1495 config.
SetValue(
"Settings/"+setting,value);
1500 return config.
Save();
1512 QString value = config.
GetValue(
"Settings/"+setting,QString());
1513 if (!value.isEmpty())
1542 : m_appBinaryVersion(
std::move(binversion))
1545 static bool WSAStarted =
false;
1548 int res = WSAStartup(MAKEWORD(2, 0), &wsadata);
1549 LOG(VB_SOCKET, LOG_INFO,
1550 QString(
"WSAStartup returned %1").arg(res));
1561 LOG(VB_GENERAL, LOG_EMERG,
LOC +
"Unable to allocate MythCoreContext");
1567 const bool promptForBackend,
1568 const bool disableAutoDiscovery,
1569 const bool ignoreDB)
1573 LOG(VB_GENERAL, LOG_EMERG,
LOC +
"Init() Out-of-memory");
1577 qRegisterMetaType<std::chrono::seconds>(
"std::chrono::seconds");
1578 qRegisterMetaType<std::chrono::milliseconds>(
"std::chrono::milliseconds");
1579 qRegisterMetaType<std::chrono::microseconds>(
"std::chrono::microseconds");
1585 LOG(VB_GENERAL, LOG_EMERG,
1586 QString(
"Application binary version (%1) does not "
1587 "match libraries (%2)")
1590 QString warning = QObject::tr(
1591 "This application is not compatible "
1592 "with the installed MythTV libraries.");
1598 LOG(VB_GENERAL, LOG_WARNING, warning);
1606 QString home = getenv(
"HOME");
1609 home = getenv(
"LOCALAPPDATA");
1611 home = getenv(
"APPDATA");
1613 home = QString(
".");
1615 _putenv(QString(
"HOME=%1").arg(home).toLocal8Bit().constData());
1621 QString homedir = QDir::homePath();
1622 QString
confdir = qEnvironmentVariable(
"MYTHCONFDIR");
1623 if ((homedir.isEmpty() || homedir ==
"/") &&
1626 QString warning =
"Cannot locate your home directory."
1627 " Please set the environment variable HOME";
1633 LOG(VB_GENERAL, LOG_WARNING, warning);
1638 if (!
d->
Init(gui, promptForBackend, disableAutoDiscovery, ignoreDB))
1647 #ifndef Q_OS_ANDROID
1662 LOG(VB_GENERAL, LOG_INFO,
"Waiting for threads to exit.");
1668 LOG(VB_GENERAL, LOG_INFO,
"Exiting");
std::enable_if< std::chrono::__is_duration< T >::value, T >::type GetDuration(const QString &sSetting, T defaultval=T::zero())
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)
std::enable_if< std::chrono::__is_duration< T >::value, void >::type SetDuration(const QString &sSetting, T value)
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.
static const std::vector< QString > kSettingsToSave
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 config.xml, use UPnP to find it.
DatabaseParams GetDatabaseParams(void)
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.
int GetValue(const QString &sSetting, int Default) override
static MythMainWindow * getMainWindow(bool UseDB=true)
Return the existing main window, or create one.
bool saveSettingsCache(void)
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)
virtual void ClearValue(const QString &sSetting)=0
int m_dbPort
database port
virtual void SetValue(const QString &sSetting, int value)=0
void CloseDatabases(void)
bool m_settingsCacheDirty
void SetValue(const QString &sSetting, int value) override
bool m_dbHostPing
Can we test connectivity using ping?
static void configplugin_cb(const QString &cmd)
Configuration * m_pConfig
void SetParent(void *Parent)
Contains the parent address. Required if id is set Id provided must match the parent address as provi...
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)
int ChooseBackend(const QString &error)
Search for backends via UPnP, put up a UI for the user to choose one.
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)
virtual bool GetBoolValue(const QString &sSetting, bool Default)=0
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
static void clearSettingsCacheOverride(void)
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 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.
#define MYTH_BINARY_VERSION
Update this whenever the plug-in ABI changes.
MythContextSlotHandler * m_sh
static int GetMasterServerPort(void)
Returns the Master Backend control port If no master server port has been defined in the database,...
#define MYTH_PROTO_VERSION
Increment this whenever the MythTV network protocol changes.
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.
Dialog asking for user confirmation. Ok and optional Cancel button.
bool LoadDatabaseSettings(void)
Load database and host settings from config.xml, 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)
virtual bool Save(void)=0
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.
#define GENERIC_EXIT_SOCKET_ERROR
Socket error.
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
#define GENERIC_EXIT_NO_MYTHCONTEXT
No MythContext available.
MythMainWindow * GetMythMainWindow(void)
virtual int GetValue(const QString &sSetting, int Default)=0
static Decision Prompt(DatabaseParams *dbParams, Configuration *pConfig)
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
static const iso6937table * d
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()
const QString kDefaultMFE
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)
void loadSettingsCacheOverride(void) const
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.
virtual void SetBoolValue(const QString &sSetting, bool value)=0