Reimplemented PictureLoader as a singleton

* Removed remaining picture handling from card database and cardinfo
 * removed the “noCard object” hack
This commit is contained in:
Fabio Bas 2015-08-22 17:22:08 +02:00
parent 8125358052
commit f6c7f3355f
20 changed files with 654 additions and 704 deletions

View file

@ -6,6 +6,7 @@
#include "carditem.h"
#include "carddatabase.h"
#include "pictureloader.h"
#include "main.h"
CardInfoPicture::CardInfoPicture(QWidget *parent)
@ -21,7 +22,8 @@ void CardInfoPicture::setCard(CardInfo *card)
if (info)
disconnect(info, 0, this, 0);
info = card;
connect(info, SIGNAL(pixmapUpdated()), this, SLOT(updatePixmap()));
if(info)
connect(info, SIGNAL(pixmapUpdated()), this, SLOT(updatePixmap()));
updatePixmap();
}
@ -40,13 +42,13 @@ void CardInfoPicture::updatePixmap()
void CardInfoPicture::loadPixmap()
{
if(info)
info->getPixmap(size(), resizedPixmap);
PictureLoader::getPixmap(resizedPixmap, info, size());
else
resizedPixmap = QPixmap();
if (resizedPixmap.isNull())
db->getCard()->getPixmap(size(), resizedPixmap);
PictureLoader::getPixmap(resizedPixmap, db->getCard(), size());
}
void CardInfoPicture::paintEvent(QPaintEvent *)