Use QPixmapCache for card images

Drop CardInfo’s own pixmap caches; use QPixmapCache instead.
Use QPixmap references instead of pointers.
Being stored in QPixmapCache, all card images are now subjected to
QPixmapCache’s size limit
This commit is contained in:
Fabio Bas 2014-12-24 16:18:55 +01:00
parent b96104bed4
commit f88621fd97
5 changed files with 71 additions and 69 deletions

View file

@ -12,6 +12,7 @@
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
#include <QPixmapCache>
class CardDatabase;
class CardInfo;
@ -119,8 +120,7 @@ private:
MuidMap muIds;
bool cipt;
int tableRow;
QPixmap *pixmap;
QMap<int, QPixmap *> scaledPixmapCache;
QString pixmapCacheKey;
public:
CardInfo(CardDatabase *_db,
const QString &_name = QString(),
@ -165,8 +165,8 @@ public:
void setCustomPicURLHq(const QString &_set, const QString &_customPicURL) { customPicURLsHq.insert(_set, _customPicURL); }
void setMuId(const QString &_set, const int &_muId) { muIds.insert(_set, _muId); }
void addToSet(CardSet *set);
QPixmap *loadPixmap();
QPixmap *getPixmap(QSize size);
void loadPixmap(QPixmap &pixmap);
void getPixmap(QSize size, QPixmap &pixmap);
void clearPixmapCache();
void clearPixmapCacheMiss();
void imageLoaded(const QImage &image);