MythContextPrivate Class Reference

List of all members.


Detailed Description

Definition at line 178 of file mythcontext.cpp.


Public Member Functions

 MythContextPrivate (MythContext *lparent)
 ~MythContextPrivate ()
bool Init (const bool gui, UPnp *UPnPclient, const bool prompt, const bool noPrompt)
bool FindDatabase (const bool prompt, const bool noPrompt)
 Get database connection settings and test connectivity.
bool IsWideMode () const
void SetWideMode ()
bool IsSquareMode () const
void SetSquareMode ()
void TempMainWindow (bool languagePrompt=true)
 Setup a minimal themed main window, and prompt for user's language.
void EndTempWindow (void)
void GetScreenBounds (void)
 Get screen size from Qt, respecting for user's multiple screen prefs.
void StoreGUIsettings (void)
 Apply any user overrides to the screen geometry.
void LoadLogSettings (void)
void LoadDatabaseSettings (void)
 Load database and host settings from mysql.txt, or set some defaults.
bool LoadSettingsFile (void)
 Load mysql.txt and parse its values into m_DBparams.
bool WriteSettingsFile (const DatabaseParams &params, bool overwrite=false)
bool FindSettingsProbs (void)
QString getResponse (const QString &query, const QString &def)
int intResponse (const QString &query, int def)
bool PromptForDatabaseParams (const QString &error)
QString TestDBconnection (void)
 Some quick sanity checks before opening a database connection.
void ResetDatabase (void)
 Called when the user changes the DB connection settings.
bool InitUPnP (void)
void DeleteUPnP (void)
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.
void StoreConnectionInfo (void)
 Try to store the current location of this backend in config.xml.
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
Settingsm_settings
 connection stuff, theme, button style
Settingsm_qtThemeSettings
 everything else theme-related
QString m_installprefix
 Compile-time RUNPREFIX, or generated from enviroment ($MYTHTVDIR or $cwd).
QString m_libname
 Compile-time LIBDIRNAME.
bool m_gui
 Should this context use GUI elements?
bool m_backend
 Is this host any sort of backend?
bool m_themeloaded
 To we have a palette and pixmap to use?
QString m_menuthemepathname
QString m_themepathname
QPixmap * m_backgroundimage
 Large or tiled image.
QPalette m_palette
 Colour scheme.
int m_xbase
int m_ybase
int m_height
int m_width
int m_baseWidth
int m_baseHeight
QMutex m_hostnamelock
 Locking for thread-safe copying of:.
QString m_localhostname
 hostname from mysql.txt or gethostname()
DatabaseParams m_DBparams
 Current database host & WOL details.
QString m_DBhostCp
 dbHostName backup
UPnpm_UPnP
 For automatic backend discover.
XmlConfigurationm_XML
HttpServerm_HTTP
QMutex serverSockLock
bool attemptingToConnect
MDBManager m_dbmanager
QMap< QString, QImage > imageCache
QString language
MythMainWindowmainWindow
float m_wmult
float m_hmult
int m_screenxbase
int m_screenybase
int m_screenwidth
int m_screenheight
int m_geometry_x
int m_geometry_y
int m_geometry_w
int m_geometry_h
QString themecachedir
int bigfontsize
int mediumfontsize
int smallfontsize
MythSocketserverSock
MythSocketeventSock
bool disablelibrarypopup
MythPluginManagerpluginmanager
ScreenSaverControlscreensaver
int m_logenable
int m_logmaxcount
int m_logprintlevel
QMap< QString, int > lastLogCounts
QMap< QString, QString > lastLogStrings
bool screensaverEnabled
DisplayResdisplay_res
QMutex m_priv_mutex
queue< MythPrivRequestm_priv_requests
QWaitCondition m_priv_queued
bool useSettingsCache
QMutex settingsCacheLock
QMap< QString, QString > settingsCache
QMap< QString, QString > overriddenSettings

Constructor & Destructor Documentation

MythContextPrivate::MythContextPrivate ( MythContext lparent  ) 

Definition at line 314 of file mythcontext.cpp.

MythContextPrivate::~MythContextPrivate (  ) 

Definition at line 370 of file mythcontext.cpp.


Member Function Documentation

bool MythContextPrivate::Init ( const bool  gui,
UPnp UPnPclient,
const bool  prompt,
const bool  noPrompt 
)

Definition at line 536 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 580 of file mythcontext.cpp.

Referenced by Init().

bool MythContextPrivate::IsWideMode (  )  const [inline]

void MythContextPrivate::SetWideMode (  )  [inline]

Definition at line 189 of file mythcontext.cpp.

Referenced by MythContext::LoadQtConfig().

bool MythContextPrivate::IsSquareMode (  )  const [inline]

Definition at line 190 of file mythcontext.cpp.

void MythContextPrivate::SetSquareMode (  )  [inline]

Definition at line 191 of file mythcontext.cpp.

Referenced by MythContext::LoadQtConfig().

void MythContextPrivate::TempMainWindow ( bool  languagePrompt = true  ) 

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.
Bug:
The default theme here is blue, but as of [12377], G.A.N.T is now meant to be the default? A simple change to make, but Nigel prefers "blue" for these initial screens and popups

Definition at line 401 of file mythcontext.cpp.

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

void MythContextPrivate::EndTempWindow ( void   ) 

void MythContextPrivate::GetScreenBounds ( void   ) 

Get screen size from Qt, respecting for user's multiple screen prefs.

If the windowing system environment has multiple screens (e.g. Xinerama or Mac OS X), QApplication::desktop()->width() will span all of them, so we usually need to get the geometry of a specific screen.

Definition at line 447 of file mythcontext.cpp.

Referenced by Init(), and MythContext::LoadQtConfig().

void MythContextPrivate::StoreGUIsettings ( void   ) 

Apply any user overrides to the screen geometry.

Definition at line 694 of file mythcontext.cpp.

Referenced by Init(), and MythContext::LoadQtConfig().

void MythContextPrivate::LoadLogSettings ( void   ) 

Definition at line 756 of file mythcontext.cpp.

Referenced by MythContext::LogEntry(), and MythContext::RefreshBackendConfig().

void MythContextPrivate::LoadDatabaseSettings ( void   ) 

Load database and host settings from mysql.txt, or set some defaults.

Returns:
true if mysql.txt was parsed

Definition at line 768 of file mythcontext.cpp.

Referenced by FindDatabase().

bool MythContextPrivate::LoadSettingsFile ( void   ) 

Load mysql.txt and parse its values into m_DBparams.

Definition at line 816 of file mythcontext.cpp.

Referenced by LoadDatabaseSettings().

bool MythContextPrivate::WriteSettingsFile ( const DatabaseParams params,
bool  overwrite = false 
)

Definition at line 842 of file mythcontext.cpp.

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

bool MythContextPrivate::FindSettingsProbs ( void   ) 

Definition at line 945 of file mythcontext.cpp.

Referenced by LoadDatabaseSettings().

QString MythContextPrivate::getResponse ( const QString &  query,
const QString &  def 
)

int MythContextPrivate::intResponse ( const QString &  query,
int  def 
)

Definition at line 1009 of file mythcontext.cpp.

Referenced by PromptForDatabaseParams().

bool MythContextPrivate::PromptForDatabaseParams ( const QString &  error  ) 

Definition at line 1019 of file mythcontext.cpp.

Referenced by FindDatabase().

QString MythContextPrivate::TestDBconnection ( void   ) 

Some quick sanity checks before opening a database connection.

Definition at line 1097 of file mythcontext.cpp.

Referenced by FindDatabase().

void MythContextPrivate::ResetDatabase ( void   ) 

Called when the user changes the DB connection settings.

The current DB connections way 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 1181 of file mythcontext.cpp.

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

bool MythContextPrivate::InitUPnP ( void   ) 

Definition at line 1188 of file mythcontext.cpp.

Referenced by ChooseBackend(), DefaultUPnP(), and UPnPautoconf().

void MythContextPrivate::DeleteUPnP ( void   ) 

Definition at line 1227 of file mythcontext.cpp.

Referenced by FindDatabase(), InitUPnP(), and ~MythContextPrivate().

int MythContextPrivate::ChooseBackend ( const QString &  error  ) 

Search for backends via UPnP, put up a UI for the user to choose one.

Definition at line 1252 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 1339 of file mythcontext.cpp.

Referenced by FindDatabase().

void MythContextPrivate::StoreConnectionInfo ( void   ) 

Try to store the current location of this backend in config.xml.

This is intended as a last resort for future connections (e.g. Perl scripts, backend not running).

Note that the Save() may fail (e.g. non writable ~/.mythtv)

Definition at line 1320 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 1414 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 1467 of file mythcontext.cpp.

Referenced by DefaultUPnP(), and UPnPautoconf().


Member Data Documentation

connection stuff, theme, button style

Definition at line 224 of file mythcontext.cpp.

Referenced by MythContext::GetSetting(), LoadSettingsFile(), MythContext::SetSetting(), TempMainWindow(), and ~MythContextPrivate().

Compile-time RUNPREFIX, or generated from enviroment ($MYTHTVDIR or $cwd).

Definition at line 227 of file mythcontext.cpp.

Referenced by MythContext::GetInstallPrefix(), MythContext::GetLibraryDir(), MythContext::GetShareDir(), LoadSettingsFile(), and MythContextPrivate().

Compile-time LIBDIRNAME.

Definition at line 229 of file mythcontext.cpp.

Referenced by MythContext::GetLibraryDir().

Should this context use GUI elements?

Definition at line 231 of file mythcontext.cpp.

Referenced by MythContext::ConnectServer(), FindDatabase(), Init(), PromptForDatabaseParams(), and MythContext::PromptForSchemaUpgrade().

Is this host any sort of backend?

Definition at line 232 of file mythcontext.cpp.

Referenced by MythContext::IsBackend(), and MythContext::SetBackend().

To we have a palette and pixmap to use?

Definition at line 234 of file mythcontext.cpp.

Referenced by MythContext::LoadQtConfig(), and MythContext::ThemeWidget().

Definition at line 235 of file mythcontext.cpp.

Referenced by MythContext::GetMenuThemeDir(), and MythContext::LoadQtConfig().

Large or tiled image.

Definition at line 237 of file mythcontext.cpp.

Referenced by MythContext::LoadQtConfig(), and MythContext::ThemeWidget().

Colour scheme.

Definition at line 238 of file mythcontext.cpp.

Referenced by MythContext::ThemeWidget().

Locking for thread-safe copying of:.

Definition at line 250 of file mythcontext.cpp.

Referenced by MythContext::GetHostName().

For automatic backend discover.

Definition at line 256 of file mythcontext.cpp.

Referenced by DefaultUPnP(), DeleteUPnP(), Init(), InitUPnP(), and UPnPautoconf().

Definition at line 257 of file mythcontext.cpp.

Referenced by ChooseBackend(), DeleteUPnP(), Init(), InitUPnP(), and StoreConnectionInfo().

Definition at line 258 of file mythcontext.cpp.

Referenced by DeleteUPnP(), and InitUPnP().

Definition at line 261 of file mythcontext.cpp.

Referenced by MythContext::ConnectServer().

Definition at line 263 of file mythcontext.cpp.

Referenced by MythContext::GetDBManager(), and ResetDatabase().

QMap<QString, QImage> MythContextPrivate::imageCache

Definition at line 271 of file mythcontext.cpp.

Referenced by MythContext::GetScreenSettings(), and StoreGUIsettings().

Definition at line 271 of file mythcontext.cpp.

Referenced by MythContext::GetScreenSettings(), and StoreGUIsettings().

Definition at line 275 of file mythcontext.cpp.

Referenced by MythContext::GetScreenSettings(), and StoreGUIsettings().

Definition at line 275 of file mythcontext.cpp.

Referenced by MythContext::GetScreenSettings(), and StoreGUIsettings().

Definition at line 284 of file mythcontext.cpp.

Referenced by MythContext::GetBigFont(), and MythContext::LoadQtConfig().

Definition at line 284 of file mythcontext.cpp.

Referenced by MythContext::GetMediumFont(), and MythContext::LoadQtConfig().

Definition at line 284 of file mythcontext.cpp.

Referenced by MythContext::GetSmallFont(), and MythContext::LoadQtConfig().

Definition at line 295 of file mythcontext.cpp.

Referenced by LoadLogSettings(), and MythContext::LogEntry().

Definition at line 295 of file mythcontext.cpp.

Referenced by LoadLogSettings(), and MythContext::LogEntry().

Definition at line 295 of file mythcontext.cpp.

Referenced by LoadLogSettings().

Definition at line 296 of file mythcontext.cpp.

Referenced by MythContext::LogEntry().

QMap<QString,QString> MythContextPrivate::lastLogStrings

Definition at line 297 of file mythcontext.cpp.

Referenced by MythContext::LogEntry().

Definition at line 301 of file mythcontext.cpp.

Referenced by MythContext::LoadQtConfig().

Definition at line 305 of file mythcontext.cpp.

Referenced by MythContext::addPrivRequest(), and MythContext::waitPrivRequest().

QMap<QString, QString> MythContextPrivate::settingsCache


The documentation for this class was generated from the following file:

Generated on Sat Dec 18 05:16:07 2010 for MythTV by  doxygen 1.5.5