give the selection cards their own parts instead of label blobs

This commit is contained in:
2026-08-07 18:43:23 +02:00
parent 2289277e12
commit 075e44d295
54 changed files with 1505 additions and 533 deletions

View File

@@ -1,18 +1,19 @@
#include "DebrisContent.h"
#include <QLabel>
#include <QVBoxLayout>
#include "DebrisScrap.h"
#include "Simulation.h"
#include "StatRow.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);
m_scrapRow = new StatRow(tr("Scrap remaining"), this);
m_scrapRow->setValueEmphasized(true);
getRuntimeLayout()->addWidget(m_scrapRow);
setIdentity(QPixmap(), tr("Debris"));
if (m_debris.size() > 1)
@@ -24,7 +25,8 @@ DebrisContent::DebrisContent(const SelectionContext& context,
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)));
// (REQ-UI-DEBRIS-CLICK-SELECT), so it is re-summed rather than remembered. With
// several pieces selected it is their sum (REQ-UI-SELECTION-AGGREGATE).
m_scrapRow->setValue(QString::number(
sumDebrisScrap(getContext().sim->getAdmin(), m_debris)));
}