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

#include <libmythui/mythuithemecache.h>

Inheritance diagram for MythUIThemeCache:
[legend]
Collaboration diagram for MythUIThemeCache:
[legend]

Public Member Functions

 MythUIThemeCache ()
 
 ~MythUIThemeCache ()
 
void UpdateImageCache ()
 
void SetScreenSize (QSize Size)
 
void ClearThemeCacheDir ()
 
QString GetThemeCacheDir ()
 
MythImageLoadCacheImage (QString File, const QString &Label, MythPainter *Painter, ImageCacheMode cacheMode=kCacheNormal)
 
MythImageCacheImage (const QString &URL, MythImage *Image, bool NoDisk=false)
 
void RemoveFromCacheByFile (const QString &File)
 
bool IsImageInCache (const QString &URL)
 
void IncludeInCacheSize (MythImage *Image)
 
void ExcludeFromCacheSize (MythImage *Image)
 
MThreadPoolGetImageThreadPool ()
 

Private Member Functions

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 RemoveFromCacheByURL (const QString &URL)
 
MythImageGetImageFromCache (const QString &URL)
 
void ClearOldImageCache ()
 
void RemoveCacheDir (const QString &Dir)
 

Static Private Member Functions

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

Private Attributes

QMap< QString, MythImage * > m_imageCache
 
QMap< QString, SystemTimem_cacheTrack
 
QRecursiveMutex m_cacheLock
 
QAtomicInteger< qint64 > m_cacheSize { 0 }
 
QAtomicInteger< qint64 > m_maxCacheSize { 30LL * 1024 * 1024 }
 
QString m_themecachedir
 
QSize m_cacheScreenSize
 
MThreadPoolm_imageThreadPool { nullptr }
 

Detailed Description

Definition at line 22 of file mythuithemecache.h.

Constructor & Destructor Documentation

◆ MythUIThemeCache()

MythUIThemeCache::MythUIThemeCache ( )

Definition at line 25 of file mythuithemecache.cpp.

◆ ~MythUIThemeCache()

MythUIThemeCache::~MythUIThemeCache ( )

Definition at line 33 of file mythuithemecache.cpp.

Member Function Documentation

◆ UpdateImageCache()

void MythUIThemeCache::UpdateImageCache ( )

Definition at line 61 of file mythuithemecache.cpp.

Referenced by MythMainWindow::Init().

◆ SetScreenSize()

void MythUIThemeCache::SetScreenSize ( QSize  Size)

Definition at line 51 of file mythuithemecache.cpp.

Referenced by MythUIScreenBounds::UpdateScreenSettings().

◆ ClearThemeCacheDir()

void MythUIThemeCache::ClearThemeCacheDir ( )

Definition at line 56 of file mythuithemecache.cpp.

Referenced by MythMainWindow::LoadQtConfig().

◆ GetThemeCacheDir()

QString MythUIThemeCache::GetThemeCacheDir ( )

◆ LoadCacheImage()

MythImage * MythUIThemeCache::LoadCacheImage ( QString  File,
const QString &  Label,
MythPainter Painter,
ImageCacheMode  cacheMode = kCacheNormal 
)

Definition at line 257 of file mythuithemecache.cpp.

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

◆ CacheImage()

MythImage * MythUIThemeCache::CacheImage ( const QString &  URL,
MythImage Image,
bool  NoDisk = false 
)

Definition at line 413 of file mythuithemecache.cpp.

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

◆ RemoveFromCacheByFile()

void MythUIThemeCache::RemoveFromCacheByFile ( const QString &  File)

◆ IsImageInCache()

bool MythUIThemeCache::IsImageInCache ( const QString &  URL)

Definition at line 548 of file mythuithemecache.cpp.

◆ IncludeInCacheSize()

void MythUIThemeCache::IncludeInCacheSize ( MythImage Image)

Definition at line 558 of file mythuithemecache.cpp.

Referenced by MythImage::DecrRef().

◆ ExcludeFromCacheSize()

void MythUIThemeCache::ExcludeFromCacheSize ( MythImage Image)

Definition at line 564 of file mythuithemecache.cpp.

Referenced by MythImage::IncrRef().

◆ GetImageThreadPool()

MThreadPool * MythUIThemeCache::GetImageThreadPool ( )

Definition at line 570 of file mythuithemecache.cpp.

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

◆ GetCacheDirByUrl()

QString MythUIThemeCache::GetCacheDirByUrl ( const QString &  URL)
private

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 250 of file mythuithemecache.cpp.

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

◆ RemoveFromCacheByURL()

void MythUIThemeCache::RemoveFromCacheByURL ( const QString &  URL)
private

Definition at line 490 of file mythuithemecache.cpp.

Referenced by LoadCacheImage(), and RemoveFromCacheByFile().

◆ GetImageFromCache()

MythImage * MythUIThemeCache::GetImageFromCache ( const QString &  URL)
private

Definition at line 390 of file mythuithemecache.cpp.

Referenced by LoadCacheImage().

◆ ClearOldImageCache()

void MythUIThemeCache::ClearOldImageCache ( )
private

Definition at line 83 of file mythuithemecache.cpp.

Referenced by UpdateImageCache().

◆ RemoveCacheDir()

void MythUIThemeCache::RemoveCacheDir ( const QString &  Dir)
private

Definition at line 124 of file mythuithemecache.cpp.

Referenced by ClearOldImageCache().

◆ PruneCacheDir()

void MythUIThemeCache::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 161 of file mythuithemecache.cpp.

Referenced by UpdateImageCache(), and ~MythUIThemeCache().

Member Data Documentation

◆ m_imageCache

QMap<QString, MythImage *> MythUIThemeCache::m_imageCache
private

◆ m_cacheTrack

QMap<QString, SystemTime> MythUIThemeCache::m_cacheTrack
private

◆ m_cacheLock

QRecursiveMutex MythUIThemeCache::m_cacheLock
private

◆ m_cacheSize

QAtomicInteger<qint64> MythUIThemeCache::m_cacheSize { 0 }
private

◆ m_maxCacheSize

QAtomicInteger<qint64> MythUIThemeCache::m_maxCacheSize { 30LL * 1024 * 1024 }
private

Definition at line 53 of file mythuithemecache.h.

Referenced by CacheImage(), and MythUIThemeCache().

◆ m_themecachedir

QString MythUIThemeCache::m_themecachedir
private

Definition at line 54 of file mythuithemecache.h.

Referenced by ClearOldImageCache(), and ClearThemeCacheDir().

◆ m_cacheScreenSize

QSize MythUIThemeCache::m_cacheScreenSize
private

Definition at line 55 of file mythuithemecache.h.

Referenced by GetThemeCacheDir(), and SetScreenSize().

◆ m_imageThreadPool

MThreadPool* MythUIThemeCache::m_imageThreadPool { nullptr }
private

Definition at line 56 of file mythuithemecache.h.

Referenced by GetImageThreadPool(), and ~MythUIThemeCache().


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