allow multi-select for ships/stations, mixable with scrap
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
#include "Building.h"
|
||||
#include "BuildingId.h"
|
||||
#include "DebugDrawToggledEvent.h"
|
||||
#include "EntitySelectedEvent.h"
|
||||
#include "EntitySelectionChangedEvent.h"
|
||||
#include "EventHandler.h"
|
||||
#include "GameConfig.h"
|
||||
#include "PlayerCommandsAppliedEvent.h"
|
||||
@@ -36,7 +36,7 @@ class QVBoxLayout;
|
||||
class SelectedBuildingPanel : public QWidget,
|
||||
public CombinedEventHandler<TickAdvancedEvent,
|
||||
PlayerCommandsAppliedEvent,
|
||||
EntitySelectedEvent,
|
||||
EntitySelectionChangedEvent,
|
||||
SelectionChangedEvent,
|
||||
ScrapSelectionChangedEvent,
|
||||
DebugDrawToggledEvent>
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
private:
|
||||
void handleEvent(std::shared_ptr<const TickAdvancedEvent> event) override;
|
||||
void handleEvent(std::shared_ptr<const PlayerCommandsAppliedEvent> event) override;
|
||||
void handleEvent(std::shared_ptr<const EntitySelectedEvent> event) override;
|
||||
void handleEvent(std::shared_ptr<const EntitySelectionChangedEvent> event) override;
|
||||
void handleEvent(std::shared_ptr<const SelectionChangedEvent> event) override;
|
||||
void handleEvent(std::shared_ptr<const ScrapSelectionChangedEvent> event) override;
|
||||
void handleEvent(std::shared_ptr<const DebugDrawToggledEvent> event) override;
|
||||
@@ -80,8 +80,9 @@ private:
|
||||
void buildEmpty();
|
||||
void buildSingle(BuildingId id);
|
||||
void buildMulti(const std::vector<BuildingId>& ids);
|
||||
void buildScrap();
|
||||
void refreshScrapTotal();
|
||||
// "Scrap: N" for the summed remaining amount of the selected piles (REQ-UI-SCRAP-PANEL).
|
||||
QString scrapTotalText() const;
|
||||
void refreshBuffers(const Building* b);
|
||||
void refreshSiteProgress(const ConstructionSite* s);
|
||||
void updateShipyardLayoutWidgets(BuildingType type,
|
||||
@@ -115,16 +116,24 @@ private:
|
||||
std::string m_currentRecipeId;
|
||||
|
||||
bool m_debugDraw = false;
|
||||
std::optional<entt::entity> m_selectedEntity;
|
||||
// The selected ships/defence stations. Shares the "field" selection category with
|
||||
// scrap (m_selectedScrap): both can be non-empty at once (REQ-UI-SELECTION-CATEGORIES).
|
||||
std::vector<entt::entity> m_selectedEntities;
|
||||
ShipStatsPanel* m_entityStatsPanel;
|
||||
QLabel* m_entityTitleLabel;
|
||||
QLabel* m_stationStatsLabel;
|
||||
QLabel* m_entitySummaryLabel;
|
||||
|
||||
std::vector<entt::entity> m_selectedScrap;
|
||||
QLabel* m_scrapLabel;
|
||||
|
||||
// Renders the combined field selection (actors + scrap): a single-actor stats panel
|
||||
// or a multi-actor summary, plus the scrap total when scrap is also selected
|
||||
// (REQ-UI-FIELD-MULTI-SELECTION).
|
||||
void buildFieldSelection();
|
||||
void buildEntityShip(entt::entity entity);
|
||||
void buildEntityStation(entt::entity entity);
|
||||
void buildEntitySummary();
|
||||
void refreshEntityStats();
|
||||
void clearEntityDisplay();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user