give the selection cards their own parts instead of label blobs
This commit is contained in:
@@ -1,18 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "BehaviorKind.h"
|
||||
#include "ShipLayout.h"
|
||||
#include "ShipStatsCalculator.h"
|
||||
|
||||
struct GameConfig;
|
||||
class QLabel;
|
||||
#include "BehaviorKind.h"
|
||||
|
||||
struct GameConfig;
|
||||
class BarRow;
|
||||
class SectionBox;
|
||||
class StatRow;
|
||||
|
||||
// The hull stats and capability module summaries of one ship, as a bar for HP and a
|
||||
// label/value row for everything else. Shared by the live selection card
|
||||
// (REQ-UI-SHIP-STATS-PANEL), the layout configuration dialog's design preview
|
||||
// (REQ-MOD-UI-STATS-PANEL) and the balancing tool, so all three read alike.
|
||||
//
|
||||
// The behavior row is for consumers with no header to put it in. The selection card
|
||||
// shows the behavior in its header instead (REQ-UI-SHIP-BEHAVIOR) and leaves the row
|
||||
// unset; the design preview has no live ship to have a behavior at all.
|
||||
class ShipStatsPanel : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -20,44 +30,47 @@ class ShipStatsPanel : public QWidget
|
||||
public:
|
||||
explicit ShipStatsPanel(const GameConfig* config, QWidget* parent = nullptr);
|
||||
|
||||
// Stats of a design rather than of a live ship: the HP bar reads full, because the
|
||||
// number shown is the maximum the design would have.
|
||||
void refresh(const std::string& shipId,
|
||||
const std::vector<PlacedModule>& modules);
|
||||
|
||||
void refreshFromLive(const ShipStats& stats, float currentHp);
|
||||
|
||||
// Displays the ship's current top-priority behavior (REQ-UI-SHIP-BEHAVIOR).
|
||||
// Shows the ship's top-priority behavior as a row of its own. Never called by the
|
||||
// selection card, which has a header slot for it.
|
||||
void setBehavior(BehaviorKind kind);
|
||||
|
||||
void setThreatCost(double cost);
|
||||
void setDebugDrawEnabled(bool enabled);
|
||||
|
||||
private:
|
||||
void applyStats(const ShipStats& stats, const QString& hpText);
|
||||
void applyStats(const ShipStats& stats, double hpFraction, const QString& hpText);
|
||||
|
||||
const GameConfig* m_config;
|
||||
bool m_debugDraw = false;
|
||||
|
||||
QLabel* m_behaviorLabel;
|
||||
QLabel* m_hpLabel;
|
||||
QLabel* m_speedLabel;
|
||||
QLabel* m_sensorRangeLabel;
|
||||
QLabel* m_mainAccelLabel;
|
||||
QLabel* m_maneuveringAccelLabel;
|
||||
QLabel* m_angularAccelLabel;
|
||||
QLabel* m_maxRotSpeedLabel;
|
||||
QLabel* m_cargoCapacityLabel;
|
||||
BarRow* m_hpBar;
|
||||
StatRow* m_speedRow;
|
||||
StatRow* m_sensorRangeRow;
|
||||
StatRow* m_mainAccelRow;
|
||||
StatRow* m_maneuveringAccelRow;
|
||||
StatRow* m_angularAccelRow;
|
||||
StatRow* m_maxRotSpeedRow;
|
||||
StatRow* m_cargoCapacityRow;
|
||||
|
||||
QWidget* m_weaponSection;
|
||||
QLabel* m_weaponDpsLabel;
|
||||
QLabel* m_weaponRangeLabel;
|
||||
SectionBox* m_weaponSection;
|
||||
StatRow* m_weaponDpsRow;
|
||||
StatRow* m_weaponRangeRow;
|
||||
|
||||
QWidget* m_salvageSection;
|
||||
QLabel* m_salvageRateLabel;
|
||||
QLabel* m_salvageRangeLabel;
|
||||
SectionBox* m_salvageSection;
|
||||
StatRow* m_salvageRateRow;
|
||||
StatRow* m_salvageRangeRow;
|
||||
|
||||
QWidget* m_repairSection;
|
||||
QLabel* m_repairRateLabel;
|
||||
QLabel* m_repairRangeLabel;
|
||||
SectionBox* m_repairSection;
|
||||
StatRow* m_repairRateRow;
|
||||
StatRow* m_repairRangeRow;
|
||||
|
||||
QLabel* m_threatCostLabel;
|
||||
StatRow* m_behaviorRow;
|
||||
StatRow* m_threatCostRow;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user