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: ")
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"};
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,
"");
192 strlist <<
"LOCK_TUNER";
196 int cardid = strlist[0].toInt();
200 s = s.arg(qPrintable(strlist[1]),
201 qPrintable(strlist[2]),
202 qPrintable(strlist[3]));
206 strlist = QStringList(QString(
"FREE_TUNER %1").arg(cardid));
217 label = QObject::tr(
"Could not find specified tuner (%1).")
222 label = QObject::tr(
"Specified tuner (%1) is already in use.")
228 label = QObject::tr(
"All tuners are currently in use. If you want "
229 "to watch TV, you can cancel one of the "
230 "in-progress recordings from the delete menu");
233 LOG(VB_GENERAL, LOG_ALERT, QString(
"exec_program_tv: ") + label);
248 QObject::tr(
"Failed to configure plugin"));
262 QObject::tr(
"%1 failed to run for some reason").arg(cmd));
274 m_loop(new QEventLoop(this))
358 return checker.
checkPort(host, port, timeLimit);
363 const bool promptForBackend,
364 const bool disableAutoDiscovery,
383 if (!ignoreDB && !
FindDatabase(promptForBackend, disableAutoDiscovery))
442 bool manualSelect = prompt && !noAutodetect;
453 bool autoSelect = !manualSelect && !loaded && !noAutodetect;
463 autoSelect = manualSelect =
false;
465 if (!failure.isEmpty())
466 LOG(VB_GENERAL, LOG_ALERT, failure);
469 if (failure.isEmpty())
483 failure = QObject::tr(
"No UPnP backends found",
"Backend Setup");
488 if (failure.isEmpty())
495 manualSelect |= (count > 1 || count == -1);
501 manualSelect &=
m_gui;
514 manualSelect =
false;
531 if (!failure.isEmpty())
532 LOG(VB_GENERAL, LOG_ALERT, failure);
540 while (!failure.isEmpty());
543 LOG(VB_GENERAL, LOG_DEBUG,
"FindDatabase() - Success!");
559 LOG(VB_GENERAL, LOG_DEBUG,
"FindDatabase() - failed");
582 config.GetDuration<std::chrono::seconds>(
kDefaultWOL +
"SQLReconnectWaitTime", 0s);
595 hostname ==
"my-unique-identifier-goes-here")
597 LOG(VB_GENERAL, LOG_INFO,
"Empty LocalHostName. This is typical.");
598 hostname = QHostInfo::localHostName();
603 LOG(VB_GENERAL, LOG_ALERT,
604 "MCP: Error, could not determine host name." +
ENO);
606 #else //elif defined Q_OS_ANDROID
607 #define ANDROID_EXCEPTION_CHECK \
608 if (env->ExceptionCheck()) \
610 env->ExceptionClear(); \
617 bool exception=
false;
620 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
623 QJniObject activity = QNativeInterface::QAndroidApplication::context();
627 (
"getApplicationContext",
"()Landroid/content/Context;");
630 (
"getContentResolver",
"()Landroid/content/ContentResolver;");
633 (
"android/provider/Settings$Secure",
"getString",
634 "(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;",
635 contentR.object<jobject>(),
636 myID.object<jstring>());
639 LOG(VB_GENERAL, LOG_ALERT,
640 "Java exception looking for android id");
642 hostname = QString(
"android-%1").arg(androidId.toString());
652 LOG(VB_GENERAL, LOG_INFO, QString(
"Using a profile name of: '%1' (Usually the "
653 "same as this host's name.)")
683 if (addr.setAddress(dbHostName))
685 addr.setScopeId(QString());
686 dbHostName = addr.toString();
688 config.SetValue(
kDefaultDB +
"Host", dbHostName);
701 success = config.Save();
727 bool accepted =
false;
733 if (!
error.isEmpty())
763 std::this_thread::sleep_for(1s);
765 std::cout << std::endl <<
error.toLocal8Bit().constData() << std::endl << std::endl;
766 response =
getResponse(
"Would you like to configure the database "
769 if (!response.startsWith(
'y', Qt::CaseInsensitive))
774 response =
getResponse(
"Should I test connectivity to this host "
775 "using the ping command?",
"yes");
776 params.
m_dbHostPing = response.startsWith(
'y', Qt::CaseInsensitive);
788 "(if empty, the local host name "
793 response =
getResponse(
"Would you like to use Wake-On-LAN to retry "
794 "database connections?",
796 params.
m_wolEnabled = response.startsWith(
'y', Qt::CaseInsensitive);
801 std::chrono::seconds(
intResponse(
"Seconds to wait for "
834 enum startupStates : std::uint8_t {
842 } startupState = st_start;
844 static const std::array<const QString, 7> kGuiStatuses
845 {
"start",
"dbAwake",
"dbStarted",
"dbConnects",
"beWOL",
"beAwake",
"success"};
848 auto msStartupScreenDelay = std::chrono::duration_cast<std::chrono::milliseconds>(secondsStartupScreenDelay);
860 std::chrono::seconds wakeupTime = 3s;
866 startupState = st_start;
870 startupState = st_dbAwake;
872 attempts = std::max(attempts, 6);
878 std::chrono::seconds progressTotal = wakeupTime * attempts;
883 QString beWOLCmd = QString();
884 QString backendIP = QString();
886 QString masterserver;
888 for (
int attempt = 0;
889 attempt < attempts && startupState != st_success;
896 LOG(VB_GENERAL, LOG_INFO,
897 QString(
"Start up testing connections. DB %1, BE %2, attempt %3, status %4, Delay: %5")
898 .arg(host, backendIP, QString::number(attempt),
899 kGuiStatuses[startupState],
900 QString::number(msStartupScreenDelay.count())) );
902 std::chrono::seconds useTimeout = wakeupTime;
908 if (msStartupScreenDelay==0ms || timer.hasExpired(msStartupScreenDelay.count()))
922 switch (startupState)
932 startupState = st_dbAwake;
937 startupState = st_dbStarted;
951 for (std::chrono::seconds temp = 0s; temp < useTimeout * 2 ; temp++)
954 std::this_thread::sleep_for(500ms);
958 startupState = st_dbConnects;
964 if (!beWOLCmd.isEmpty())
967 (
"WOLbackendReconnectWaitTime", 0s);
969 (
"WOLbackendConnectRetry", 0);
970 useTimeout = wakeupTime;
973 progressTotal = wakeupTime * attempts;
976 startupState = st_beWOL;
981 startupState = st_success;
985 (
"MasterServerName");
987 (
"BackendServerAddr", masterserver);
991 if (!beWOLCmd.isEmpty())
995 if (!
checkPort(backendIP, backendPort, useTimeout))
998 startupState = st_beAwake;
1001 if (!
checkPort(backendIP, backendPort, useTimeout))
1003 startupState = st_success;
1019 if (startupState == st_success)
1022 QString stateMsg = kGuiStatuses[startupState];
1023 stateMsg.append(
"Fail");
1024 LOG(VB_GENERAL, LOG_INFO,
1025 QString(
"Start up failure. host %1, status %2")
1026 .arg(host, stateMsg));
1049 if (startupState < st_dbAwake)
1051 LOG(VB_GENERAL, LOG_WARNING, QString(
"Pinging to %1 failed, database will be unavailable").arg(host));
1054 "Cannot find (ping) database host %1 on the network",
1056 return err.arg(host);
1059 if (startupState < st_dbConnects)
1062 return QObject::tr(
"Cannot login to database",
"Backend Setup");
1065 if (startupState < st_success)
1067 return QObject::tr(
"Cannot connect to backend",
"Backend Setup");
1168 if (!
error.isEmpty())
1170 LOG(VB_GENERAL, LOG_ERR, QString(
"Error: %1").arg(
error));
1174 LOG(VB_GENERAL, LOG_INFO,
"Putting up the UPnP backend chooser");
1193 auto seconds = duration_cast<std::chrono::seconds>(milliSeconds);
1194 LOG(VB_GENERAL, LOG_INFO, QString(
"UPNP Search %1 secs")
1195 .arg(seconds.count()));
1203 while (totalTime.
elapsed() < milliSeconds)
1206 auto ttl = milliSeconds - totalTime.
elapsed();
1207 if ((searchTime.
elapsed() > 249ms) && (ttl > 1s))
1209 auto ttlSeconds = duration_cast<std::chrono::seconds>(ttl);
1210 LOG(VB_GENERAL, LOG_INFO, QString(
"UPNP Search %1 secs")
1211 .arg(ttlSeconds.count()));
1221 LOG(VB_GENERAL, LOG_INFO,
"No UPnP backends found");
1225 int count = backends->
Count();
1228 LOG(VB_GENERAL, LOG_INFO,
1229 QString(
"Found %1 UPnP backends").arg(count));
1233 LOG(VB_GENERAL, LOG_ERR,
1234 "No UPnP backends found, but SSDP::Find() not NULL");
1264 static const QString loc =
"DefaultUPnP() - ";
1277 LOG(VB_UPNP, LOG_INFO, loc +
"No default UPnP backend");
1281 LOG(VB_UPNP, LOG_INFO,
1283 QString(
" has default PIN '%1' and host USN: %2").arg(pin, usn));
1287 std::chrono::milliseconds timeout_ms {2s};
1288 auto timeout_s = duration_cast<std::chrono::seconds>(timeout_ms);
1289 LOG(VB_GENERAL, LOG_INFO, loc + QString(
"UPNP Search up to %1 secs")
1290 .arg(timeout_s.count()));
1302 while (totalTime.
elapsed() < timeout_ms)
1310 auto ttl = timeout_ms - totalTime.
elapsed();
1311 if ((searchTime.
elapsed() > 249ms) && (ttl > 1s))
1313 auto ttlSeconds = duration_cast<std::chrono::seconds>(ttl);
1314 LOG(VB_GENERAL, LOG_INFO, loc + QString(
"UPNP Search up to %1 secs")
1315 .arg(ttlSeconds.count()));
1323 if (!devicelocation)
1325 Error =
"Cannot find default UPnP backend";
1336 Error =
"Cannot connect to default backend via UPnP. Wrong saved PIN?";
1347 QString loc =
"UPnPconnect() - ";
1351 LOG(VB_UPNP, LOG_INFO, loc + QString(
"Trying host at %1").arg(URL));
1356 LOG(VB_UPNP, LOG_INFO, loc +
1364 LOG(VB_UPNP, LOG_ERR, loc +
"Wrong PIN?");
1368 LOG(VB_UPNP, LOG_ERR, loc +
error);
1376 URL = theURL.host();
1380 LOG(VB_UPNP, LOG_INFO,
"Trying default DB credentials at " + URL);
1402 if (me->Message() ==
"VERSION_MISMATCH" && (1 == me->ExtraDataCount()))
1404 else if (me->Message() ==
"CONNECTION_FAILURE")
1406 else if (me->Message() ==
"PERSISTENT_CONNECTION_FAILURE")
1408 else if (me->Message() ==
"CONNECTION_RESTABLISHED")
1413 return QObject::event(e);
1433 QString description = (persistent) ?
1435 "The connection to the master backend "
1436 "server has gone away for some reason. "
1439 "Could not connect to the master backend server. Is "
1440 "it running? Is the IP address set for it in "
1441 "mythtv-setup correct?");
1443 QString message = QObject::tr(
"Could not connect to master backend");
1473 "The server uses network protocol version %1, "
1474 "but this client only understands version %2. "
1475 "Make sure you are running compatible versions of "
1476 "the backend and frontend.")
1477 .arg(remote_version).arg(MYTH_PROTO_VERSION);
1486 LOG(VB_GENERAL, LOG_ERR,
LOC + message);
1498 qApp->processEvents(QEventLoop::AllEvents, 250);
1499 qApp->processEvents(QEventLoop::AllEvents, 250);
1508 const std::array<QString, 13> GUISettingsCache::kSettings
1509 {
"Theme",
"Language",
"Country",
"GuiHeight",
1510 "GuiOffsetX",
"GuiOffsetY",
"GuiWidth",
"RunFrontendInWindow",
1511 "AlwaysOnTop",
"HideMouseCursor",
"ThemePainter",
"libCECEnabled",
1512 "StartupScreenDelay" };
1515 bool GUISettingsCache::save()
1517 QString cacheDirName =
GetConfDir() +
'/' + m_cachePath;
1518 QDir dir(cacheDirName);
1519 dir.mkpath(cacheDirName);
1522 for (
const auto & setting : kSettings)
1524 QString cacheValue = config.
GetValue(
"Settings/" + setting, QString());
1527 if (value != cacheValue)
1529 config.
SetValue(
"Settings/" + setting, value);
1537 #ifndef Q_OS_ANDROID
1540 return config.
Save();
1545 void GUISettingsCache::loadOverrides()
const
1548 for (
const auto & setting : kSettings)
1552 QString value = config.GetValue(
"Settings/" + setting, QString());
1553 if (!value.isEmpty())
1562 void GUISettingsCache::clearOverrides()
1565 for (
const auto & setting : kSettings)
1584 m_appBinaryVersion(std::move(binversion))
1587 static bool WSAStarted =
false;
1591 int res = WSAStartup(MAKEWORD(2, 0), &wsadata);
1592 LOG(VB_SOCKET, LOG_INFO,
1593 QString(
"WSAStartup returned %1").arg(res));
1603 LOG(VB_GENERAL, LOG_EMERG,
LOC +
"Unable to allocate MythCoreContext");
1609 const bool promptForBackend,
1610 const bool disableAutoDiscovery,
1611 const bool ignoreDB)
1615 LOG(VB_GENERAL, LOG_EMERG,
LOC +
"Init() Out-of-memory");
1619 qRegisterMetaType<std::chrono::seconds>(
"std::chrono::seconds");
1620 qRegisterMetaType<std::chrono::milliseconds>(
"std::chrono::milliseconds");
1621 qRegisterMetaType<std::chrono::microseconds>(
"std::chrono::microseconds");
1628 QString warning = QObject::tr(
"mythtv-setup is deprecated.\n"
1629 "To set up MythTV, start mythbackend and use:\n"
1630 "http://localhost:6544/setupwizard");
1636 LOG(VB_GENERAL, LOG_EMERG,
1637 QString(
"Application binary version (%1) does not "
1638 "match libraries (%2)")
1641 QString warning = QObject::tr(
1642 "This application is not compatible "
1643 "with the installed MythTV libraries.");
1649 LOG(VB_GENERAL, LOG_WARNING, warning);
1657 QString home = getenv(
"HOME");
1660 home = getenv(
"LOCALAPPDATA");
1662 home = getenv(
"APPDATA");
1664 home = QString(
".");
1666 _putenv(QString(
"HOME=%1").arg(home).toLocal8Bit().constData());
1672 QString homedir = QDir::homePath();
1673 QString
confdir = qEnvironmentVariable(
"MYTHCONFDIR");
1674 if ((homedir.isEmpty() || homedir ==
"/") &&
1677 QString warning =
"Cannot locate your home directory."
1678 " Please set the environment variable HOME";
1684 LOG(VB_GENERAL, LOG_WARNING, warning);
1689 if (!
d->
Init(gui, promptForBackend, disableAutoDiscovery, ignoreDB))
1711 LOG(VB_GENERAL, LOG_INFO,
"Waiting for threads to exit.");
1717 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
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)
bool m_dbHostPing
No longer used.
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...
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.
static const std::array< QString, 13 > kSettings
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
static const iso6937table * d
bool IsWOLAllowed() const
bool m_wolEnabled
true if wake-on-lan params are used
GUISettingsCache(const QString &cache_filename, QString cache_path)
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
@ GENERIC_EXIT_SOCKET_ERROR
Socket error.
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)
@ GENERIC_EXIT_NO_MYTHCONTEXT
No MythContext available.
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.