78 lines
1.9 KiB
C++
78 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include <QPoint>
|
|
#include <QWidget>
|
|
|
|
#include "Building.h"
|
|
#include "EntityId.h"
|
|
#include "GameConfig.h"
|
|
#include "RecipesConfig.h"
|
|
#include "ShipLayout.h"
|
|
#include "ShipsConfig.h"
|
|
#include "Tick.h"
|
|
|
|
class Simulation;
|
|
class ShipLayoutPreview;
|
|
class QLabel;
|
|
class QComboBox;
|
|
class QListWidget;
|
|
class QPushButton;
|
|
class QVBoxLayout;
|
|
|
|
class SelectedBuildingPanel : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
SelectedBuildingPanel(Simulation* sim, const GameConfig* config,
|
|
QWidget* parent = nullptr);
|
|
|
|
signals:
|
|
void layoutDialogRequested(EntityId shipyardId);
|
|
|
|
public slots:
|
|
void onSelectionChanged(const std::vector<EntityId>& ids);
|
|
void onStateUpdated(Tick tick, int blocks, double speed);
|
|
|
|
private slots:
|
|
void onRecipeChanged(int comboIndex);
|
|
void onClearBelt();
|
|
void onSplitterFilterChanged();
|
|
|
|
private:
|
|
void rebuild();
|
|
void clearContent();
|
|
void buildEmpty();
|
|
void buildSingle(EntityId id);
|
|
void buildMulti(const std::vector<EntityId>& ids);
|
|
void refreshBuffers(const Building* b);
|
|
void buildSplitterFilters(QPoint splitterTile);
|
|
const RecipeDef* findRecipe(const Building* b) const;
|
|
const ShipDef* findShipDef(const std::string& id) const;
|
|
std::vector<std::string> allItemIds() const;
|
|
|
|
Simulation* m_sim;
|
|
const GameConfig* m_config;
|
|
std::vector<EntityId> m_selection;
|
|
|
|
QVBoxLayout* m_layout;
|
|
QLabel* m_titleLabel;
|
|
QComboBox* m_recipeCombo;
|
|
QPushButton* m_clearBeltBtn;
|
|
QLabel* m_filterALabel;
|
|
QListWidget* m_filterAList;
|
|
QLabel* m_filterBLabel;
|
|
QListWidget* m_filterBList;
|
|
QLabel* m_buffersLabel;
|
|
|
|
ShipLayoutPreview* m_layoutPreview;
|
|
QPushButton* m_configureLayoutBtn;
|
|
|
|
EntityId m_singleId;
|
|
QPoint m_splitterTile;
|
|
std::string m_currentRecipeId;
|
|
};
|