draw recipes wherever the UI states what something makes

Implements the requirements of 0bf24a7. Recipes were explained in prose:
the recipe dialog was a grid of icon-only buttons with a text tooltip
listing name, inputs, time and output, the unlock-choice dialog listed
recipe names with the same tooltip, an item chip said nothing about where
its item came from, and a module button never showed its cost.

RecipeLineRow is the one widget that draws a recipe -- optional building
chip and name, inputs, arrow, outputs, time -- and every place that states
what something makes now goes through it: the panel's recipe summary (which
it replaces RecipeSummaryRow for), the selection dialog's option buttons,
the item production tooltip, the unlock-choice dialog's recipe lines, the
module buttons' cost lines, and the layout dialog's build cost. Its arrow
is drawn only where there are outputs, so a shipyard summary no longer
points at nothing.

ItemProducers answers where an item comes from, filtering by unlock state
per building type, and ItemTooltip draws it as a window of its own -- Qt's
tooltips are text, this one has item squares and building chips in it.
ItemChip pops it after a hover delay.

The selection dialog becomes one scrolling vertical column of buttons, each
showing its name over its recipe line, and no dialog carries a tooltip any
more. RecipeTooltip and recipes.toml's unused "icon" field go with the
behavior they served.

Two requirement amendments the implementation forced, both in this commit:
the option column scrolls when taller than the window allows, and a Smelter
or Reprocessing recipe is listed once its building is unlocked, those
recipes carrying no unlock of their own. The layout dialog's build cost
also moved out of the shared ShipStatsPanel, which the balancing tool
compiles directly and is deliberately kept free of the icon caches.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ne3mejABZoLWKLh8fgpM3x
This commit is contained in:
2026-08-11 21:20:40 +02:00
parent 0bf24a7c62
commit b7b5a92dbb
36 changed files with 934 additions and 442 deletions

View File

@@ -224,7 +224,8 @@ void MainWindow::handleEvent(std::shared_ptr<const SchematicChoicesAvailableEven
ModalPauseScope pause(*m_gameWorldView);
ModalDimScope dim(*m_dimOverlay);
SchematicChoiceDialog dialog(event->choices, m_sim->getConfig().recipes, this);
SchematicChoiceDialog dialog(event->choices, m_sim->getConfig().recipes,
m_itemIcons.get(), m_buildingIcons.get(), this);
dialog.exec();
std::shared_ptr<ApplySchematicChoiceCommand> command =
@@ -317,7 +318,7 @@ void MainWindow::openShipLayoutDialog(BuildingId shipyardId,
m_layoutBlueprints,
std::move(unlockedModuleIds),
m_gameWorldView->isDebugDrawEnabled(),
this);
m_itemIcons.get(), this);
// Opened from the panel's "Configure" button (REQ-MOD-UI-PREVIEW) or straight after
// a schematic change (REQ-MOD-UI-AUTO-DIALOG), so it opens on the panel either way.
placeOnSelectionPanel(dialog);
@@ -427,7 +428,8 @@ void MainWindow::handleEvent(std::shared_ptr<const RecipeSelectionRequestedEvent
bool autoOpenLayout = false;
std::string chosenSchematic;
RecipeSelectionDialog dialog(options, title, m_itemIcons.get(), this);
RecipeSelectionDialog dialog(options, title, m_itemIcons.get(),
m_buildingIcons.get(), this);
placeOnSelectionPanel(dialog);
if (dialog.exec() == QDialog::Accepted && dialog.getChosenId().has_value())
{