wrap UI strings with tr()

This commit is contained in:
2026-06-05 16:31:54 +02:00
parent 900b5fdec1
commit 17e9913c98
9 changed files with 72 additions and 72 deletions

View File

@@ -30,11 +30,11 @@ void ArenaWidget::buildLayout(const std::string& arenaName)
titleRow->addStretch(); titleRow->addStretch();
m_inspectButton = new QPushButton("Inspect", this); m_inspectButton = new QPushButton(tr("Inspect"), this);
connect(m_inspectButton, &QPushButton::clicked, this, &ArenaWidget::inspectRequested); connect(m_inspectButton, &QPushButton::clicked, this, &ArenaWidget::inspectRequested);
titleRow->addWidget(m_inspectButton); titleRow->addWidget(m_inspectButton);
m_startButton = new QPushButton("Start", this); m_startButton = new QPushButton(tr("Start"), this);
connect(m_startButton, &QPushButton::clicked, this, &ArenaWidget::startRequested); connect(m_startButton, &QPushButton::clicked, this, &ArenaWidget::startRequested);
titleRow->addWidget(m_startButton); titleRow->addWidget(m_startButton);
@@ -94,7 +94,7 @@ void ArenaWidget::updateStatus(const ArenaStatus& status)
if (status.finished && status.winnerTeam == ti) if (status.finished && status.winnerTeam == ti)
{ {
header->setText("[WON] " + QString::fromStdString(team.name)); header->setText(tr("[WON] %1").arg(QString::fromStdString(team.name)));
} }
else else
{ {

View File

@@ -22,15 +22,15 @@ BalancingWindow::BalancingWindow(const BalancingConfig& balancingConfig,
, m_inspectedArenaIndex(-1) , m_inspectedArenaIndex(-1)
{ {
m_visuals = VisualsLoader::load(m_configDir + "/visuals.toml"); m_visuals = VisualsLoader::load(m_configDir + "/visuals.toml");
setWindowTitle("DotaFactory — Balancing Tool"); setWindowTitle(tr("DotaFactory — Balancing Tool"));
resize(800, 600); resize(800, 600);
QVBoxLayout* mainLayout = new QVBoxLayout(this); QVBoxLayout* mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(0, 0, 0, 0); mainLayout->setContentsMargins(0, 0, 0, 0);
QHBoxLayout* buttonRow = new QHBoxLayout(); QHBoxLayout* buttonRow = new QHBoxLayout();
m_reloadButton = new QPushButton("Reload Config", this); m_reloadButton = new QPushButton(tr("Reload Config"), this);
m_startAllButton = new QPushButton("Start All", this); m_startAllButton = new QPushButton(tr("Start All"), this);
buttonRow->addWidget(m_reloadButton); buttonRow->addWidget(m_reloadButton);
buttonRow->addWidget(m_startAllButton); buttonRow->addWidget(m_startAllButton);
buttonRow->addStretch(); buttonRow->addStretch();
@@ -146,7 +146,7 @@ void BalancingWindow::reloadConfig()
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {
QMessageBox::critical(this, "Reload Failed", QString::fromStdString(e.what())); QMessageBox::critical(this, tr("Reload Failed"), QString::fromStdString(e.what()));
} }
} }

View File

@@ -18,7 +18,7 @@ InspectWindow::InspectWindow(ArenaSimulation* sim, const VisualsConfig* visuals,
: QWidget(parent) : QWidget(parent)
, m_sim(sim) , m_sim(sim)
{ {
setWindowTitle(QString("Inspect \u2014 %1").arg(QString::fromStdString(arenaName))); setWindowTitle(tr("Inspect \u2014 %1").arg(QString::fromStdString(arenaName)));
resize(900, 700); resize(900, 700);
setAttribute(Qt::WA_DeleteOnClose, false); setAttribute(Qt::WA_DeleteOnClose, false);
@@ -163,7 +163,7 @@ void InspectWindow::updateInfoPanel(const ArenaStatus& status)
if (status.finished && status.winnerTeam == ti) if (status.finished && status.winnerTeam == ti)
{ {
header->setText("[WON] " + QString::fromStdString(team.name)); header->setText(tr("[WON] %1").arg(QString::fromStdString(team.name)));
} }
else else
{ {

View File

@@ -29,7 +29,7 @@ BlueprintPanel::BlueprintPanel(Simulation* sim, const GameConfig* config, QWidge
layout->setContentsMargins(4, 4, 4, 4); layout->setContentsMargins(4, 4, 4, 4);
layout->setSpacing(4); layout->setSpacing(4);
m_createBtn = new QPushButton("Create Blueprint", this); m_createBtn = new QPushButton(tr("Create Blueprint"), this);
m_createBtn->setFixedHeight(48); m_createBtn->setFixedHeight(48);
m_createBtn->setEnabled(false); m_createBtn->setEnabled(false);
layout->addWidget(m_createBtn); layout->addWidget(m_createBtn);
@@ -50,8 +50,8 @@ BlueprintPanel::BlueprintPanel(Simulation* sim, const GameConfig* config, QWidge
connect(m_createBtn, &QPushButton::clicked, this, &BlueprintPanel::onCreateClicked); connect(m_createBtn, &QPushButton::clicked, this, &BlueprintPanel::onCreateClicked);
QHBoxLayout* ioLayout = new QHBoxLayout(); QHBoxLayout* ioLayout = new QHBoxLayout();
m_saveBtn = new QPushButton("Save", this); m_saveBtn = new QPushButton(tr("Save"), this);
m_loadBtn = new QPushButton("Load", this); m_loadBtn = new QPushButton(tr("Load"), this);
m_saveBtn->setFixedHeight(36); m_saveBtn->setFixedHeight(36);
m_loadBtn->setFixedHeight(36); m_loadBtn->setFixedHeight(36);
ioLayout->addWidget(m_saveBtn); ioLayout->addWidget(m_saveBtn);
@@ -93,7 +93,7 @@ void BlueprintPanel::onCreateClicked()
bool ok = false; bool ok = false;
const QString name = QInputDialog::getText( const QString name = QInputDialog::getText(
this, "Create Blueprint", "Blueprint name:", QLineEdit::Normal, QString(), &ok); this, tr("Create Blueprint"), tr("Blueprint name:"), QLineEdit::Normal, QString(), &ok);
if (!ok || name.trimmed().isEmpty()) { return; } if (!ok || name.trimmed().isEmpty()) { return; }
bp.name = name.trimmed(); bp.name = name.trimmed();
@@ -223,7 +223,7 @@ void BlueprintPanel::rebuildButtons()
{ {
const Blueprint& bp = m_blueprints[static_cast<std::size_t>(i)]; const Blueprint& bp = m_blueprints[static_cast<std::size_t>(i)];
const int cost = computeBlueprintCost(bp); const int cost = computeBlueprintCost(bp);
const QString label = bp.name + "\n" + QString::number(cost) + " Blocks"; const QString label = bp.name + "\n" + tr("%1 Blocks").arg(cost);
QWidget* row = new QWidget(m_buttonsContainer); QWidget* row = new QWidget(m_buttonsContainer);
QHBoxLayout* rowLayout = new QHBoxLayout(row); QHBoxLayout* rowLayout = new QHBoxLayout(row);
@@ -266,26 +266,26 @@ void BlueprintPanel::onSaveClicked()
QFile file(path); QFile file(path);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
{ {
QMessageBox::critical(this, "Save Failed", QMessageBox::critical(this, tr("Save Failed"),
QString("Could not open file for writing:\n%1").arg(path)); tr("Could not open file for writing:\n%1").arg(path));
return; return;
} }
file.write(QByteArray::fromStdString(content)); file.write(QByteArray::fromStdString(content));
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {
QMessageBox::critical(this, "Save Failed", QMessageBox::critical(this, tr("Save Failed"),
QString("Failed to save blueprints:\n%1").arg(e.what())); tr("Failed to save blueprints:\n%1").arg(e.what()));
} }
} }
void BlueprintPanel::onLoadClicked() void BlueprintPanel::onLoadClicked()
{ {
QMessageBox box(this); QMessageBox box(this);
box.setWindowTitle("Load Blueprints"); box.setWindowTitle(tr("Load Blueprints"));
box.setText("Load blueprints? This will replace all current blueprints."); box.setText(tr("Load blueprints? This will replace all current blueprints."));
QPushButton* confirmBtn = box.addButton("Confirm", QMessageBox::AcceptRole); QPushButton* confirmBtn = box.addButton(tr("Confirm"), QMessageBox::AcceptRole);
box.addButton("Cancel", QMessageBox::RejectRole); box.addButton(tr("Cancel"), QMessageBox::RejectRole);
box.exec(); box.exec();
if (box.clickedButton() != confirmBtn) { return; } if (box.clickedButton() != confirmBtn) { return; }
@@ -295,8 +295,8 @@ void BlueprintPanel::onLoadClicked()
QFile file(path); QFile file(path);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
{ {
QMessageBox::critical(this, "Load Failed", QMessageBox::critical(this, tr("Load Failed"),
QString("Could not open file:\n%1").arg(path)); tr("Could not open file:\n%1").arg(path));
return; return;
} }
const std::string content = file.readAll().toStdString(); const std::string content = file.readAll().toStdString();
@@ -313,8 +313,8 @@ void BlueprintPanel::onLoadClicked()
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {
QMessageBox::critical(this, "Load Failed", QMessageBox::critical(this, tr("Load Failed"),
QString("Failed to load blueprints:\n%1").arg(e.what())); tr("Failed to load blueprints:\n%1").arg(e.what()));
} }
} }

View File

@@ -63,7 +63,7 @@ BuildButtonGrid::BuildButtonGrid(const GameConfig* config, QWidget* parent)
m_costs[def.type] = def.cost; m_costs[def.type] = def.cost;
const QString label = displayName(def.id) const QString label = displayName(def.id)
+ "\n" + QString::number(def.cost) + " Blocks"; + "\n" + tr("%1 Blocks").arg(def.cost);
QPushButton* btn = new QPushButton(label, this); QPushButton* btn = new QPushButton(label, this);
btn->setCheckable(true); btn->setCheckable(true);
btn->setFixedHeight(48); btn->setFixedHeight(48);
@@ -83,7 +83,7 @@ BuildButtonGrid::BuildButtonGrid(const GameConfig* config, QWidget* parent)
} }
connect(mapper, qOverload<int>(&QSignalMapper::mapped), this, &BuildButtonGrid::onBuildButton); connect(mapper, qOverload<int>(&QSignalMapper::mapped), this, &BuildButtonGrid::onBuildButton);
m_demolishButton = new QPushButton("Demolish", this); m_demolishButton = new QPushButton(tr("Demolish"), this);
m_demolishButton->setCheckable(true); m_demolishButton->setCheckable(true);
m_demolishButton->setFixedHeight(48); m_demolishButton->setFixedHeight(48);
layout->addWidget(m_demolishButton, row, col); layout->addWidget(m_demolishButton, row, col);

View File

@@ -21,8 +21,8 @@ HeaderBar::HeaderBar(QWidget* parent)
layout->setSpacing(8); layout->setSpacing(8);
m_timeLabel = new QLabel("00:00", this); m_timeLabel = new QLabel("00:00", this);
m_blocksLabel = new QLabel("Blocks: 0", this); m_blocksLabel = new QLabel(tr("Blocks: 0"), this);
m_bossLabel = new QLabel("Boss Wave #1 Next boss: 5:00", this); m_bossLabel = new QLabel(tr("Boss Wave #1 Next boss: 5:00"), this);
layout->addWidget(m_timeLabel); layout->addWidget(m_timeLabel);
layout->addWidget(m_blocksLabel); layout->addWidget(m_blocksLabel);
layout->addStretch(); layout->addStretch();
@@ -57,14 +57,14 @@ void HeaderBar::onStateUpdated(Tick tick, int buildingBlocks, double gameSpeed,
.arg(minutes, 2, 10, QChar('0')) .arg(minutes, 2, 10, QChar('0'))
.arg(seconds, 2, 10, QChar('0'))); .arg(seconds, 2, 10, QChar('0')));
m_blocksLabel->setText(QString("Blocks: %1").arg(buildingBlocks)); m_blocksLabel->setText(tr("Blocks: %1").arg(buildingBlocks));
const int bossSeconds = static_cast<int>(ticksToSeconds( const int bossSeconds = static_cast<int>(ticksToSeconds(
bossCountdownTicks > 0 ? bossCountdownTicks : 0)); bossCountdownTicks > 0 ? bossCountdownTicks : 0));
const int bossMin = bossSeconds / 60; const int bossMin = bossSeconds / 60;
const int bossSec = bossSeconds % 60; const int bossSec = bossSeconds % 60;
m_bossLabel->setText( m_bossLabel->setText(
QString("Boss Wave #%1 Next boss: %2:%3") tr("Boss Wave #%1 Next boss: %2:%3")
.arg(bossCounter) .arg(bossCounter)
.arg(bossMin) .arg(bossMin)
.arg(bossSec, 2, 10, QChar('0'))); .arg(bossSec, 2, 10, QChar('0')));

View File

@@ -28,7 +28,7 @@ MainWindow::MainWindow(Simulation* sim, const std::string& configDir, QWidget* p
, m_visuals(VisualsLoader::load(configDir + "/visuals.toml")) , m_visuals(VisualsLoader::load(configDir + "/visuals.toml"))
, m_sim(sim) , m_sim(sim)
{ {
setWindowTitle("Dota Factory"); setWindowTitle(tr("Dota Factory"));
resize(1280, 768); resize(1280, 768);
m_headerBar = new HeaderBar(this); m_headerBar = new HeaderBar(this);
@@ -127,8 +127,8 @@ MainWindow::MainWindow(Simulation* sim, const std::string& configDir, QWidget* p
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {
QMessageBox::critical(this, "Load Error", QMessageBox::critical(this, tr("Load Error"),
QString("Failed to load ship_layouts.toml:\n%1").arg(e.what())); tr("Failed to load ship_layouts.toml:\n%1").arg(e.what()));
m_layoutBlueprints.clear(); m_layoutBlueprints.clear();
} }
} }
@@ -183,10 +183,10 @@ void MainWindow::onEscapeMenuRequested()
m_gameWorldView->setGameSpeed(0.0); m_gameWorldView->setGameSpeed(0.0);
QMessageBox box(this); QMessageBox box(this);
box.setWindowTitle("Paused"); box.setWindowTitle(tr("Paused"));
QPushButton* continueBtn = box.addButton("Continue", QMessageBox::AcceptRole); QPushButton* continueBtn = box.addButton(tr("Continue"), QMessageBox::AcceptRole);
QPushButton* restartBtn = box.addButton("Restart", QMessageBox::ResetRole); QPushButton* restartBtn = box.addButton(tr("Restart"), QMessageBox::ResetRole);
QPushButton* quitBtn = box.addButton("Quit", QMessageBox::DestructiveRole); QPushButton* quitBtn = box.addButton(tr("Quit"), QMessageBox::DestructiveRole);
box.setEscapeButton(continueBtn); box.setEscapeButton(continueBtn);
box.exec(); box.exec();
@@ -202,8 +202,8 @@ void MainWindow::onEscapeMenuRequested()
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {
QMessageBox::critical(this, "Config Error", QMessageBox::critical(this, tr("Config Error"),
QString("Failed to reload config:\n%1").arg(e.what())); tr("Failed to reload config:\n%1").arg(e.what()));
m_gameWorldView->setGameSpeed(prevSpeed); m_gameWorldView->setGameSpeed(prevSpeed);
return; return;
} }
@@ -255,12 +255,12 @@ void MainWindow::onGameOver()
const int seconds = totalSeconds % 60; const int seconds = totalSeconds % 60;
QMessageBox box(this); QMessageBox box(this);
box.setWindowTitle("Game Over"); box.setWindowTitle(tr("Game Over"));
box.setText(QString("HQ destroyed!\nSurvival time: %1:%2") box.setText(tr("HQ destroyed!\nSurvival time: %1:%2")
.arg(minutes, 2, 10, QChar('0')) .arg(minutes, 2, 10, QChar('0'))
.arg(seconds, 2, 10, QChar('0'))); .arg(seconds, 2, 10, QChar('0')));
QPushButton* restartBtn = box.addButton("Restart", QMessageBox::AcceptRole); QPushButton* restartBtn = box.addButton(tr("Restart"), QMessageBox::AcceptRole);
box.addButton("Quit", QMessageBox::RejectRole); box.addButton(tr("Quit"), QMessageBox::RejectRole);
box.exec(); box.exec();
if (box.clickedButton() == restartBtn) if (box.clickedButton() == restartBtn)
@@ -274,8 +274,8 @@ void MainWindow::onGameOver()
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {
QMessageBox::critical(this, "Config Error", QMessageBox::critical(this, tr("Config Error"),
QString("Failed to reload config:\n%1").arg(e.what())); tr("Failed to reload config:\n%1").arg(e.what()));
return; return;
} }
m_gameWorldView->resetForNewGame(); m_gameWorldView->resetForNewGame();

View File

@@ -69,10 +69,10 @@ QString rotationLabel(Rotation r)
{ {
switch (r) switch (r)
{ {
case Rotation::North: return "North (↑)"; case Rotation::North: return QObject::tr("North (↑)");
case Rotation::East: return "East (→)"; case Rotation::East: return QObject::tr("East (→)");
case Rotation::South: return "South (↓)"; case Rotation::South: return QObject::tr("South (↓)");
case Rotation::West: return "West (←)"; case Rotation::West: return QObject::tr("West (←)");
} }
return ""; return "";
} }
@@ -96,13 +96,13 @@ SelectedBuildingPanel::SelectedBuildingPanel(Simulation* sim,
m_titleLabel = new QLabel(this); m_titleLabel = new QLabel(this);
m_recipeCombo = new QComboBox(this); m_recipeCombo = new QComboBox(this);
m_clearBeltBtn = new QPushButton("Clear Items", this); m_clearBeltBtn = new QPushButton(tr("Clear Items"), this);
m_filterALabel = new QLabel(this); m_filterALabel = new QLabel(this);
m_filterAList = new QListWidget(this); m_filterAList = new QListWidget(this);
m_filterBLabel = new QLabel(this); m_filterBLabel = new QLabel(this);
m_filterBList = new QListWidget(this); m_filterBList = new QListWidget(this);
m_layoutPreview = new ShipLayoutPreview(this); m_layoutPreview = new ShipLayoutPreview(this);
m_configureLayoutBtn = new QPushButton("Configure Layout", this); m_configureLayoutBtn = new QPushButton(tr("Configure Layout"), this);
m_buffersLabel = new QLabel(this); m_buffersLabel = new QLabel(this);
m_buffersLabel->setWordWrap(true); m_buffersLabel->setWordWrap(true);
@@ -192,7 +192,7 @@ void SelectedBuildingPanel::buildSingle(BuildingId id)
QString progress; QString progress;
if (s->completesAt == 0) if (s->completesAt == 0)
{ {
progress = "Queued"; progress = tr("Queued");
} }
else else
{ {
@@ -207,15 +207,15 @@ void SelectedBuildingPanel::buildSingle(BuildingId id)
const Tick elapsed = m_sim->currentTick() - (s->completesAt - duration); const Tick elapsed = m_sim->currentTick() - (s->completesAt - duration);
const int pct = static_cast<int>( const int pct = static_cast<int>(
std::max(Tick(0), std::min(duration, elapsed)) * 100 / duration); std::max(Tick(0), std::min(duration, elapsed)) * 100 / duration);
progress = QString::number(pct) + "% complete"; progress = tr("%1% complete").arg(pct);
} }
else else
{ {
progress = "Building..."; progress = tr("Building...");
} }
} }
m_titleLabel->setText("(Building) " + buildingTypeName(s->type)); m_titleLabel->setText(tr("(Building) %1").arg(buildingTypeName(s->type)));
m_titleLabel->show(); m_titleLabel->show();
m_buffersLabel->setText(progress); m_buffersLabel->setText(progress);
m_buffersLabel->show(); m_buffersLabel->show();
@@ -231,7 +231,7 @@ void SelectedBuildingPanel::buildSingle(BuildingId id)
m_recipeCombo->blockSignals(true); m_recipeCombo->blockSignals(true);
m_recipeCombo->clear(); m_recipeCombo->clear();
m_recipeCombo->addItem("(none)", QString()); m_recipeCombo->addItem(tr("(none)"), QString());
if (b->type == BuildingType::Shipyard) if (b->type == BuildingType::Shipyard)
{ {
@@ -333,7 +333,7 @@ void SelectedBuildingPanel::refreshBuffers(const Building* b)
if (!b->inputBuffer.counts.empty()) if (!b->inputBuffer.counts.empty())
{ {
bufText += "Input: "; bufText += tr("Input: ");
for (const std::pair<const ItemType, int>& entry : b->inputBuffer.counts) for (const std::pair<const ItemType, int>& entry : b->inputBuffer.counts)
{ {
int perCycle = 0; int perCycle = 0;
@@ -389,7 +389,7 @@ void SelectedBuildingPanel::refreshBuffers(const Building* b)
{ {
outCounts[item.type.id]++; outCounts[item.type.id]++;
} }
bufText += "Output: "; bufText += tr("Output: ");
for (const RecipeOutput& out : recipe->outputs) for (const RecipeOutput& out : recipe->outputs)
{ {
const std::map<std::string, int>::const_iterator it = const std::map<std::string, int>::const_iterator it =
@@ -407,7 +407,7 @@ void SelectedBuildingPanel::refreshBuffers(const Building* b)
{ {
outCounts[item.type.id]++; outCounts[item.type.id]++;
} }
bufText += "Output: "; bufText += tr("Output: ");
for (const std::pair<const std::string, int>& entry : outCounts) for (const std::pair<const std::string, int>& entry : outCounts)
{ {
bufText += QString::fromStdString(entry.first) bufText += QString::fromStdString(entry.first)
@@ -436,7 +436,7 @@ void SelectedBuildingPanel::refreshBuffers(const Building* b)
} }
} }
bufText += QString("Cycle: %1 s\n").arg(durationSeconds, 0, 'f', 1); bufText += tr("Cycle: %1 s\n").arg(durationSeconds, 0, 'f', 1);
if (b->production.has_value()) if (b->production.has_value())
{ {
@@ -446,11 +446,11 @@ void SelectedBuildingPanel::refreshBuffers(const Building* b)
const Tick elapsed = currentTick - (completesAt - cycleTicks); const Tick elapsed = currentTick - (completesAt - cycleTicks);
const int pct = static_cast<int>( const int pct = static_cast<int>(
std::max(Tick(0), std::min(cycleTicks, elapsed)) * 100 / cycleTicks); std::max(Tick(0), std::min(cycleTicks, elapsed)) * 100 / cycleTicks);
bufText += QString("Progress: %1%\n").arg(pct); bufText += tr("Progress: %1%\n").arg(pct);
} }
else else
{ {
bufText += "Progress: idle\n"; bufText += tr("Progress: idle\n");
} }
} }
@@ -496,7 +496,7 @@ void SelectedBuildingPanel::onStateUpdated(Tick /*tick*/, int /*blocks*/, double
{ {
// If the panel was last showing this id as a construction site, the // If the panel was last showing this id as a construction site, the
// full building UI (recipe combo, ports, etc.) hasn't been built yet. // full building UI (recipe combo, ports, etc.) hasn't been built yet.
if (m_titleLabel->text().startsWith("(Building) ")) if (m_titleLabel->text().startsWith(tr("(Building) ")))
{ {
rebuild(); rebuild();
} }
@@ -592,7 +592,7 @@ void SelectedBuildingPanel::buildSplitterFilters(QPoint splitterTile)
const QString& dirLabel, const QString& dirLabel,
const std::vector<ItemType>& filter) const std::vector<ItemType>& filter)
{ {
label->setText(dirLabel + " filter (empty = all):"); label->setText(tr("%1 filter (empty = all):").arg(dirLabel));
list->blockSignals(true); list->blockSignals(true);
list->clear(); list->clear();
for (const std::string& itemId : items) for (const std::string& itemId : items)

View File

@@ -289,7 +289,7 @@ public:
layout->setContentsMargins(4, 4, 4, 4); layout->setContentsMargins(4, 4, 4, 4);
layout->setSpacing(4); layout->setSpacing(4);
QPushButton* createBtn = new QPushButton("Create Blueprint", this); QPushButton* createBtn = new QPushButton(tr("Create Blueprint"), this);
createBtn->setFixedHeight(36); createBtn->setFixedHeight(36);
layout->addWidget(createBtn); layout->addWidget(createBtn);
@@ -308,7 +308,7 @@ public:
connect(createBtn, &QPushButton::clicked, this, [this]() { connect(createBtn, &QPushButton::clicked, this, [this]() {
bool ok = false; bool ok = false;
const QString name = QInputDialog::getText( const QString name = QInputDialog::getText(
this, "Create Blueprint", "Blueprint name:", this, tr("Create Blueprint"), tr("Blueprint name:"),
QLineEdit::Normal, QString(), &ok); QLineEdit::Normal, QString(), &ok);
if (!ok || name.trimmed().isEmpty()) { return; } if (!ok || name.trimmed().isEmpty()) { return; }
@@ -398,7 +398,7 @@ ShipLayoutDialog::ShipLayoutDialog(const GameConfig* config,
, m_removeButton(nullptr) , m_removeButton(nullptr)
, m_gridWidget(nullptr) , m_gridWidget(nullptr)
{ {
setWindowTitle("Configure Ship Layout"); setWindowTitle(tr("Configure Ship Layout"));
setModal(true); setModal(true);
// Find the ship's layout grid. // Find the ship's layout grid.
@@ -482,7 +482,7 @@ ShipLayoutDialog::ShipLayoutDialog(const GameConfig* config,
this, &ShipLayoutDialog::onModuleButtonClicked); this, &ShipLayoutDialog::onModuleButtonClicked);
// Remove button. // Remove button.
m_removeButton = new QPushButton("Remove", this); m_removeButton = new QPushButton(tr("Remove"), this);
m_removeButton->setCheckable(true); m_removeButton->setCheckable(true);
m_removeButton->setFixedHeight(48); m_removeButton->setFixedHeight(48);
if (col > 0) if (col > 0)
@@ -513,8 +513,8 @@ ShipLayoutDialog::ShipLayoutDialog(const GameConfig* config,
// Confirm / Cancel buttons. // Confirm / Cancel buttons.
QHBoxLayout* bottomBar = new QHBoxLayout(); QHBoxLayout* bottomBar = new QHBoxLayout();
QPushButton* confirmBtn = new QPushButton("Confirm", this); QPushButton* confirmBtn = new QPushButton(tr("Confirm"), this);
QPushButton* cancelBtn = new QPushButton("Cancel", this); QPushButton* cancelBtn = new QPushButton(tr("Cancel"), this);
bottomBar->addWidget(confirmBtn); bottomBar->addWidget(confirmBtn);
bottomBar->addWidget(cancelBtn); bottomBar->addWidget(cancelBtn);
rightLayout->addLayout(bottomBar); rightLayout->addLayout(bottomBar);