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

#include <mythuithemecache.h>

Inheritance diagram for MythUIThemeCache:
Inheritance graph
[legend]
Collaboration diagram for MythUIThemeCache:
Collaboration graph
[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, qint64 > m_cacheTrack
 
QMutex m_cacheLock { QMutex::Recursive }
 
QAtomicInteger< qint64 > m_cacheSize { 0 }
 
QAtomicInteger< qint64 > m_maxCacheSize { 30 * 1024 * 1024 }
 
QString m_themecachedir
 
QSize m_cacheScreenSize
 
MThreadPoolm_imageThreadPool { nullptr }
 

Detailed Description

Definition at line 21 of file mythuithemecache.h.

Constructor & Destructor Documentation

◆ MythUIThemeCache()

MythUIThemeCache::MythUIThemeCache ( )

Definition at line 24 of file mythuithemecache.cpp.

◆ ~MythUIThemeCache()

MythUIThemeCache::~MythUIThemeCache ( )

Definition at line 32 of file mythuithemecache.cpp.

Member Function Documentation

◆ UpdateImageCache()

void MythUIThemeCache::UpdateImageCache ( )

Definition at line 60 of file mythuithemecache.cpp.

Referenced by MythMainWindow::Init().

◆ SetScreenSize()

void MythUIThemeCache::SetScreenSize ( QSize  Size)

Definition at line 50 of file mythuithemecache.cpp.

Referenced by MythUIScreenBounds::UpdateScreenSettings().

◆ ClearThemeCacheDir()

void MythUIThemeCache::ClearThemeCacheDir ( )

Definition at line 55 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 256 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 412 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 564 of file mythuithemecache.cpp.

◆ IncludeInCacheSize()

void MythUIThemeCache::IncludeInCacheSize ( MythImage Image)

Definition at line 574 of file mythuithemecache.cpp.

Referenced by MythImage::DecrRef().

◆ ExcludeFromCacheSize()

void MythUIThemeCache::ExcludeFromCacheSize ( MythImage Image)

Definition at line 586 of file mythuithemecache.cpp.

Referenced by MythImage::IncrRef().

◆ GetImageThreadPool()

MThreadPool * MythUIThemeCache::GetImageThreadPool ( )

Definition at line 598 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 249 of file mythuithemecache.cpp.

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

◆ RemoveFromCacheByURL()

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

Definition at line 506 of file mythuithemecache.cpp.

Referenced by LoadCacheImage(), and RemoveFromCacheByFile().

◆ GetImageFromCache()

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

Definition at line 389 of file mythuithemecache.cpp.

Referenced by LoadCacheImage().

◆ ClearOldImageCache()

void MythUIThemeCache::ClearOldImageCache ( )
private

Definition at line 82 of file mythuithemecache.cpp.

Referenced by UpdateImageCache().

◆ RemoveCacheDir()

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

Definition at line 123 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 160 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, qint64> MythUIThemeCache::m_cacheTrack
private

◆ m_cacheLock

QMutex MythUIThemeCache::m_cacheLock { QMutex::Recursive }
private

◆ m_cacheSize

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

◆ m_maxCacheSize

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

Definition at line 56 of file mythuithemecache.h.

Referenced by CacheImage(), and MythUIThemeCache().

◆ m_themecachedir

QString MythUIThemeCache::m_themecachedir
private

Definition at line 58 of file mythuithemecache.h.

Referenced by ClearOldImageCache(), and ClearThemeCacheDir().

◆ m_cacheScreenSize

QSize MythUIThemeCache::m_cacheScreenSize
private

Definition at line 59 of file mythuithemecache.h.

Referenced by GetThemeCacheDir(), and SetScreenSize().

◆ m_imageThreadPool

MThreadPool* MythUIThemeCache::m_imageThreadPool { nullptr }
private

Definition at line 60 of file mythuithemecache.h.

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


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