mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 08:14:47 -07:00
Refactor: move last token info into struct (#5808)
* add override * refactor token info into struct * correct default destroy value
This commit is contained in:
parent
0bd53d6dc7
commit
56bbd8a172
4 changed files with 45 additions and 56 deletions
|
|
@ -224,27 +224,11 @@ void DlgCreateToken::actReject()
|
|||
reject();
|
||||
}
|
||||
|
||||
QString DlgCreateToken::getName() const
|
||||
TokenInfo DlgCreateToken::getTokenInfo() const
|
||||
{
|
||||
return nameEdit->text();
|
||||
}
|
||||
|
||||
QString DlgCreateToken::getColor() const
|
||||
{
|
||||
return QString(colorEdit->itemData(colorEdit->currentIndex()).toChar());
|
||||
}
|
||||
|
||||
QString DlgCreateToken::getPT() const
|
||||
{
|
||||
return ptEdit->text();
|
||||
}
|
||||
|
||||
QString DlgCreateToken::getAnnotation() const
|
||||
{
|
||||
return annotationEdit->text();
|
||||
}
|
||||
|
||||
bool DlgCreateToken::getDestroy() const
|
||||
{
|
||||
return destroyCheckBox->isChecked();
|
||||
return {.name = nameEdit->text(),
|
||||
.color = colorEdit->itemData(colorEdit->currentIndex()).toString(),
|
||||
.pt = ptEdit->text(),
|
||||
.annotation = annotationEdit->text(),
|
||||
.destroy = destroyCheckBox->isChecked()};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,19 +17,24 @@ class CardDatabaseModel;
|
|||
class TokenDisplayModel;
|
||||
class CardInfoPictureWidget;
|
||||
|
||||
struct TokenInfo
|
||||
{
|
||||
QString name;
|
||||
QString color;
|
||||
QString pt;
|
||||
QString annotation;
|
||||
bool destroy = true;
|
||||
};
|
||||
|
||||
class DlgCreateToken : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DlgCreateToken(const QStringList &_predefinedTokens, QWidget *parent = nullptr);
|
||||
QString getName() const;
|
||||
QString getColor() const;
|
||||
QString getPT() const;
|
||||
QString getAnnotation() const;
|
||||
bool getDestroy() const;
|
||||
TokenInfo getTokenInfo() const;
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
private slots:
|
||||
void tokenSelectionChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
void updateSearch(const QString &search);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue