mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-24 02:13:02 -07:00
Some checks are pending
Build Desktop / Configure (push) Waiting to run
Build Desktop / Debian 13 (push) Blocked by required conditions
Build Desktop / Debian 12 (push) Blocked by required conditions
Build Desktop / Fedora 44 (push) Blocked by required conditions
Build Desktop / Fedora 43 (push) Blocked by required conditions
Build Desktop / Servatrice_Debian 12 (push) Blocked by required conditions
Build Desktop / Ubuntu 26.04 (push) Blocked by required conditions
Build Desktop / Ubuntu 24.04 (push) Blocked by required conditions
Build Desktop / Arch (push) Blocked by required conditions
Build Desktop / macOS 15 (push) Blocked by required conditions
Build Desktop / macOS 13 Intel (push) Blocked by required conditions
Build Desktop / macOS 14 (push) Blocked by required conditions
Build Desktop / macOS 15 Debug (push) Blocked by required conditions
Build Desktop / Windows 10 (push) Blocked by required conditions
Build Docker Image / amd64 & arm64 (push) Waiting to run
* [Cards] Artist attribution Took 7 minutes Took 4 minutes * Nudge attribution pill on home screen to align Took 3 minutes Took 28 seconds Took 38 seconds * Lint. Took 3 minutes * Lint. Took 2 minutes * Fix rebase whoopsie Took 5 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
41 lines
1.5 KiB
C++
41 lines
1.5 KiB
C++
#ifndef COCKATRICE_ART_CROP_ATTRIBUTION_H
|
|
#define COCKATRICE_ART_CROP_ATTRIBUTION_H
|
|
|
|
#include <QStringView>
|
|
|
|
class ExactCard;
|
|
class QPainter;
|
|
class QRectF;
|
|
class QString;
|
|
|
|
/**
|
|
* @brief Builds an attribution caption for a cropped card art display.
|
|
*
|
|
* When a card image's art region is shown cropped (an "art crop"), the artist
|
|
* should be credited in the same interface. Returns an empty string when the
|
|
* database has no artist data for the card.
|
|
*
|
|
* @param card The card whose art is being displayed.
|
|
* @return Caption such as "Art: John Avon", or empty.
|
|
*/
|
|
QString buildArtAttribution(const ExactCard &card);
|
|
|
|
/**
|
|
* @brief Paints an attribution caption in a corner of a rect.
|
|
*
|
|
* Draws a subtle semi-transparent pill containing the caption, elided to fit.
|
|
*
|
|
* @param painter Painter to draw with.
|
|
* @param rect The area (e.g. the cropped art region) the caption belongs to.
|
|
* @param attribution Caption text (see buildArtAttribution()).
|
|
* @param anchor Corner of @p rect to pin the pill to (default bottom-right).
|
|
* @param scale Size multiplier for the pill (e.g. 0.8 for a smaller pill).
|
|
* @return The rect the pill was drawn in, or an empty rect if @p attribution is empty.
|
|
*/
|
|
QRectF paintArtAttribution(QPainter &painter,
|
|
const QRectF &rect,
|
|
const QString &attribution,
|
|
Qt::Alignment anchor = Qt::AlignRight | Qt::AlignBottom,
|
|
qreal scale = 1.0);
|
|
|
|
#endif // COCKATRICE_ART_CROP_ATTRIBUTION_H
|