[Client] Choose a token's printing in the create-token dialog (#7815)

* 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.
This commit is contained in:
BruebachL 2026-11-10 10:05:02 +01:00 • committed by Lukas Brübach
parent 0498ea8907
commit 154d5d4906
18 changed files with 442 additions and 97 deletions

View file

@ -7,6 +7,8 @@
#ifndef DLG_CREATETOKEN_H
#define DLG_CREATETOKEN_H
#include "../../interface/widgets/printing_selector/printing_selector_selection_host.h"
#include <QDialog>
#include <QList>
#include <QString>
@ -19,10 +21,12 @@ class QLineEdit;
class QComboBox;
class QCheckBox;
class QRadioButton;
class QTabWidget;
class QTreeView;
class CardDatabaseModel;
class TokenDisplayModel;
class TokenPreviewWidget;
class PrintingSelector;
class QModelIndex;
class QWidget;
@ -39,6 +43,7 @@ private slots:
void faceDownCheckBoxToggled(bool checked);
void tokenSelectionChanged(const QModelIndex &current, const QModelIndex &previous);
void updateSearch(const QString &search);
void syncPrintingsToToken();
void updatePreview();
void actChooseTokenFromAll(bool checked);
void actChooseTokenFromDeck(bool checked);
@ -57,6 +62,11 @@ private:
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;