Draw the token preview P/T as the hover-panel pill

The preview painted the name and P/T unconditionally: the name duplicated the
artwork, and the raw P/T text was drawn even when it matched the printed value,
which looked wrong at non-default dialog sizes.

- Suppress the card name over a token picture via a small AbstractCardItem hook;
  cards without art still show it.
- Draw only a P/T that differs from the printed getPowTough() as the #7700
  hover-panel pill: dark rounded scrim, bold white text, anchored on the printed
  P/T box and clamped inside the card.
- Use designated CardRef initializers in the new code.

The face-up draft still previews while face-down creation is selected.
This commit is contained in:
Lukas Brübach 2026-11-09 09:53:57 +01:00
parent e62c250152
commit 60941f5c70
4 changed files with 99 additions and 13 deletions

View file

@ -33,6 +33,7 @@
#include <libcockatrice/settings/cards_display_settings.h>
#include <libcockatrice/settings/interface_settings.h>
#include <libcockatrice/settings/layouts_settings.h>
#include <libcockatrice/utility/card_ref.h>
#include <libcockatrice/utility/string_limits.h>
#include <qnamespace.h>
@ -285,7 +286,8 @@ TokenInfo DlgCreateToken::tokenDraft() const
// Match the normalization applied when the player creates the token, so
// manually typed aliases and the default P/T preview the actual result.
const ExactCard correctedCard = CardDatabaseManager::query()->guessCard({token.name, token.providerId});
const ExactCard correctedCard =
CardDatabaseManager::query()->guessCard(CardRef{.name = token.name, .providerId = token.providerId});
if (correctedCard) {
token.name = correctedCard.getName();
if (token.pt.isEmpty()) {