MythTV  master
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
MythUIHelper Class Reference

#include <mythuihelper.h>

Collaboration diagram for MythUIHelper:
Collaboration graph
[legend]

Public Member Functions

void Init (MythUIMenuCallbacks &cbs)
 
void Init (void)
 
MythUIMenuCallbacksGetMenuCBs (void)
 
void LoadQtConfig (void)
 
void UpdateImageCache (void)
 
MythImageGetImageFromCache (const QString &url)
 Returns a reference counted image base on the URL. More...
 
MythImageCacheImage (const QString &url, MythImage *im, bool nodisk=false)
 
void RemoveFromCacheByURL (const QString &url)
 
void RemoveFromCacheByFile (const QString &fname)
 
bool IsImageInCache (const QString &url)
 
QString GetThemeCacheDir (void)
 
QString GetCacheDirByUrl (const QString &url)
 Look at the url being read and decide whether the cached version should go into the theme cache or the thumbnail cache. More...
 
void IncludeInCacheSize (MythImage *im)
 
void ExcludeFromCacheSize (MythImage *im)
 
bool IsScreenSetup (void)
 
void UpdateScreenSettings (void)
 
QRect GetScreenSettings (void)
 
void GetScreenSettings (QRect &Rect, float &XFactor, float &YFactor)
 
void GetScreenSettings (float &XFactor, float &YFactor)
 
MythImageLoadCacheImage (QString srcfile, const QString &label, MythPainter *painter, ImageCacheMode cacheMode=kCacheNormal)
 Returns a reference counted image from the cache. More...
 
QString FindThemeDir (const QString &themename, bool doFallback=true)
 Returns the full path to the theme denoted by themename. More...
 
QString FindMenuThemeDir (const QString &menuname)
 Returns the full path to the menu theme denoted by menuname. More...
 
QString GetThemeDir (void)
 
QString GetThemeName (void)
 
QStringList GetThemeSearchPath (void)
 
QString GetMenuThemeDir (void)
 
QList< ThemeInfoGetThemes (ThemeType type)
 
bool FindThemeFile (QString &path)
 
void DoDisableScreensaver (void)
 
void DoRestoreScreensaver (void)
 
void DoResetScreensaver (void)
 
bool GetScreensaverEnabled (void)
 
bool GetScreenIsAsleep (void)
 
void AddCurrentLocation (const QString &location)
 
QString RemoveCurrentLocation (void)
 
QString GetCurrentLocation (bool fullPath=false, bool mainStackOnly=true)
 
MThreadPoolGetImageThreadPool (void)
 
QSize GetBaseSize (void) const
 
void SetFontStretch (int stretch)
 
int GetFontStretch (void) const
 

Static Public Member Functions

static bool IsTopScreenInitialized (void)
 
static void ParseGeometryOverride (const QString &geometry)
 Parse an X11 style command line geometry string. More...
 
static bool IsGeometryOverridden (void)
 
static QRect GetGeometryOverride (void)
 Return the raw geometry override rectangle. More...
 
static QFont GetBigFont (void)
 
static QFont GetMediumFont (void)
 
static QFont GetSmallFont (void)
 
static void DisableScreensaver (void)
 
static void RestoreScreensaver (void)
 
static void ResetScreensaver (void)
 
static MythUIHelpergetMythUI (void)
 
static void destroyMythUI (void)
 

Protected Member Functions

 MythUIHelper ()
 
 ~MythUIHelper ()
 

Private Member Functions

void InitializeScreenSettings (void)
 
void ClearOldImageCache (void)
 
void RemoveCacheDir (const QString &dirname)
 

Static Private Member Functions

static void PruneCacheDir (const QString &dirname)
 Remove all files in the cache that haven't been accessed in a user configurable number of days. More...
 

Private Attributes

MythUIHelperPrivated {nullptr}
 
QMutex m_locationLock
 
QStringList m_currentLocation
 

Detailed Description

Definition at line 41 of file mythuihelper.h.

Constructor & Destructor Documentation

◆ MythUIHelper()

MythUIHelper::MythUIHelper ( )
protected

Definition at line 272 of file mythuihelper.cpp.

Referenced by getMythUI().

◆ ~MythUIHelper()

MythUIHelper::~MythUIHelper ( )
protected

Definition at line 277 of file mythuihelper.cpp.

Member Function Documentation

◆ Init() [1/2]

void MythUIHelper::Init ( MythUIMenuCallbacks cbs)

◆ Init() [2/2]

void MythUIHelper::Init ( void  )

Definition at line 299 of file mythuihelper.cpp.

◆ GetMenuCBs()

MythUIMenuCallbacks * MythUIHelper::GetMenuCBs ( void  )

Definition at line 304 of file mythuihelper.cpp.

Referenced by MythThemedMenu::handleAction().

◆ LoadQtConfig()

void MythUIHelper::LoadQtConfig ( void  )

◆ UpdateImageCache()

void MythUIHelper::UpdateImageCache ( void  )

Definition at line 364 of file mythuihelper.cpp.

Referenced by MythMainWindow::Init().

◆ GetImageFromCache()

MythImage * MythUIHelper::GetImageFromCache ( const QString &  url)

Returns a reference counted image base on the URL.

Note
The reference count is set for one use call DecrRef() to delete.

Definition at line 387 of file mythuihelper.cpp.

Referenced by LoadCacheImage().

◆ CacheImage()

MythImage * MythUIHelper::CacheImage ( const QString &  url,
MythImage im,
bool  nodisk = false 
)

Definition at line 434 of file mythuihelper.cpp.

Referenced by LoadCacheImage(), and ImageLoader::LoadImage().

◆ RemoveFromCacheByURL()

void MythUIHelper::RemoveFromCacheByURL ( const QString &  url)

Definition at line 539 of file mythuihelper.cpp.

Referenced by LoadCacheImage(), and RemoveFromCacheByFile().

◆ RemoveFromCacheByFile()

void MythUIHelper::RemoveFromCacheByFile ( const QString &  fname)

◆ IsImageInCache()

bool MythUIHelper::IsImageInCache ( const QString &  url)

Definition at line 600 of file mythuihelper.cpp.

◆ GetThemeCacheDir()

QString MythUIHelper::GetThemeCacheDir ( void  )

Definition at line 613 of file mythuihelper.cpp.

Referenced by ClearOldImageCache(), GetCacheDirByUrl(), and RemoveFromCacheByFile().

◆ GetCacheDirByUrl()

QString MythUIHelper::GetCacheDirByUrl ( const QString &  url)

Look at the url being read and decide whether the cached version should go into the theme cache or the thumbnail cache.

Parameters
urlThe resource being read.
Returns
The path name of the appropriate cache directory.

Definition at line 639 of file mythuihelper.cpp.

Referenced by CacheImage(), LoadCacheImage(), and RemoveFromCacheByURL().

◆ IncludeInCacheSize()

void MythUIHelper::IncludeInCacheSize ( MythImage im)

Definition at line 410 of file mythuihelper.cpp.

Referenced by MythImage::DecrRef().

◆ ExcludeFromCacheSize()

void MythUIHelper::ExcludeFromCacheSize ( MythImage im)

Definition at line 422 of file mythuihelper.cpp.

Referenced by MythImage::IncrRef().

◆ IsScreenSetup()

bool MythUIHelper::IsScreenSetup ( void  )

◆ IsTopScreenInitialized()

bool MythUIHelper::IsTopScreenInitialized ( void  )
static

Definition at line 314 of file mythuihelper.cpp.

Referenced by Frontend::PlayRecording(), and NetworkControl::processPlay().

◆ UpdateScreenSettings()

void MythUIHelper::UpdateScreenSettings ( void  )

Definition at line 804 of file mythuihelper.cpp.

Referenced by MythMainWindow::Init().

◆ GetScreenSettings() [1/3]

QRect MythUIHelper::GetScreenSettings ( void  )

◆ GetScreenSettings() [2/3]

void MythUIHelper::GetScreenSettings ( QRect &  Rect,
float &  XFactor,
float &  YFactor 
)

Definition at line 820 of file mythuihelper.cpp.

◆ GetScreenSettings() [3/3]

void MythUIHelper::GetScreenSettings ( float &  XFactor,
float &  YFactor 
)

Definition at line 814 of file mythuihelper.cpp.

◆ ParseGeometryOverride()

void MythUIHelper::ParseGeometryOverride ( const QString &  geometry)
static

Parse an X11 style command line geometry string.

Accepts strings like -geometry 800x600 or -geometry 800x600+112+22 to override the fullscreen and user default screen dimensions

Definition at line 836 of file mythuihelper.cpp.

Referenced by main().

◆ IsGeometryOverridden()

bool MythUIHelper::IsGeometryOverridden ( void  )
static

◆ GetGeometryOverride()

QRect MythUIHelper::GetGeometryOverride ( void  )
static

Return the raw geometry override rectangle.

Used before MythUIHelper has been otherwise initialised (and hence GetScreenSettings does not return a valid result).

Definition at line 935 of file mythuihelper.cpp.

Referenced by MythDisplay::GetDesiredScreen().

◆ LoadCacheImage()

MythImage * MythUIHelper::LoadCacheImage ( QString  srcfile,
const QString &  label,
MythPainter painter,
ImageCacheMode  cacheMode = kCacheNormal 
)

Returns a reference counted image from the cache.

Note
The reference count is set for one use call DecrRef() to delete.

Definition at line 1199 of file mythuihelper.cpp.

Referenced by MythUIImage::Load(), and ImageLoader::LoadImage().

◆ FindThemeDir()

QString MythUIHelper::FindThemeDir ( const QString &  themename,
bool  doFallback = true 
)

Returns the full path to the theme denoted by themename.

If the theme cannot be found falls back to the DEFAULT_UI_THEME. If the DEFAULT_UI_THEME doesn't exist then returns an empty string.

Parameters
themenameThe theme name.
doFallbackIf true and the theme isn't found, allow fallback to the default theme. If false and the theme isn't found, then return an empty string.
Returns
Path to theme or empty string.

Definition at line 953 of file mythuihelper.cpp.

Referenced by GetThemeSearchPath(), LoadQtConfig(), main(), reloadTheme(), and resetTheme().

◆ FindMenuThemeDir()

QString MythUIHelper::FindMenuThemeDir ( const QString &  menuname)

Returns the full path to the menu theme denoted by menuname.

If the theme cannot be found falls back to the default menu. If the default menu theme doesn't exist then returns an empty string.

Parameters
menunameThe menutheme name.
Returns
Path to theme or empty string.

Definition at line 1021 of file mythuihelper.cpp.

Referenced by LoadQtConfig().

◆ GetThemeDir()

QString MythUIHelper::GetThemeDir ( void  )

◆ GetThemeName()

QString MythUIHelper::GetThemeName ( void  )

Definition at line 1069 of file mythuihelper.cpp.

Referenced by NetworkControl::processTheme().

◆ GetThemeSearchPath()

QStringList MythUIHelper::GetThemeSearchPath ( void  )

◆ GetMenuThemeDir()

QString MythUIHelper::GetMenuThemeDir ( void  )

Definition at line 1059 of file mythuihelper.cpp.

Referenced by MythThemedMenu::findMenuFile().

◆ GetThemes()

QList< ThemeInfo > MythUIHelper::GetThemes ( ThemeType  type)

Definition at line 1132 of file mythuihelper.cpp.

Referenced by GetThemeSearchPath(), and MenuTheme().

◆ FindThemeFile()

bool MythUIHelper::FindThemeFile ( QString &  path)

Definition at line 1162 of file mythuihelper.cpp.

Referenced by MythWebPage::extension(), and LoadCacheImage().

◆ GetBigFont()

QFont MythUIHelper::GetBigFont ( void  )
static

Definition at line 1333 of file mythuihelper.cpp.

◆ GetMediumFont()

QFont MythUIHelper::GetMediumFont ( void  )
static

Definition at line 1342 of file mythuihelper.cpp.

Referenced by VisualBase::drawWarning().

◆ GetSmallFont()

QFont MythUIHelper::GetSmallFont ( void  )
static

Definition at line 1351 of file mythuihelper.cpp.

◆ DisableScreensaver()

void MythUIHelper::DisableScreensaver ( void  )
static

◆ RestoreScreensaver()

void MythUIHelper::RestoreScreensaver ( void  )
static

◆ ResetScreensaver()

void MythUIHelper::ResetScreensaver ( void  )
static

◆ DoDisableScreensaver()

void MythUIHelper::DoDisableScreensaver ( void  )

◆ DoRestoreScreensaver()

void MythUIHelper::DoRestoreScreensaver ( void  )

◆ DoResetScreensaver()

void MythUIHelper::DoResetScreensaver ( void  )

Definition at line 1408 of file mythuihelper.cpp.

Referenced by MythMainWindow::customEvent().

◆ GetScreensaverEnabled()

bool MythUIHelper::GetScreensaverEnabled ( void  )

Definition at line 1417 of file mythuihelper.cpp.

◆ GetScreenIsAsleep()

bool MythUIHelper::GetScreenIsAsleep ( void  )

Definition at line 1422 of file mythuihelper.cpp.

◆ getMythUI()

MythUIHelper * MythUIHelper::getMythUI ( void  )
static

Definition at line 49 of file mythuihelper.cpp.

Referenced by GetMythUI().

◆ destroyMythUI()

void MythUIHelper::destroyMythUI ( void  )
static

Definition at line 71 of file mythuihelper.cpp.

Referenced by DestroyMythUI().

◆ AddCurrentLocation()

void MythUIHelper::AddCurrentLocation ( const QString &  location)

◆ RemoveCurrentLocation()

QString MythUIHelper::RemoveCurrentLocation ( void  )

◆ GetCurrentLocation()

QString MythUIHelper::GetCurrentLocation ( bool  fullPath = false,
bool  mainStackOnly = true 
)

◆ GetImageThreadPool()

MThreadPool * MythUIHelper::GetImageThreadPool ( void  )

Definition at line 1501 of file mythuihelper.cpp.

Referenced by MythUIImage::Load(), and MythUIImage::~MythUIImage().

◆ GetBaseSize()

QSize MythUIHelper::GetBaseSize ( void  ) const

◆ SetFontStretch()

void MythUIHelper::SetFontStretch ( int  stretch)

Definition at line 1511 of file mythuihelper.cpp.

Referenced by OSD::OverrideUIScale(), and OSD::RevertUIScale().

◆ GetFontStretch()

int MythUIHelper::GetFontStretch ( void  ) const

◆ InitializeScreenSettings()

void MythUIHelper::InitializeScreenSettings ( void  )
private

◆ ClearOldImageCache()

void MythUIHelper::ClearOldImageCache ( void  )
private

Definition at line 646 of file mythuihelper.cpp.

Referenced by UpdateImageCache().

◆ RemoveCacheDir()

void MythUIHelper::RemoveCacheDir ( const QString &  dirname)
private

Definition at line 694 of file mythuihelper.cpp.

Referenced by ClearOldImageCache().

◆ PruneCacheDir()

void MythUIHelper::PruneCacheDir ( const QString &  dirname)
staticprivate

Remove all files in the cache that haven't been accessed in a user configurable number of days.

The default number of days is seven.

Parameters
dirnameThe directory to prune.

Definition at line 737 of file mythuihelper.cpp.

Referenced by destroyMythUI(), and UpdateImageCache().

Member Data Documentation

◆ d

MythUIHelperPrivate* MythUIHelper::d {nullptr}
private

◆ m_locationLock

QMutex MythUIHelper::m_locationLock
private

Definition at line 142 of file mythuihelper.h.

Referenced by AddCurrentLocation(), GetCurrentLocation(), and RemoveCurrentLocation().

◆ m_currentLocation

QStringList MythUIHelper::m_currentLocation
private

Definition at line 143 of file mythuihelper.h.

Referenced by AddCurrentLocation(), GetCurrentLocation(), and RemoveCurrentLocation().


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