split the selection panel into one card per kind of selection

This commit is contained in:
2026-08-07 18:38:55 +02:00
parent cc0ef856e3
commit 2289277e12
60 changed files with 3014 additions and 1559 deletions

View File

@@ -0,0 +1,39 @@
#include "BufferedBuildingContent.h"
#include <QVBoxLayout>
#include "Building.h"
#include "BufferSection.h"
#include "BuildingTarget.h"
#include "FactoryQueries.h"
#include "ProductionSection.h"
#include "Simulation.h"
BufferedBuildingContent::BufferedBuildingContent(const SelectionContext& context,
BuildingId id, QWidget* parent)
: SelectionContent(context, asConstructionSite(context, id), parent)
, m_id(id)
{
m_buffers = new BufferSection(this);
m_production = new ProductionSection(this);
getRuntimeLayout()->addWidget(m_buffers);
getRuntimeLayout()->addWidget(m_production);
}
void BufferedBuildingContent::refreshRuntime()
{
const Building* building = findBuilding(getContext().sim->getFactoryState(), m_id);
if (!building)
{
// Gone under the card. SelectionPanel rebuilds on the same refresh; this only
// has to avoid reading it.
return;
}
setProductionStatusSlot(*building);
const CycleInfo cycle = getCycleInfo(*building);
m_buffers->setBuffers(*building, cycle.perCycleInputs, cycle.perCycleOutputs);
m_production->setProduction(cycle.runsProduction, *building, cycle.durationSeconds,
getContext().sim->getCurrentTick());
}