MythTV  master
Public Member Functions | Static Public Member Functions | Static Public Attributes | 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 GetScreenSettings (float &wmult, float &hmult)
 
void GetScreenSettings (int &width, float &wmult, int &height, float &hmult)
 
void GetScreenSettings (int &xbase, int &width, float &wmult, int &ybase, int &height, float &hmult)
 
void GetScreenBounds (int &xbase, int &ybase, int &width, int &height)
 
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)
 
double GetPixelAspectRatio (void) const
 
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 QFont GetBigFont (void)
 
static QFont GetMediumFont (void)
 
static QFont GetSmallFont (void)
 
static void DisableScreensaver (void)
 
static void RestoreScreensaver (void)
 
static void ResetScreensaver (void)
 
static void SetX11Display (const QString &display)
 This needs to be set before MythUIHelper is initialized so that the MythUIHelper::Init() can detect Xinerama setups. More...
 
static QString GetX11Display (void)
 
static MythUIHelpergetMythUI (void)
 
static void destroyMythUI (void)
 

Static Public Attributes

static QString x11_display
 

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 374 of file mythuihelper.cpp.

Referenced by getMythUI().

◆ ~MythUIHelper()

MythUIHelper::~MythUIHelper ( )
protected

Definition at line 379 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 401 of file mythuihelper.cpp.

◆ GetMenuCBs()

MythUIMenuCallbacks * MythUIHelper::GetMenuCBs ( void  )

Definition at line 406 of file mythuihelper.cpp.

Referenced by MythThemedMenu::handleAction().

◆ LoadQtConfig()

void MythUIHelper::LoadQtConfig ( void  )

◆ UpdateImageCache()

void MythUIHelper::UpdateImageCache ( void  )

Definition at line 470 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 493 of file mythuihelper.cpp.

Referenced by LoadCacheImage().

◆ CacheImage()

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

Definition at line 540 of file mythuihelper.cpp.

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

◆ RemoveFromCacheByURL()

void MythUIHelper::RemoveFromCacheByURL ( const QString &  url)

Definition at line 653 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 714 of file mythuihelper.cpp.

◆ GetThemeCacheDir()

QString MythUIHelper::GetThemeCacheDir ( void  )

Definition at line 727 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 753 of file mythuihelper.cpp.

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

◆ IncludeInCacheSize()

void MythUIHelper::IncludeInCacheSize ( MythImage im)

Definition at line 520 of file mythuihelper.cpp.

Referenced by MythImage::DecrRef().

◆ ExcludeFromCacheSize()

void MythUIHelper::ExcludeFromCacheSize ( MythImage im)

Definition at line 530 of file mythuihelper.cpp.

Referenced by MythImage::IncrRef().

◆ IsScreenSetup()

bool MythUIHelper::IsScreenSetup ( void  )

◆ IsTopScreenInitialized()

bool MythUIHelper::IsTopScreenInitialized ( void  )
static

Definition at line 416 of file mythuihelper.cpp.

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

◆ GetScreenSettings() [1/3]

void MythUIHelper::GetScreenSettings ( float &  wmult,
float &  hmult 
)

◆ GetScreenSettings() [2/3]

void MythUIHelper::GetScreenSettings ( int &  width,
float &  wmult,
int &  height,
float &  hmult 
)

Definition at line 938 of file mythuihelper.cpp.

◆ GetScreenSettings() [3/3]

void MythUIHelper::GetScreenSettings ( int &  xbase,
int &  width,
float &  wmult,
int &  ybase,
int &  height,
float &  hmult 
)

Definition at line 948 of file mythuihelper.cpp.

◆ GetScreenBounds()

void MythUIHelper::GetScreenBounds ( int &  xbase,
int &  ybase,
int &  width,
int &  height 
)

Definition at line 922 of file mythuihelper.cpp.

Referenced by TV::Init().

◆ 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 970 of file mythuihelper.cpp.

Referenced by main().

◆ IsGeometryOverridden()

bool MythUIHelper::IsGeometryOverridden ( void  )
static

Definition at line 1057 of file mythuihelper.cpp.

Referenced by MythMainWindow::Init(), and MythMainWindow::Show().

◆ 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 1326 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 1076 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 1144 of file mythuihelper.cpp.

Referenced by LoadQtConfig().

◆ GetThemeDir()

QString MythUIHelper::GetThemeDir ( void  )

◆ GetThemeName()

QString MythUIHelper::GetThemeName ( void  )

Definition at line 1192 of file mythuihelper.cpp.

Referenced by NetworkControl::processTheme().

◆ GetThemeSearchPath()

QStringList MythUIHelper::GetThemeSearchPath ( void  )

◆ GetMenuThemeDir()

QString MythUIHelper::GetMenuThemeDir ( void  )

Definition at line 1182 of file mythuihelper.cpp.

Referenced by MythThemedMenu::findMenuFile().

◆ GetThemes()

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

Definition at line 1255 of file mythuihelper.cpp.

Referenced by GetThemeSearchPath(), and MenuTheme().

◆ FindThemeFile()

bool MythUIHelper::FindThemeFile ( QString &  path)

Definition at line 1288 of file mythuihelper.cpp.

Referenced by MythUIWebBrowser::Init(), MythImage::Load(), and LoadCacheImage().

◆ GetBigFont()

QFont MythUIHelper::GetBigFont ( void  )
static

Definition at line 1464 of file mythuihelper.cpp.

◆ GetMediumFont()

QFont MythUIHelper::GetMediumFont ( void  )
static

Definition at line 1473 of file mythuihelper.cpp.

Referenced by VisualBase::drawWarning().

◆ GetSmallFont()

QFont MythUIHelper::GetSmallFont ( void  )
static

Definition at line 1482 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 1539 of file mythuihelper.cpp.

Referenced by MythMainWindow::customEvent().

◆ GetScreensaverEnabled()

bool MythUIHelper::GetScreensaverEnabled ( void  )

Definition at line 1548 of file mythuihelper.cpp.

◆ GetScreenIsAsleep()

bool MythUIHelper::GetScreenIsAsleep ( void  )

Definition at line 1553 of file mythuihelper.cpp.

◆ SetX11Display()

void MythUIHelper::SetX11Display ( const QString &  display)
static

This needs to be set before MythUIHelper is initialized so that the MythUIHelper::Init() can detect Xinerama setups.

Definition at line 1563 of file mythuihelper.cpp.

Referenced by main().

◆ GetX11Display()

QString MythUIHelper::GetX11Display ( void  )
static

Definition at line 1568 of file mythuihelper.cpp.

Referenced by MythXDisplay::Open().

◆ 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 1644 of file mythuihelper.cpp.

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

◆ GetPixelAspectRatio()

double MythUIHelper::GetPixelAspectRatio ( void  ) const

Definition at line 1649 of file mythuihelper.cpp.

◆ GetBaseSize()

QSize MythUIHelper::GetBaseSize ( void  ) const

◆ SetFontStretch()

void MythUIHelper::SetFontStretch ( int  stretch)

Definition at line 1659 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 760 of file mythuihelper.cpp.

Referenced by UpdateImageCache().

◆ RemoveCacheDir()

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

Definition at line 810 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 853 of file mythuihelper.cpp.

Referenced by destroyMythUI(), and UpdateImageCache().

Member Data Documentation

◆ x11_display

QString MythUIHelper::x11_display
static

Definition at line 122 of file mythuihelper.h.

Referenced by GetX11Display(), and SetX11Display().

◆ d

MythUIHelperPrivate* MythUIHelper::d {nullptr}
private

◆ m_locationLock

QMutex MythUIHelper::m_locationLock
private

Definition at line 152 of file mythuihelper.h.

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

◆ m_currentLocation

QStringList MythUIHelper::m_currentLocation
private

Definition at line 153 of file mythuihelper.h.

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


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