#pragma once #include #include #include class MemoryImageCache { public: MemoryImageCache(size_t maxsize = 25); void addImage(QPixmap, const QString& title, int type); QPixmap getImage(const QString& title, int type); private: void cleanUp(); struct CachedImage { time_t lastaccessed = 0; QPixmap imageref; QString title; int type; bool operator<(const CachedImage& other) const; }; static std::function getImageMatcher(const QString& title, int type); std::list cache; size_t maxsize; };