40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <map>
|
|
#include <string>
|
|
|
|
#include <QWidget>
|
|
|
|
#include "SelectionContext.h"
|
|
|
|
struct Building;
|
|
class ItemChipRow;
|
|
class SectionBox;
|
|
|
|
// The input and output buffer contents of one building, each a captioned section of item
|
|
// chips (REQ-UI-SINGLE-SELECTION).
|
|
//
|
|
// Counting what is in the buffers is the same for every building type, so it happens
|
|
// here; what a cycle consumes and produces is not, so the owning content supplies those
|
|
// per-cycle amounts. An item with no entry in the maps is shown without a denominator,
|
|
// and a section holding nothing is not shown at all.
|
|
class BufferSection : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit BufferSection(const SelectionContext& context, QWidget* parent = nullptr);
|
|
|
|
// perCycleInputs and perCycleOutputs map an item id to the amount one production
|
|
// cycle consumes or produces. Both may be empty, for a building that runs no cycle.
|
|
void setBuffers(const Building& building,
|
|
const std::map<std::string, int>& perCycleInputs,
|
|
const std::map<std::string, int>& perCycleOutputs);
|
|
|
|
private:
|
|
SectionBox* m_inputSection;
|
|
ItemChipRow* m_inputChips;
|
|
SectionBox* m_outputSection;
|
|
ItemChipRow* m_outputChips;
|
|
};
|