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,30 @@
#include "DebrisContent.h"
#include <QLabel>
#include <QVBoxLayout>
#include "DebrisScrap.h"
#include "Simulation.h"
DebrisContent::DebrisContent(const SelectionContext& context,
const SelectionRequest& request, QWidget* parent)
: SelectionContent(context, std::nullopt, parent)
, m_debris(request.debris)
{
m_scrapLabel = new QLabel(this);
getRuntimeLayout()->addWidget(m_scrapLabel);
setIdentity(QPixmap(), tr("Debris"));
if (m_debris.size() > 1)
{
setCountSlot(static_cast<int>(m_debris.size()));
}
}
void DebrisContent::refreshRuntime()
{
// The value falls as the debris is collected and as pieces despawn
// (REQ-UI-DEBRIS-CLICK-SELECT), so it is re-summed rather than remembered.
m_scrapLabel->setText(tr("Scrap remaining: %1")
.arg(sumDebrisScrap(getContext().sim->getAdmin(), m_debris)));
}