removed old temporary phrase and formatPrase implementations

This commit is contained in:
Geoffray Levasseur committed 2026-11-17 11:42:28 +01:00
1 parent 6e634e13d2
commit e96b871779
14 files changed
+231 -598

No files matched your search

+5 -20
View File
@@ -39,7 +39,6 @@
#include "Dpi/DpiPixelPointer.h"
#include <QHash>
#include <QMouseEvent>
namespace Cevo {
@@ -71,20 +70,6 @@ constexpr QPoint RingPosition[21] = {
QPoint(160, 64), // Mir
};
// Phrases/Phrases2 (StringTables.pas) aren't ported; disclosed
// plain-English placeholders for this dialog's own text.
QString phrase(const QString &key)
{
static const QHash<QString, QString> table = {
{QStringLiteral("TITLE_WONDERS"), QStringLiteral("World Wonders")},
{QStringLiteral("NOWONDER"), QStringLiteral("No wonder built yet")},
{QStringLiteral("DESTROYED"), QStringLiteral("Destroyed")},
{QStringLiteral("EXPIRED"), QStringLiteral("Expired")},
};
const auto it = table.constFind(key);
return it != table.constEnd() ? it.value() : key;
}
} // namespace
WondersDlg::WondersDlg(QWidget *parent) : BufferedDrawDlg(parent), ui(new Ui::WondersDlg)
@@ -94,7 +79,7 @@ WondersDlg::WondersDlg(QWidget *parent) : BufferedDrawDlg(parent), ui(new Ui::Wo
ui->closeBtn->onClick = [this] { close(); };
initButtons();
onShow = [this] {
setWindowTitle(phrase(QStringLiteral("TITLE_WONDERS")));
setWindowTitle(phrases.lookup(QStringLiteral("TITLE_WONDERS")));
selection = -1;
offscreenPaint();
};
@@ -206,7 +191,7 @@ void WondersDlg::offscreenPaint()
btnFrame(canvas, ui->closeBtn->geometry(), *MainTexture);
canvas.font().assign(UniFont[static_cast<std::size_t>(FontType::Caption)]);
QString s = phrase(QStringLiteral("TITLE_WONDERS"));
QString s = phrases.lookup(QStringLiteral("TITLE_WONDERS"));
risedTextOut(canvas, (width() - biColorTextWidth(canvas, s)) / 2 - 1, 7, s);
canvas.font().assign(UniFont[static_cast<std::size_t>(FontType::Normal)]);
@@ -258,7 +243,7 @@ void WondersDlg::offscreenPaint()
}
if (!haveWonder) {
s = phrase(QStringLiteral("NOWONDER"));
s = phrases.lookup(QStringLiteral("NOWONDER"));
risedTextOut(canvas, center.x() - biColorTextWidth(canvas, s) / 2, center.y() - canvas.textHeight(s) / 2, s);
}
canvas.end();
@@ -278,9 +263,9 @@ void WondersDlg::vpaint(Dpi::Canvas &canvas)
loweredTextOut(canvas, -1, *MainTexture, (width() - biColorTextWidth(canvas, s)) / 2, height() - 3 - 36 - 10, s);
if (ClientTools::myRO->Wonder[selection].CityID == WonderDestroyed)
s = phrase(QStringLiteral("DESTROYED"));
s = phrases.lookup(QStringLiteral("DESTROYED"));
else if (ClientTools::myRO->Wonder[selection].EffectiveOwner < 0)
s = phrase(QStringLiteral("EXPIRED"));
s = phrases.lookup(QStringLiteral("EXPIRED"));
else
s = Tribes::tribe[static_cast<std::size_t>(ClientTools::myRO->Wonder[selection].EffectiveOwner)]->tPhrase(
QStringLiteral("WONDEROWNER"));