add spacing between items in header bar
This commit is contained in:
@@ -54,24 +54,34 @@ HeaderBar::HeaderBar(const GameConfig* config, const std::string& itemsIconDir,
|
|||||||
m_artifactsLabel->setToolTip(
|
m_artifactsLabel->setToolTip(
|
||||||
QString::fromStdString(*config->world.artifactTooltip));
|
QString::fromStdString(*config->world.artifactTooltip));
|
||||||
}
|
}
|
||||||
m_bossLabel = new QLabel(tr("Boss Wave #1 Next boss: 5:00"), this);
|
m_bossWaveLabel = new QLabel(tr("Boss Wave #1"), this);
|
||||||
layout->addWidget(m_timeLabel);
|
m_nextBossLabel = new QLabel(tr("Next boss: 5:00"), this);
|
||||||
layout->addWidget(m_blocksLabel);
|
|
||||||
layout->addWidget(m_artifactsLabel);
|
|
||||||
layout->addStretch();
|
|
||||||
layout->addWidget(m_bossLabel);
|
|
||||||
|
|
||||||
// Asteroid expansion button, to the left of the speed buttons (REQ-UI-HEADER,
|
// Asteroid expansion button, to the left of the speed buttons (REQ-UI-HEADER,
|
||||||
// REQ-UI-EXPAND-BUTTON). Caption/enabled state are set on the first
|
// REQ-UI-EXPAND-BUTTON). Caption/enabled state are set on the first
|
||||||
// ExpansionCostChangedEvent; clicking requests an ExpandAsteroidCommand.
|
// ExpansionCostChangedEvent; clicking requests an ExpandAsteroidCommand.
|
||||||
m_expandButton = new QPushButton(tr("Expand"), this);
|
m_expandButton = new QPushButton(tr("Expand"), this);
|
||||||
layout->addWidget(m_expandButton);
|
|
||||||
connect(m_expandButton, &QPushButton::clicked, this, []() {
|
connect(m_expandButton, &QPushButton::clicked, this, []() {
|
||||||
EventManager::getInstance()->sendEventImmediately(
|
EventManager::getInstance()->sendEventImmediately(
|
||||||
std::make_shared<CommandRequestedEvent>(
|
std::make_shared<CommandRequestedEvent>(
|
||||||
std::make_shared<ExpandAsteroidCommand>()));
|
std::make_shared<ExpandAsteroidCommand>()));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const int itemSpacing = 20;
|
||||||
|
|
||||||
|
layout->addWidget(m_timeLabel);
|
||||||
|
layout->addSpacing(itemSpacing);
|
||||||
|
layout->addWidget(m_blocksLabel);
|
||||||
|
layout->addSpacing(itemSpacing);
|
||||||
|
layout->addWidget(m_artifactsLabel);
|
||||||
|
layout->addStretch();
|
||||||
|
layout->addWidget(m_bossWaveLabel);
|
||||||
|
layout->addSpacing(itemSpacing);
|
||||||
|
layout->addWidget(m_nextBossLabel);
|
||||||
|
layout->addSpacing(itemSpacing);
|
||||||
|
layout->addWidget(m_expandButton);
|
||||||
|
layout->addSpacing(itemSpacing);
|
||||||
|
|
||||||
const char* labels[] = { "0x", "0.5x", "1x", "2x", "10x" };
|
const char* labels[] = { "0x", "0.5x", "1x", "2x", "10x" };
|
||||||
QSignalMapper* mapper = new QSignalMapper(this);
|
QSignalMapper* mapper = new QSignalMapper(this);
|
||||||
for (int i = 0; i < kSpeedCount; ++i)
|
for (int i = 0; i < kSpeedCount; ++i)
|
||||||
@@ -185,9 +195,11 @@ void HeaderBar::handleEvent(std::shared_ptr<const BossWaveUpdatedEvent> event)
|
|||||||
{
|
{
|
||||||
const int bossSeconds = static_cast<int>(
|
const int bossSeconds = static_cast<int>(
|
||||||
ticksToSeconds(event->countdownTicks > 0 ? event->countdownTicks : 0));
|
ticksToSeconds(event->countdownTicks > 0 ? event->countdownTicks : 0));
|
||||||
m_bossLabel->setText(
|
m_bossWaveLabel->setText(
|
||||||
tr("Boss Wave #%1 Next boss: %2:%3")
|
tr("Boss Wave #%1")
|
||||||
.arg(event->counter)
|
.arg(event->counter));
|
||||||
|
m_nextBossLabel->setText(
|
||||||
|
tr("Next boss: %1:%2")
|
||||||
.arg(bossSeconds / 60)
|
.arg(bossSeconds / 60)
|
||||||
.arg(bossSeconds % 60, 2, 10, QChar('0')));
|
.arg(bossSeconds % 60, 2, 10, QChar('0')));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,8 @@ private:
|
|||||||
QLabel* m_timeLabel;
|
QLabel* m_timeLabel;
|
||||||
QLabel* m_blocksLabel;
|
QLabel* m_blocksLabel;
|
||||||
QLabel* m_artifactsLabel;
|
QLabel* m_artifactsLabel;
|
||||||
QLabel* m_bossLabel;
|
QLabel* m_bossWaveLabel;
|
||||||
|
QLabel* m_nextBossLabel;
|
||||||
QPushButton* m_expandButton;
|
QPushButton* m_expandButton;
|
||||||
std::vector<QPushButton*> m_speedButtons;
|
std::vector<QPushButton*> m_speedButtons;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user