Reviewed-on: #3 Co-authored-by: Malte Langkabel <malte.langkabel@gmail.com> Co-committed-by: Malte Langkabel <malte.langkabel@gmail.com>
50 lines
1.5 KiB
C++
50 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <vector>
|
|
|
|
#include <QWidget>
|
|
|
|
#include "ArtifactCountChangedEvent.h"
|
|
#include "BossWaveUpdatedEvent.h"
|
|
#include "BuildingBlocksChangedEvent.h"
|
|
#include "EventHandler.h"
|
|
#include "GameSpeedChangedEvent.h"
|
|
#include "Tick.h"
|
|
#include "TickAdvancedEvent.h"
|
|
|
|
class QLabel;
|
|
class QPushButton;
|
|
|
|
class HeaderBar : public QWidget,
|
|
public CombinedEventHandler<TickAdvancedEvent,
|
|
BuildingBlocksChangedEvent,
|
|
GameSpeedChangedEvent,
|
|
BossWaveUpdatedEvent,
|
|
ArtifactCountChangedEvent>
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit HeaderBar(QWidget* parent = nullptr);
|
|
~HeaderBar() override;
|
|
|
|
private slots:
|
|
void onSpeedButton(int index);
|
|
|
|
private:
|
|
void handleEvent(std::shared_ptr<const TickAdvancedEvent> event) override;
|
|
void handleEvent(std::shared_ptr<const BuildingBlocksChangedEvent> event) override;
|
|
void handleEvent(std::shared_ptr<const GameSpeedChangedEvent> event) override;
|
|
void handleEvent(std::shared_ptr<const BossWaveUpdatedEvent> event) override;
|
|
void handleEvent(std::shared_ptr<const ArtifactCountChangedEvent> event) override;
|
|
|
|
QLabel* m_timeLabel;
|
|
QLabel* m_blocksLabel;
|
|
QLabel* m_artifactsLabel;
|
|
QLabel* m_bossLabel;
|
|
std::vector<QPushButton*> m_speedButtons;
|
|
|
|
static const double kSpeeds[];
|
|
static const int kSpeedCount;
|
|
};
|