mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 16:32:16 -07:00
Get rid of cardCornerRadius property
This commit is contained in:
parent
8389884aae
commit
6b5acb7fa0
8 changed files with 8 additions and 21 deletions
|
|
@ -86,8 +86,8 @@ void CardInfoPictureEnlargedWidget::paintEvent(QPaintEvent *event)
|
|||
QPoint topLeft{(width() - scaledSize.width()) / 2, (height() - scaledSize.height()) / 2};
|
||||
|
||||
// Define the radius for rounded corners
|
||||
qreal radius = SettingsCache::instance().getCardCornerRadius() *
|
||||
scaledSize.width(); // Adjust the radius as needed for rounded corners
|
||||
// Adjust the radius as needed for rounded corners
|
||||
qreal radius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * scaledSize.width() : 0.;
|
||||
|
||||
QStylePainter painter(this);
|
||||
// Fill the background with transparent color to ensure rounded corners are rendered properly
|
||||
|
|
|
|||
|
|
@ -191,8 +191,8 @@ void CardInfoPictureWidget::paintEvent(QPaintEvent *event)
|
|||
QRect targetRect{targetX, targetY, targetW, targetH};
|
||||
|
||||
// Compute rounded corner radius
|
||||
qreal radius = SettingsCache::instance().getCardCornerRadius() *
|
||||
static_cast<qreal>(targetRect.width()); // Ensure consistent rounding
|
||||
// Ensure consistent rounding
|
||||
qreal radius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * static_cast<qreal>(targetRect.width()) : 0.;
|
||||
|
||||
// Draw the pixmap with rounded corners
|
||||
QStylePainter painter(this);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ AbstractCardDragItem::~AbstractCardDragItem()
|
|||
QPainterPath AbstractCardDragItem::shape() const
|
||||
{
|
||||
QPainterPath shape;
|
||||
qreal cardCornerRadius = SettingsCache::instance().getCardCornerRadius() * CARD_WIDTH;
|
||||
qreal cardCornerRadius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * CARD_WIDTH : 0.0;
|
||||
shape.addRoundedRect(boundingRect(), cardCornerRadius, cardCornerRadius);
|
||||
return shape;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ QRectF AbstractCardItem::boundingRect() const
|
|||
QPainterPath AbstractCardItem::shape() const
|
||||
{
|
||||
QPainterPath shape;
|
||||
qreal cardCornerRadius = SettingsCache::instance().getCardCornerRadius() * CARD_WIDTH;
|
||||
qreal cardCornerRadius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * CARD_WIDTH : 0.0;
|
||||
shape.addRoundedRect(boundingRect(), cardCornerRadius, cardCornerRadius);
|
||||
return shape;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ void DeckViewCard::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||
pen.setJoinStyle(Qt::MiterJoin);
|
||||
pen.setColor(originZone == DECK_ZONE_MAIN ? Qt::green : Qt::red);
|
||||
painter->setPen(pen);
|
||||
qreal cardRadius = SettingsCache::instance().getCardCornerRadius() * (CARD_WIDTH - 3);
|
||||
qreal cardRadius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * (CARD_WIDTH - 3) : 0.0;
|
||||
painter->drawRoundedRect(QRectF(1.5, 1.5, CARD_WIDTH - 3., CARD_HEIGHT - 3.), cardRadius, cardRadius);
|
||||
painter->restore();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ QRectF PileZone::boundingRect() const
|
|||
QPainterPath PileZone::shape() const
|
||||
{
|
||||
QPainterPath shape;
|
||||
qreal cardCornerRadius = SettingsCache::instance().getCardCornerRadius() * CARD_WIDTH;
|
||||
qreal cardCornerRadius = SettingsCache::instance().getRoundCardCorners() ? 0.05 * CARD_WIDTH : 0.0;
|
||||
shape.addRoundedRect(boundingRect(), cardCornerRadius, cardCornerRadius);
|
||||
return shape;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -332,14 +332,6 @@ SettingsCache::SettingsCache()
|
|||
rememberGameSettings = settings->value("game/remembergamesettings", true).toBool();
|
||||
clientID = settings->value("personal/clientid", CLIENT_INFO_NOT_SET).toString();
|
||||
clientVersion = settings->value("personal/clientversion", CLIENT_INFO_NOT_SET).toString();
|
||||
|
||||
connect(this, &SettingsCache::roundCardCornersChanged, this, [this](bool _roundCardCornersChanged) {
|
||||
if (_roundCardCornersChanged) {
|
||||
emit cardCornerRadiusChanged(0.05);
|
||||
} else {
|
||||
emit cardCornerRadiusChanged(0.);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void SettingsCache::setUseTearOffMenus(bool _useTearOffMenus)
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@ signals:
|
|||
void downloadSpoilerStatusChanged();
|
||||
void useTearOffMenusChanged(bool state);
|
||||
void roundCardCornersChanged(bool roundCardCorners);
|
||||
void cardCornerRadiusChanged(qreal cardCornerRadius);
|
||||
|
||||
private:
|
||||
QSettings *settings;
|
||||
|
|
@ -735,10 +734,6 @@ public:
|
|||
{
|
||||
return roundCardCorners;
|
||||
}
|
||||
qreal getCardCornerRadius() const
|
||||
{
|
||||
return roundCardCorners ? 0.05 : 0.;
|
||||
}
|
||||
|
||||
static SettingsCache &instance();
|
||||
void resetPaths();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue