MythTV master
mythuithemecache.h
Go to the documentation of this file.
1#ifndef MYTHUICACHE_H
2#define MYTHUICACHE_H
3
4// Qt
5#include <QMap>
6#include <QRecursiveMutex>
7
8// MythTV
10#include "libmythui/mythimage.h"
11
12enum ImageCacheMode : std::uint8_t
13{
18};
19
20class MThreadPool;
21
23{
24 public:
27
28 void UpdateImageCache();
29 void SetScreenSize(QSize Size);
30 void ClearThemeCacheDir();
31 QString GetThemeCacheDir();
32 MythImage* LoadCacheImage(QString File, const QString& Label,
33 MythPainter* Painter, ImageCacheMode cacheMode = kCacheNormal);
34 MythImage* CacheImage(const QString& URL, MythImage* Image, bool NoDisk = false);
35 void RemoveFromCacheByFile(const QString& File);
36 bool IsImageInCache(const QString& URL);
37 void IncludeInCacheSize(MythImage* Image);
38 void ExcludeFromCacheSize(MythImage* Image);
39 MThreadPool* GetImageThreadPool();
40
41 private:
42 QString GetCacheDirByUrl(const QString& URL);
43 void RemoveFromCacheByURL(const QString& URL);
44 MythImage* GetImageFromCache(const QString& URL);
45 void ClearOldImageCache();
46 void RemoveCacheDir(const QString& Dir);
47 static void PruneCacheDir(const QString& Dir);
48
49 QMap<QString, MythImage *> m_imageCache;
50 QMap<QString, SystemTime> m_cacheTrack;
51 QRecursiveMutex m_cacheLock;
52 QAtomicInteger<qint64> m_cacheSize { 0 };
53 QAtomicInteger<qint64> m_maxCacheSize { 30LL * 1024 * 1024 };
56 MThreadPool* m_imageThreadPool { nullptr };
57};
58
59#endif
QMap< QString, SystemTime > m_cacheTrack
QMap< QString, MythImage * > m_imageCache
QRecursiveMutex m_cacheLock
#define MUI_PUBLIC
Definition: mythuiexp.h:9
ImageCacheMode
@ kCacheNormal
@ kCacheCheckMemoryOnly
@ kCacheForceStat
@ kCacheIgnoreDisk