list what a belt is carrying, and clear it by name

The belt card's only content was a button reading "Clear stuck items", which
assumed a state the items need not be in. It now reads "Clear items", and above
it the card lists what the selected tiles hold -- one item chip per type, the
same chip the buffer sections and the HQ's block stock draw -- so a line's
contents can be read before they are removed, and can be read at all: items on a
moving belt are too small and too transient to count by eye, and items inside a
tunnel are drawn nowhere.

BeltSystem gains countItems(tiles), a query of the same kind as
forEachVisualItem: a method rather than exposed tile containers, so the per-tile
representation stays swappable. It walks the same five containers as clearTiles,
in the same order, so the list and the button cannot drift apart.

The tunnel's two ends are now told apart. Items in transit are counted on the
exit they are travelling toward, and a clear removes exactly what the panel
listed for the tile it acts on: the exit discards them, the entry leaves them
travelling. BeltSystemTest's tunnel case splits in two accordingly.

Splitters now aggregate with belts and tunnel ends. Their output filters are
per-object configuration, which an aggregate simply does not show -- a splitter
selected alone still gets them. Both cards share one BeltItemList widget, and
both derive their tiles from collectBeltTiles, so nothing is stated twice.

The mixed count summary loses the clear action it carried: a button acting on
part of a selection is worse than no button, and the tiles can be selected by
themselves.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ne3mejABZoLWKLh8fgpM3x
This commit is contained in:
2026-08-19 14:38:45 +02:00
parent 7547d954f1
commit fbb1af85e3
18 changed files with 444 additions and 92 deletions

View File

@@ -0,0 +1,45 @@
#pragma once
#include <vector>
#include <QWidget>
#include "BuildingId.h"
#include "SelectionContext.h"
class EmptyNote;
class ItemChipRow;
class SectionBox;
// What the selected belt-subsystem tiles are carrying (REQ-UI-BELT-ITEMS): one item chip
// per item type held across the whole selection, in the same form the buffer sections and
// the HQ's block stock use (REQ-UI-SINGLE-SELECTION, REQ-UI-HQ-PANEL).
//
// It stands above the clear action so the player reads a line's contents before emptying
// it, and it is the only place those contents can be read at all -- items on a moving belt
// are too small and too transient to count by eye, and items inside a tunnel are drawn
// nowhere (REQ-BLD-TUNNEL-TRANSIT).
//
// Shared by the belt card and the splitter card, which show the same thing over different
// selections (REQ-UI-SELECTION-AGGREGATE).
class BeltItemList : public QWidget
{
Q_OBJECT
public:
BeltItemList(const SelectionContext& context, const std::vector<BuildingId>& ids,
QWidget* parent = nullptr);
// Re-reads what the tiles hold. Called per refresh of the owning card's runtime
// group, the counts changing as often as items move.
void refresh();
private:
SelectionContext m_context;
std::vector<BuildingId> m_ids;
SectionBox* m_section;
ItemChipRow* m_chips;
// Shown in the chips' place while the tiles carry nothing, so the card holds one
// shape as items come and go (REQ-UI-BELT-ITEMS).
EmptyNote* m_emptyNote;
};