mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-05 04:53:54 -07:00
Replace CardInfo* and Carset* with smart pointers (#3053)
* Replace CardInfo* and Carset* with smart pointers * fixes to help memory & c++11 stuff
This commit is contained in:
parent
3e418ba3c6
commit
517420cccb
37 changed files with 409 additions and 342 deletions
|
|
@ -6,8 +6,7 @@
|
|||
#include <QMutex>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
class CardInfo;
|
||||
class CardSet;
|
||||
#include "carddatabase.h"
|
||||
class QNetworkAccessManager;
|
||||
class QNetworkReply;
|
||||
class QThread;
|
||||
|
|
@ -17,17 +16,21 @@ class PictureToLoad
|
|||
private:
|
||||
class SetDownloadPriorityComparator;
|
||||
|
||||
CardInfo *card;
|
||||
QList<CardSet *> sortedSets;
|
||||
CardInfoPtr card;
|
||||
QList<CardSetPtr> sortedSets;
|
||||
int setIndex;
|
||||
|
||||
public:
|
||||
PictureToLoad(CardInfo *_card = 0);
|
||||
CardInfo *getCard() const
|
||||
PictureToLoad(CardInfoPtr _card = CardInfoPtr());
|
||||
CardInfoPtr getCard() const
|
||||
{
|
||||
return card;
|
||||
}
|
||||
CardSet *getCurrentSet() const;
|
||||
void clear()
|
||||
{
|
||||
card.clear();
|
||||
}
|
||||
CardSetPtr getCurrentSet() const;
|
||||
QString getSetName() const;
|
||||
bool nextSet();
|
||||
};
|
||||
|
|
@ -39,7 +42,7 @@ public:
|
|||
PictureLoaderWorker();
|
||||
~PictureLoaderWorker();
|
||||
|
||||
void enqueueImageLoad(CardInfo *card);
|
||||
void enqueueImageLoad(CardInfoPtr card);
|
||||
|
||||
private:
|
||||
static QStringList md5Blacklist;
|
||||
|
|
@ -67,7 +70,7 @@ public slots:
|
|||
void processLoadQueue();
|
||||
signals:
|
||||
void startLoadQueue();
|
||||
void imageLoaded(CardInfo *card, const QImage &image);
|
||||
void imageLoaded(CardInfoPtr card, const QImage &image);
|
||||
};
|
||||
|
||||
class PictureLoader : public QObject
|
||||
|
|
@ -90,15 +93,15 @@ private:
|
|||
PictureLoaderWorker *worker;
|
||||
|
||||
public:
|
||||
static void getPixmap(QPixmap &pixmap, CardInfo *card, QSize size);
|
||||
static void getPixmap(QPixmap &pixmap, CardInfoPtr card, QSize size);
|
||||
static void getCardBackPixmap(QPixmap &pixmap, QSize size);
|
||||
static void clearPixmapCache(CardInfo *card);
|
||||
static void clearPixmapCache(CardInfoPtr card);
|
||||
static void clearPixmapCache();
|
||||
static void cacheCardPixmaps(QList<CardInfo *> cards);
|
||||
static void cacheCardPixmaps(QList<CardInfoPtr> cards);
|
||||
private slots:
|
||||
void picDownloadChanged();
|
||||
void picsPathChanged();
|
||||
public slots:
|
||||
void imageLoaded(CardInfo *card, const QImage &image);
|
||||
void imageLoaded(CardInfoPtr card, const QImage &image);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue