replace combined stateUpdated signal with individual events
This commit is contained in:
@@ -5,7 +5,9 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "BuildingBlocksChangedEvent.h"
|
||||
#include "BuildingId.h"
|
||||
#include "EventHandler.h"
|
||||
#include "ShipLayoutBlueprint.h"
|
||||
#include "Tick.h"
|
||||
#include "VisualsConfig.h"
|
||||
@@ -19,26 +21,29 @@ class BlueprintPanel;
|
||||
class QCloseEvent;
|
||||
class QResizeEvent;
|
||||
|
||||
class MainWindow : public QWidget
|
||||
class MainWindow : public QWidget,
|
||||
public EventHandler<BuildingBlocksChangedEvent>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(Simulation* sim, const std::string& configDir, QWidget* parent = nullptr);
|
||||
~MainWindow() override;
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
private:
|
||||
void handleEvent(std::shared_ptr<const BuildingBlocksChangedEvent> event) override;
|
||||
void layoutPanels();
|
||||
|
||||
private slots:
|
||||
void onGameOver();
|
||||
void onStateUpdated(Tick tick, int blocks, double speed);
|
||||
void onEscapeMenuRequested();
|
||||
void onLayoutDialogRequested(BuildingId shipyardId);
|
||||
|
||||
private:
|
||||
void layoutPanels();
|
||||
|
||||
std::string m_configDir;
|
||||
VisualsConfig m_visuals;
|
||||
Simulation* m_sim;
|
||||
|
||||
Reference in New Issue
Block a user