switch to using own event system
This commit is contained in:
@@ -5,10 +5,12 @@
|
||||
#include <QWidget>
|
||||
|
||||
#include "Blueprint.h"
|
||||
#include "BlueprintModeExitedEvent.h"
|
||||
#include "BuildingBlocksChangedEvent.h"
|
||||
#include "BuildingId.h"
|
||||
#include "EventHandler.h"
|
||||
#include "GameConfig.h"
|
||||
#include "SelectionChangedEvent.h"
|
||||
#include "Tick.h"
|
||||
|
||||
class Simulation;
|
||||
@@ -17,7 +19,9 @@ class QScrollArea;
|
||||
class QVBoxLayout;
|
||||
|
||||
class BlueprintPanel : public QWidget,
|
||||
public EventHandler<BuildingBlocksChangedEvent>
|
||||
public CombinedEventHandler<BuildingBlocksChangedEvent,
|
||||
SelectionChangedEvent,
|
||||
BlueprintModeExitedEvent>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -25,16 +29,10 @@ public:
|
||||
BlueprintPanel(Simulation* sim, const GameConfig* config, QWidget* parent = nullptr);
|
||||
~BlueprintPanel() override;
|
||||
|
||||
public slots:
|
||||
void onSelectionChanged(const std::vector<BuildingId>& ids);
|
||||
void clearActiveBlueprintButton();
|
||||
|
||||
signals:
|
||||
void blueprintPlacementRequested(Blueprint blueprint);
|
||||
void exitBlueprintModeRequested();
|
||||
|
||||
private:
|
||||
void handleEvent(std::shared_ptr<const BuildingBlocksChangedEvent> event) override;
|
||||
void handleEvent(std::shared_ptr<const SelectionChangedEvent> event) override;
|
||||
void handleEvent(std::shared_ptr<const BlueprintModeExitedEvent> event) override;
|
||||
|
||||
private slots:
|
||||
void onCreateClicked();
|
||||
@@ -44,6 +42,8 @@ private slots:
|
||||
void onLoadClicked();
|
||||
|
||||
private:
|
||||
void onSelectionChanged(const std::vector<BuildingId>& ids);
|
||||
void clearActiveBlueprintButton();
|
||||
Blueprint createBlueprintFromSelection() const;
|
||||
int computeBlueprintCost(const Blueprint& bp) const;
|
||||
void rebuildButtons();
|
||||
|
||||
Reference in New Issue
Block a user