show implicitly unlocked items in schematic unlock dialog

This commit is contained in:
2026-06-13 18:01:59 +02:00
parent 5317f35198
commit 3716c2b734
6 changed files with 230 additions and 12 deletions

View File

@@ -3,6 +3,7 @@
#include <QHBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QStringList>
#include <QVBoxLayout>
SchematicChoiceDialog::SchematicChoiceDialog(
@@ -74,6 +75,31 @@ SchematicChoiceDialog::SchematicChoiceDialog(
statusLabel->setAlignment(Qt::AlignCenter);
cardLayout->addWidget(statusLabel);
QLabel* unlocksHeaderLabel = new QLabel(tr("Unlocks recipes for:"), card);
QFont unlocksHeaderFont = unlocksHeaderLabel->font();
unlocksHeaderFont.setBold(true);
unlocksHeaderLabel->setFont(unlocksHeaderFont);
unlocksHeaderLabel->setAlignment(Qt::AlignCenter);
cardLayout->addWidget(unlocksHeaderLabel);
QString unlocksText;
if (option.newlyUnlockedItemNames.empty())
{
unlocksText = tr("None");
}
else
{
QStringList itemLines;
for (const std::string& itemName : option.newlyUnlockedItemNames)
{
itemLines << QString::fromStdString(itemName);
}
unlocksText = itemLines.join("\n");
}
QLabel* unlocksLabel = new QLabel(unlocksText, card);
unlocksLabel->setAlignment(Qt::AlignCenter);
cardLayout->addWidget(unlocksLabel);
QPushButton* selectButton = new QPushButton(tr("Select"), card);
cardLayout->addWidget(selectButton);