MythTV
master
|
Public Slots | |
void | OnCloseDialog () |
Public Member Functions | |
MythContextPrivate (MythContext *lparent) | |
~MythContextPrivate () override | |
bool | Init (bool gui, bool promptForBackend, bool disableAutoDiscovery, bool ignoreDB) |
bool | FindDatabase (bool prompt, bool noAutodetect) |
Get database connection settings and test connectivity. More... | |
void | TempMainWindow (bool languagePrompt=true) |
Setup a minimal themed main window, and prompt for user's language. More... | |
void | EndTempWindow (void) |
bool | LoadDatabaseSettings (void) |
Load database and host settings from config.xml, or set some defaults. More... | |
bool | SaveDatabaseParams (const DatabaseParams ¶ms, bool force) |
bool | PromptForDatabaseParams (const QString &error) |
QString | TestDBconnection (bool prompt=true) |
Some quick sanity checks before opening a database connection. More... | |
void | SilenceDBerrors (void) |
Cause MSqlDatabase::OpenDatabase() and MSqlQuery to fail silently. More... | |
void | EnableDBerrors (void) |
void | ResetDatabase (void) const |
Called when the user changes the DB connection settings. More... | |
int | ChooseBackend (const QString &error) |
Search for backends via UPnP, put up a UI for the user to choose one. More... | |
int | UPnPautoconf (std::chrono::milliseconds milliSeconds=2s) |
If there is only a single UPnP backend, use it. More... | |
bool | DefaultUPnP (QString &Error) |
Get the default backend from config.xml, use UPnP to find it. More... | |
bool | UPnPconnect (const DeviceLocation *backend, const QString &PIN) |
Query a backend via UPnP for its database connection parameters. More... | |
void | ShowGuiStartup (void) |
bool | checkPort (QString &host, int port, std::chrono::seconds timeLimit) const |
Check if a port is open and sort out the link-local scope. More... | |
bool | saveSettingsCache (void) |
void | loadSettingsCacheOverride (void) const |
Static Public Member Functions | |
static void | processEvents (void) |
static void | clearSettingsCacheOverride (void) |
Public Attributes | |
MythContext * | m_parent {nullptr} |
bool | m_gui {false} |
Should this context use GUI elements? More... | |
QString | m_masterhostname |
master backend hostname More... | |
DatabaseParams | m_dbParams |
Current database host & WOL details. More... | |
QString | m_dbHostCp |
dbHostName backup More... | |
Configuration * | m_pConfig {nullptr} |
bool | m_disableeventpopup {false} |
MythUIHelper * | m_ui {nullptr} |
MythContextSlotHandler * | m_sh {nullptr} |
GUIStartup * | m_guiStartup {nullptr} |
QEventLoop * | m_loop {nullptr} |
bool | m_needsBackend {false} |
bool | m_settingsCacheDirty {false} |
Protected Member Functions | |
bool | event (QEvent *) override |
void | ShowConnectionFailurePopup (bool persistent) |
void | HideConnectionFailurePopup (void) |
void | ShowVersionMismatchPopup (uint remote_version) |
Private Attributes | |
MythConfirmationDialog * | m_mbeVersionPopup {nullptr} |
int | m_registration {-1} |
QDateTime | m_lastCheck |
QTcpSocket * | m_socket {nullptr} |
Static Private Attributes | |
static const std::vector< QString > | kSettingsToSave |
Friends | |
class | MythContextSlotHandler |
Definition at line 59 of file mythcontext.cpp.
|
explicit |
Definition at line 236 of file mythcontext.cpp.
|
override |
Definition at line 244 of file mythcontext.cpp.
bool MythContextPrivate::Init | ( | bool | gui, |
bool | promptForBackend, | ||
bool | disableAutoDiscovery, | ||
bool | ignoreDB | ||
) |
Definition at line 327 of file mythcontext.cpp.
Referenced by MythContext::Init().
Get database connection settings and test connectivity.
Can use UPnP AutoDiscovery to locate backends, and get their DB settings. The user can force the AutoDiscovery chooser with the –prompt argument, and disable it by using the –disable-autodiscovery argument. There is also an autoconfigure function, which counts the backends, and if there is exactly one, uses it as above.
Despite its name, the disable argument currently only disables the chooser. If set, autoconfigure will still be attempted in some situations.
Definition at line 403 of file mythcontext.cpp.
Referenced by Init().
Setup a minimal themed main window, and prompt for user's language.
Used for warnings before the database is opened, or bootstrapping pages. After using the window, call EndTempWindow().
Definition at line 270 of file mythcontext.cpp.
Referenced by ChooseBackend(), MythContext::Init(), Init(), PromptForDatabaseParams(), and ShowGuiStartup().
void MythContextPrivate::EndTempWindow | ( | void | ) |
Definition at line 293 of file mythcontext.cpp.
Referenced by ChooseBackend(), Init(), and PromptForDatabaseParams().
bool MythContextPrivate::LoadDatabaseSettings | ( | void | ) |
Load database and host settings from config.xml, or set some defaults.
Definition at line 527 of file mythcontext.cpp.
Referenced by FindDatabase().
bool MythContextPrivate::SaveDatabaseParams | ( | const DatabaseParams & | params, |
bool | force | ||
) |
Definition at line 634 of file mythcontext.cpp.
Referenced by FindDatabase(), and MythContext::SaveDatabaseParams().
bool MythContextPrivate::PromptForDatabaseParams | ( | const QString & | error | ) |
Definition at line 707 of file mythcontext.cpp.
Referenced by FindDatabase().
Some quick sanity checks before opening a database connection.
Definition at line 800 of file mythcontext.cpp.
Referenced by FindDatabase().
void MythContextPrivate::SilenceDBerrors | ( | void | ) |
Cause MSqlDatabase::OpenDatabase() and MSqlQuery to fail silently.
This is used when the DB host address is bad, is non-routable, the passwords are bad, or the DB has some other problem.
It prevents hundreds of long TCP/IP timeouts or DB connect errors.
Definition at line 1086 of file mythcontext.cpp.
Referenced by PromptForDatabaseParams(), TempMainWindow(), and TestDBconnection().
void MythContextPrivate::EnableDBerrors | ( | void | ) |
Definition at line 1101 of file mythcontext.cpp.
Referenced by EndTempWindow(), FindDatabase(), PromptForDatabaseParams(), and TestDBconnection().
void MythContextPrivate::ResetDatabase | ( | void | ) | const |
Called when the user changes the DB connection settings.
The current DB connections may be invalid (e.g. wrong password), or the user may have changed to a different database host. Either way, any current connections need to be closed so that the new connection can be attempted.
Any cached settings also need to be cleared, so that they can be re-read from the new database
Definition at line 1125 of file mythcontext.cpp.
Referenced by FindDatabase(), SaveDatabaseParams(), and TestDBconnection().
int MythContextPrivate::ChooseBackend | ( | const QString & | error | ) |
Search for backends via UPnP, put up a UI for the user to choose one.
Definition at line 1135 of file mythcontext.cpp.
Referenced by FindDatabase().
int MythContextPrivate::UPnPautoconf | ( | std::chrono::milliseconds | milliSeconds = 2s | ) |
If there is only a single UPnP backend, use it.
This does not prompt for PIN entry. If the backend requires one, it will fail, and the caller needs to put up a UI to ask for one.
Definition at line 1162 of file mythcontext.cpp.
Referenced by FindDatabase().
bool MythContextPrivate::DefaultUPnP | ( | QString & | Error | ) |
Get the default backend from config.xml, use UPnP to find it.
Sets a string if there any connection problems
Definition at line 1233 of file mythcontext.cpp.
Referenced by FindDatabase().
bool MythContextPrivate::UPnPconnect | ( | const DeviceLocation * | backend, |
const QString & | PIN | ||
) |
Query a backend via UPnP for its database connection parameters.
Definition at line 1306 of file mythcontext.cpp.
Referenced by DefaultUPnP(), and UPnPautoconf().
void MythContextPrivate::ShowGuiStartup | ( | void | ) |
Definition at line 1056 of file mythcontext.cpp.
Referenced by TestDBconnection().
bool MythContextPrivate::checkPort | ( | QString & | host, |
int | port, | ||
std::chrono::seconds | timeLimit | ||
) | const |
Check if a port is open and sort out the link-local scope.
host | Host or IP address. Will be updated with link-local scope if needed. |
port | Port number to check. |
timeLimit | Limit in seconds for testing. |
Definition at line 318 of file mythcontext.cpp.
Referenced by TestDBconnection().
|
static |
Definition at line 1456 of file mythcontext.cpp.
Referenced by ShowGuiStartup(), and TestDBconnection().
bool MythContextPrivate::saveSettingsCache | ( | void | ) |
Definition at line 1476 of file mythcontext.cpp.
Referenced by MythContext::saveSettingsCache().
void MythContextPrivate::loadSettingsCacheOverride | ( | void | ) | const |
Definition at line 1499 of file mythcontext.cpp.
Referenced by Init().
|
static |
Definition at line 1518 of file mythcontext.cpp.
Referenced by saveSettingsCache().
|
overrideprotected |
Definition at line 1349 of file mythcontext.cpp.
|
protected |
Definition at line 1379 of file mythcontext.cpp.
Referenced by event().
|
protected |
Definition at line 1413 of file mythcontext.cpp.
Referenced by event().
|
protected |
Definition at line 1429 of file mythcontext.cpp.
Referenced by event().
|
slot |
|
friend |
Definition at line 61 of file mythcontext.cpp.
MythContext* MythContextPrivate::m_parent {nullptr} |
Definition at line 109 of file mythcontext.cpp.
Referenced by PromptForDatabaseParams().
Should this context use GUI elements?
Definition at line 112 of file mythcontext.cpp.
Referenced by FindDatabase(), Init(), loadSettingsCacheOverride(), PromptForDatabaseParams(), saveSettingsCache(), ShowGuiStartup(), and TestDBconnection().
QString MythContextPrivate::m_masterhostname |
master backend hostname
Definition at line 114 of file mythcontext.cpp.
DatabaseParams MythContextPrivate::m_dbParams |
Current database host & WOL details.
Definition at line 116 of file mythcontext.cpp.
Referenced by ChooseBackend(), EnableDBerrors(), FindDatabase(), MythContext::GetDatabaseParams(), LoadDatabaseSettings(), ResetDatabase(), SaveDatabaseParams(), SilenceDBerrors(), TestDBconnection(), and UPnPconnect().
QString MythContextPrivate::m_dbHostCp |
dbHostName backup
Definition at line 117 of file mythcontext.cpp.
Referenced by EnableDBerrors(), SilenceDBerrors(), and TestDBconnection().
Configuration* MythContextPrivate::m_pConfig {nullptr} |
Definition at line 119 of file mythcontext.cpp.
Referenced by ChooseBackend(), DefaultUPnP(), Init(), LoadDatabaseSettings(), SaveDatabaseParams(), and ~MythContextPrivate().
Definition at line 121 of file mythcontext.cpp.
Referenced by event(), and MythContext::SetDisableEventPopup().
MythUIHelper* MythContextPrivate::m_ui {nullptr} |
Definition at line 123 of file mythcontext.cpp.
Referenced by Init(), ShowConnectionFailurePopup(), ShowVersionMismatchPopup(), and ~MythContextPrivate().
MythContextSlotHandler* MythContextPrivate::m_sh {nullptr} |
Definition at line 124 of file mythcontext.cpp.
Referenced by PromptForDatabaseParams(), ShowVersionMismatchPopup(), and ~MythContextPrivate().
GUIStartup* MythContextPrivate::m_guiStartup {nullptr} |
Definition at line 125 of file mythcontext.cpp.
Referenced by checkPort(), EndTempWindow(), FindDatabase(), Init(), ShowGuiStartup(), and TestDBconnection().
QEventLoop* MythContextPrivate::m_loop {nullptr} |
Definition at line 126 of file mythcontext.cpp.
Referenced by MythContextPrivate(), MythContextSlotHandler::OnCloseDialog(), PromptForDatabaseParams(), ShowGuiStartup(), TestDBconnection(), and ~MythContextPrivate().
Definition at line 127 of file mythcontext.cpp.
Referenced by Init(), MythContext::MythContext(), and TestDBconnection().
Definition at line 128 of file mythcontext.cpp.
Referenced by MythContext::Init(), and saveSettingsCache().
|
private |
Definition at line 131 of file mythcontext.cpp.
Referenced by ShowVersionMismatchPopup(), and MythContextSlotHandler::VersionMismatchPopupClosed().
|
private |
Definition at line 132 of file mythcontext.cpp.
Referenced by event(), HideConnectionFailurePopup(), ShowConnectionFailurePopup(), and ~MythContextPrivate().
|
private |
Definition at line 133 of file mythcontext.cpp.
Referenced by HideConnectionFailurePopup(), and ShowConnectionFailurePopup().
|
private |
Definition at line 134 of file mythcontext.cpp.
|
staticprivate |
Definition at line 135 of file mythcontext.cpp.
Referenced by clearSettingsCacheOverride(), loadSettingsCacheOverride(), and saveSettingsCache().