mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-01 02:53:56 -07:00
refactor cardframe as a parent of a text card frame and a picture card frame
cardframe is now a stacked widget that prefers to show the card picture only so that the screen can be more space efficient and the card pixel map can be displayed as a larger size. however if the card pixel map can not be loaded for some reason, the cardframe class will automatically switch to the text version of the card. a menu item was added under the database menu to allow for users to prefer card text only.
This commit is contained in:
parent
5d223b5917
commit
f77054f20d
9 changed files with 231 additions and 34 deletions
|
|
@ -1,32 +1,36 @@
|
|||
#ifndef CARDFRAME_H
|
||||
#define CARDFRAME_H
|
||||
|
||||
#include <QLabel>
|
||||
#include <QStringList>
|
||||
#include <QStackedWidget>
|
||||
|
||||
class AbstractCardItem;
|
||||
class CardInfo;
|
||||
class QResizeEvent;
|
||||
class CardInfoPicture;
|
||||
class CardInfoText;
|
||||
|
||||
class CardFrame : public QLabel {
|
||||
class CardFrame : public QStackedWidget {
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
CardInfo *info;
|
||||
CardInfoPicture *pic;
|
||||
CardInfoText *text;
|
||||
bool cardTextOnly;
|
||||
|
||||
public:
|
||||
CardFrame(const QString &cardName = QString(), QWidget *parent = 0);
|
||||
QString getCardName() const;
|
||||
CardFrame(int width, int height, const QString &cardName = QString(),
|
||||
QWidget *parent = 0);
|
||||
void setCardTextOnly(bool status) { cardTextOnly = status; hasPictureChanged(); }
|
||||
|
||||
public slots:
|
||||
void setCard(CardInfo *card);
|
||||
void setCard(const QString &cardName);
|
||||
void setCard(AbstractCardItem *card);
|
||||
void clear();
|
||||
|
||||
private slots:
|
||||
void clear();
|
||||
void updatePixmap();
|
||||
|
||||
void hasPictureChanged();
|
||||
void toggleCardTextOnly() { setCardTextOnly(!cardTextOnly); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue