1 #ifndef DLG_CREATETOKEN_H
2 #define DLG_CREATETOKEN_H
3 
4 #include <QDialog>
5 #include <QModelIndex>
6 
7 class QLabel;
8 class QLineEdit;
9 class QComboBox;
10 class QCheckBox;
11 class QPushButton;
12 class QRadioButton;
13 class QCloseEvent;
14 class QTreeView;
15 class DeckList;
16 class CardDatabaseModel;
17 class TokenDisplayModel;
18 class CardInfoPicture;
19 
20 class DlgCreateToken : public QDialog
21 {
22     Q_OBJECT
23 public:
24     DlgCreateToken(const QStringList &_predefinedTokens, QWidget *parent = nullptr);
25     QString getName() const;
26     QString getColor() const;
27     QString getPT() const;
28     QString getAnnotation() const;
29     bool getDestroy() const;
30 
31 protected:
32     void closeEvent(QCloseEvent *event);
33 private slots:
34     void tokenSelectionChanged(const QModelIndex &current, const QModelIndex &previous);
35     void updateSearch(const QString &search);
36     void actChooseTokenFromAll(bool checked);
37     void actChooseTokenFromDeck(bool checked);
38     void actOk();
39     void actReject();
40 
41 private:
42     CardDatabaseModel *cardDatabaseModel;
43     TokenDisplayModel *cardDatabaseDisplayModel;
44     QStringList predefinedTokens;
45     QLabel *nameLabel, *colorLabel, *ptLabel, *annotationLabel;
46     QComboBox *colorEdit;
47     QLineEdit *nameEdit, *ptEdit, *annotationEdit;
48     QCheckBox *destroyCheckBox;
49     QRadioButton *chooseTokenFromAllRadioButton, *chooseTokenFromDeckRadioButton;
50     CardInfoPicture *pic;
51     QTreeView *chooseTokenView;
52 
53     void updateSearchFieldWithoutUpdatingFilter(const QString &newValue) const;
54 };
55 
56 #endif
57