Files
dota_factory/src/balancing/InspectWindow.h
Malte Langkabel db1b7b617f Rename EntitySelectedEvent to EntitySelectionChangedEvent
The event also fires on deselection and now carries a set of entities
rather than a single one, so the "SelectionChanged" name (matching
SelectionChangedEvent and ScrapSelectionChangedEvent) is more accurate.
Pure rename: header + include guard, CMake entry, and all usages.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y7N59FsLA5e2kuVdqe4Uhc
2026-07-20 20:32:35 +02:00

76 lines
1.9 KiB
C++

#pragma once
#include <optional>
#include <string>
#include <vector>
#include <QLabel>
#include <QPushButton>
#include <QTimer>
#include <QWidget>
#include "entt/entity/entity.hpp"
#include "ArenaSimulation.h"
#include "EntitySelectionChangedEvent.h"
#include "EventHandler.h"
#include "GameConfig.h"
#include "GameSpeedChangedEvent.h"
#include "VisualsConfig.h"
class ArenaView;
class ShipStatsPanel;
class InspectWindow : public QWidget,
public CombinedEventHandler<EntitySelectionChangedEvent,
GameSpeedChangedEvent>
{
Q_OBJECT
public:
InspectWindow(ArenaSimulation* sim, const GameConfig* config,
const VisualsConfig* visuals,
const std::string& arenaName, QWidget* parent = nullptr);
~InspectWindow() override;
protected:
void closeEvent(QCloseEvent* event) override;
void keyPressEvent(QKeyEvent* event) override;
private:
void handleEvent(std::shared_ptr<const EntitySelectionChangedEvent> event) override;
void handleEvent(std::shared_ptr<const GameSpeedChangedEvent> event) override;
private slots:
void onSpeedButton(int index);
void pollStatus();
private:
void updateInfoPanel(const ArenaStatus& status);
void refreshEntityStats();
ArenaSimulation* m_sim;
const GameConfig* m_config;
ArenaView* m_arenaView;
std::vector<QPushButton*> m_speedButtons;
QLabel* m_durationLabel;
QLabel* m_team1Header;
QLabel* m_team2Header;
QLabel* m_team1Threat;
QLabel* m_team2Threat;
QLabel* m_team1Ehp;
QLabel* m_team2Ehp;
QLabel* m_team1Content;
QLabel* m_team2Content;
QTimer* m_pollTimer;
std::optional<entt::entity> m_selectedEntity;
QLabel* m_entityTitleLabel;
ShipStatsPanel* m_entityStatsPanel;
QLabel* m_stationStatsLabel;
static const double kSpeeds[];
static const int kSpeedCount;
};