Re-add commander label.

This commit is contained in:
Lukas Brübach 2025-04-18 20:43:50 +02:00
parent 7ce895e23a
commit 8c711ac701
2 changed files with 9 additions and 1 deletions

View file

@ -8,6 +8,8 @@ EdhrecApiResponseCardInclusionDisplayWidget::EdhrecApiResponseCardInclusionDispl
layout = new QVBoxLayout(this);
setLayout(layout);
commanderLabel = new QLabel(this);
commanderLabel->setAlignment(Qt::AlignCenter);
amountLabel = new QLabel(this);
amountLabel->setAlignment(Qt::AlignCenter);
inclusionLabel = new QLabel(this);
@ -18,8 +20,12 @@ EdhrecApiResponseCardInclusionDisplayWidget::EdhrecApiResponseCardInclusionDispl
layout->addWidget(amountLabel);
layout->addWidget(inclusionLabel);
layout->addWidget(percentBarWidget);
commanderLabel->hide();
} else {
hide();
amountLabel->hide();
inclusionLabel->hide();
percentBarWidget->hide();
layout->addWidget(commanderLabel);
}
retranslateUi();
@ -27,6 +33,7 @@ EdhrecApiResponseCardInclusionDisplayWidget::EdhrecApiResponseCardInclusionDispl
void EdhrecApiResponseCardInclusionDisplayWidget::retranslateUi()
{
commanderLabel->setText(toDisplay.label);
amountLabel->setText(tr("In %1 decks").arg(QString::number(toDisplay.inclusion)));
inclusionLabel->setText(tr("%1% of %2 decks")
.arg(QString::number(toDisplay.inclusion / (toDisplay.potentialDecks / 100.0), 'f', 2),

View file

@ -18,6 +18,7 @@ public:
private:
QVBoxLayout *layout;
EdhrecApiResponseCardDetails toDisplay;
QLabel *commanderLabel;
QLabel *amountLabel;
QLabel *inclusionLabel;
PercentBarWidget *percentBarWidget;