give the selection cards their own parts instead of label blobs
This commit is contained in:
@@ -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)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user