Add tooltip for building blocks in header bar
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
const double HeaderBar::kSpeeds[] = { 0.0, 0.5, 1.0, 2.0, 10.0 };
|
||||
const int HeaderBar::kSpeedCount = 5;
|
||||
|
||||
HeaderBar::HeaderBar(QWidget* parent)
|
||||
HeaderBar::HeaderBar(const GameConfig* config, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
@@ -26,6 +26,11 @@ HeaderBar::HeaderBar(QWidget* parent)
|
||||
|
||||
m_timeLabel = new QLabel("00:00", this);
|
||||
m_blocksLabel = new QLabel(tr("Building Blocks: 0"), this);
|
||||
if (config->world.buildingBlocksTooltip)
|
||||
{
|
||||
m_blocksLabel->setToolTip(
|
||||
QString::fromStdString(*config->world.buildingBlocksTooltip));
|
||||
}
|
||||
m_artifactsLabel = new QLabel(tr("Artifacts: 0/?"), this);
|
||||
m_bossLabel = new QLabel(tr("Boss Wave #1 Next boss: 5:00"), this);
|
||||
layout->addWidget(m_timeLabel);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "BuildingBlocksChangedEvent.h"
|
||||
#include "EventHandler.h"
|
||||
#include "ExpansionCostChangedEvent.h"
|
||||
#include "GameConfig.h"
|
||||
#include "GameSpeedChangedEvent.h"
|
||||
#include "Tick.h"
|
||||
#include "TickAdvancedEvent.h"
|
||||
@@ -27,7 +28,7 @@ class HeaderBar : public QWidget,
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit HeaderBar(QWidget* parent = nullptr);
|
||||
explicit HeaderBar(const GameConfig* config, QWidget* parent = nullptr);
|
||||
~HeaderBar() override;
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -42,7 +42,7 @@ MainWindow::MainWindow(Simulation* sim, const std::string& configDir,
|
||||
setWindowTitle(tr("Dota Factory"));
|
||||
resize(1280, 768);
|
||||
|
||||
m_headerBar = new HeaderBar(this);
|
||||
m_headerBar = new HeaderBar(&sim->config(), this);
|
||||
|
||||
m_gameWorldView = new GameWorldView(sim, &sim->config(), &m_visuals, m_configDir,
|
||||
m_replay.get(), this);
|
||||
|
||||
Reference in New Issue
Block a user