added automatic download of card pictures

This commit is contained in:
marcus 2009-08-14 01:21:45 +02:00
parent 5bb08be2a4
commit 12a151a0c3
2 changed files with 48 additions and 3 deletions

View file

@ -7,6 +7,8 @@
#include <QDataStream>
#include <QList>
#include <QXmlStreamReader>
#include <QHttp>
#include <QFile>
class CardDatabase;
class CardInfo;
@ -31,7 +33,8 @@ public:
void sortByKey();
};
class CardInfo {
class CardInfo : QObject{
Q_OBJECT
private:
CardDatabase *db;
@ -43,9 +46,14 @@ private:
QString text;
QStringList colors;
QString picURL;
QHttp http;
QFile *newPic;
int dlID;
int tableRow;
QPixmap *pixmap;
QMap<int, QPixmap *> scaledPixmapCache;
void startDownload(QString, QString);
public:
CardInfo(CardDatabase *_db,
const QString &_name = QString(),
@ -75,6 +83,8 @@ public:
QPixmap *getPixmap(QSize size);
void clearPixmapCache();
void updatePixmapCache();
public slots:
void picDownloadFinished(int, bool);
};
class CardDatabase : public QObject {