MythTV  0.26-pre
Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes | Friends
MythContextPrivate Class Reference

List of all members.

Public Member Functions

 MythContextPrivate (MythContext *lparent)
 ~MythContextPrivate ()
bool Init (const bool gui, const bool prompt, const bool noPrompt, const bool ignoreDB)
bool FindDatabase (const bool prompt, const bool noPrompt)
 Get database connection settings and test connectivity.
void TempMainWindow (bool languagePrompt=true)
 Setup a minimal themed main window, and prompt for user's language.
void EndTempWindow (void)
bool LoadDatabaseSettings (void)
 Load database and host settings from config.xml, or set some defaults.
bool SaveDatabaseParams (const DatabaseParams &params, bool force)
bool PromptForDatabaseParams (const QString &error)
QString TestDBconnection (void)
 Some quick sanity checks before opening a database connection.
void SilenceDBerrors (void)
 Cause MSqlDatabase::OpenDatabase() and MSqlQuery to fail silently.
void EnableDBerrors (void)
void ResetDatabase (void)
 Called when the user changes the DB connection settings.
int ChooseBackend (const QString &error)
 Search for backends via UPnP, put up a UI for the user to choose one.
int UPnPautoconf (const int milliSeconds=2000)
 If there is only a single UPnP backend, use it.
bool DefaultUPnP (QString &error)
 Get the default backend from config.xml, use UPnP to find it.
bool UPnPconnect (const DeviceLocation *device, const QString &PIN)
 Query a backend via UPnP for its database connection parameters.

Public Attributes

MythContextparent
bool m_gui
 Should this context use GUI elements?
QString m_masterhostname
 master backend hostname
DatabaseParams m_DBparams
 Current database host & WOL details.
QString m_DBhostCp
 dbHostName backup
Configurationm_pConfig
bool disableeventpopup
bool disablelibrarypopup
MythPluginManagerpluginmanager
MythUIHelperm_ui
MythContextSlotHandlerm_sh

Protected Member Functions

bool event (QEvent *)
void ShowConnectionFailurePopup (bool persistent)
void HideConnectionFailurePopup (void)
void ConnectFailurePopupClosed (void)
void ShowVersionMismatchPopup (uint remoteVersion)
void VersionMismatchPopupClosed (void)

Private Attributes

MythConfirmationDialogMBEconnectPopup
MythConfirmationDialogMBEversionPopup

Friends

class MythContextSlotHandler

Detailed Description

Definition at line 51 of file mythcontext.cpp.


Constructor & Destructor Documentation

Definition at line 202 of file mythcontext.cpp.

Definition at line 217 of file mythcontext.cpp.


Member Function Documentation

bool MythContextPrivate::Init ( const bool  gui,
const bool  prompt,
const bool  noPrompt,
const bool  ignoreDB 
)

Definition at line 269 of file mythcontext.cpp.

Referenced by MythContext::Init().

bool MythContextPrivate::FindDatabase ( const bool  prompt,
const bool  noPrompt 
)

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 330 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().

Bug:
Some of these settings (e.g. window size, theme) seem to be used after the temp window is destroyed.

Definition at line 237 of file mythcontext.cpp.

Referenced by ChooseBackend(), MythContext::Init(), Init(), and PromptForDatabaseParams().

Definition at line 262 of file mythcontext.cpp.

Referenced by ChooseBackend(), Init(), and PromptForDatabaseParams().

Load database and host settings from config.xml, or set some defaults.

Returns:
true if config.xml was parsed

Definition at line 435 of file mythcontext.cpp.

Referenced by FindDatabase().

Definition at line 505 of file mythcontext.cpp.

Referenced by FindDatabase(), and MythContext::SaveDatabaseParams().

Definition at line 559 of file mythcontext.cpp.

Referenced by FindDatabase().

Some quick sanity checks before opening a database connection.

Todo:
Rationalise the WOL stuff. We should have one method to wake BEs

Definition at line 639 of file mythcontext.cpp.

Referenced by FindDatabase().

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 716 of file mythcontext.cpp.

Referenced by TempMainWindow(), and TestDBconnection().

Definition at line 731 of file mythcontext.cpp.

Referenced by EndTempWindow(), and FindDatabase().

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 755 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 765 of file mythcontext.cpp.

Referenced by FindDatabase().

int MythContextPrivate::UPnPautoconf ( const int  milliSeconds = 2000)

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 792 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 860 of file mythcontext.cpp.

Referenced by FindDatabase().

bool MythContextPrivate::UPnPconnect ( const DeviceLocation device,
const QString &  PIN 
)

Query a backend via UPnP for its database connection parameters.

Definition at line 932 of file mythcontext.cpp.

Referenced by DefaultUPnP(), and UPnPautoconf().

bool MythContextPrivate::event ( QEvent *  e) [protected]

Definition at line 975 of file mythcontext.cpp.

Definition at line 997 of file mythcontext.cpp.

Referenced by event().

Definition at line 1019 of file mythcontext.cpp.

Referenced by event().

void MythContextPrivate::ShowVersionMismatchPopup ( uint  remoteVersion) [protected]

Definition at line 1028 of file mythcontext.cpp.

Referenced by event().


Friends And Related Function Documentation

friend class MythContextSlotHandler [friend]

Definition at line 53 of file mythcontext.cpp.


Member Data Documentation

Definition at line 92 of file mythcontext.cpp.

Referenced by PromptForDatabaseParams().

Should this context use GUI elements?

Definition at line 94 of file mythcontext.cpp.

Referenced by FindDatabase(), Init(), and PromptForDatabaseParams().

master backend hostname

Definition at line 96 of file mythcontext.cpp.

dbHostName backup

Definition at line 99 of file mythcontext.cpp.

Referenced by EnableDBerrors(), PromptForDatabaseParams(), and SilenceDBerrors().

Definition at line 103 of file mythcontext.cpp.

Referenced by event(), and MythContext::SetDisableEventPopup().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends