mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-10 20:13:24 -08:00
* Refactor printing selector onto a host interface Move the deck-editor coupling out of PrintingSelector behind PrintingSelectorHost so the same widget can run where there is no deck. The deck editor keeps its behaviour through DeckEditorPrintingSelectorHost; a selection-only host hides deck controls, reports a picked printing, and highlights it in the grid. * Add a printings tab to the token dialog The token list and the printing selector now share one tabbed surface. Picking a printing sets the provider id used by the live preview and by the created token, while an untouched dialog keeps the existing preference lookup. Names with no printings show a placeholder instead of an empty grid. * Address printing selector review feedback Hold the deck editor printing-selector host by value, since its deck editor is known at construction. Emit printingSelected for every left-click pick instead of gating it on selection-only mode; consumers that do not want picks simply do not connect. * Use the shared layout helper in the token tabs Replace the hand-built zero-margin layouts with QtUtils::makeLayout, which is the helper the printing selector already uses.
75 lines
2.1 KiB
C++
75 lines
2.1 KiB
C++
/**
|
|
* @file dlg_create_token.h
|
|
* @ingroup GameDialogs
|
|
*/
|
|
//! \todo Document this file.
|
|
|
|
#ifndef DLG_CREATETOKEN_H
|
|
#define DLG_CREATETOKEN_H
|
|
|
|
#include "../../interface/widgets/printing_selector/printing_selector_selection_host.h"
|
|
|
|
#include <QDialog>
|
|
#include <QList>
|
|
#include <QString>
|
|
#include <QStringList>
|
|
#include <libcockatrice/game/player/token_info.h>
|
|
#include <qtmetamacros.h>
|
|
|
|
class QLabel;
|
|
class QLineEdit;
|
|
class QComboBox;
|
|
class QCheckBox;
|
|
class QRadioButton;
|
|
class QTabWidget;
|
|
class QTreeView;
|
|
class CardDatabaseModel;
|
|
class TokenDisplayModel;
|
|
class TokenPreviewWidget;
|
|
class PrintingSelector;
|
|
class QModelIndex;
|
|
class QWidget;
|
|
|
|
class DlgCreateToken : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit DlgCreateToken(const QStringList &_predefinedTokens, QWidget *parent = nullptr);
|
|
[[nodiscard]] TokenInfo getTokenInfo() const;
|
|
|
|
protected:
|
|
void closeEvent(QCloseEvent *event) override;
|
|
private slots:
|
|
void faceDownCheckBoxToggled(bool checked);
|
|
void tokenSelectionChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
|
void updateSearch(const QString &search);
|
|
void syncPrintingsToToken();
|
|
void updatePreview();
|
|
void actChooseTokenFromAll(bool checked);
|
|
void actChooseTokenFromDeck(bool checked);
|
|
void actOk();
|
|
void actReject();
|
|
|
|
private:
|
|
CardDatabaseModel *cardDatabaseModel;
|
|
TokenDisplayModel *cardDatabaseDisplayModel;
|
|
QStringList predefinedTokens;
|
|
QLabel *nameLabel, *colorLabel, *ptLabel, *annotationLabel;
|
|
QComboBox *colorEdit;
|
|
QLineEdit *nameEdit, *ptEdit, *annotationEdit;
|
|
QCheckBox *destroyCheckBox;
|
|
QCheckBox *faceDownCheckBox;
|
|
QRadioButton *chooseTokenFromAllRadioButton, *chooseTokenFromDeckRadioButton;
|
|
TokenPreviewWidget *pic;
|
|
QTreeView *chooseTokenView;
|
|
QTabWidget *tokenSourceTabs;
|
|
PrintingSelector *printingSelector;
|
|
PrintingSelectorSelectionHost printingSelectorHost;
|
|
QString explicitProviderId;
|
|
QString explicitProviderName;
|
|
|
|
[[nodiscard]] TokenInfo tokenDraft() const;
|
|
void updateSearchFieldWithoutUpdatingFilter(const QString &newValue) const;
|
|
};
|
|
|
|
#endif
|