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

+11 -34
View File
@@ -33,9 +33,9 @@
#include "Cevo/CevoTexture.h"
#include "Cevo/Database.h"
#include "ClientTools.h"
#include "Global.h"
#include "Tribes.h"
#include <QHash>
#include <QKeyEvent>
#include <QMenu>
@@ -46,33 +46,9 @@ namespace Diagram {
namespace {
// 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("BTN_PAGE"), QStringLiteral("Next chart")},
{QStringLiteral("BTN_SELECT"), QStringLiteral("Select nation")},
{QStringLiteral("TITLE_DIAGRAMS"), QStringLiteral("Charts")},
{QStringLiteral("TITLE_SHIPS"), QStringLiteral("Colonization Ships")},
{QStringLiteral("SHARE"), QStringLiteral("%1/%2")},
{QStringLiteral("SHIPHAB"), QStringLiteral("Habitation")},
{QStringLiteral("SHIPPOW"), QStringLiteral("Power")},
{QStringLiteral("SHIPCOMP"), QStringLiteral("Components")},
};
const auto it = table.constFind(key);
return it != table.constEnd() ? it.value() : key;
}
QString phraseDiagram(int mode)
{
static const QHash<int, QString> table = {
{stPop, QStringLiteral("Population")}, {stTerritory, QStringLiteral("Territory")},
{stMil, QStringLiteral("Military")}, {stScience, QStringLiteral("Science")},
{stExplore, QStringLiteral("Explored")}, {stWork, QStringLiteral("Workers")},
};
const auto it = table.constFind(mode);
return it != table.constEnd() ? it.value() : QString();
return phrases.lookup(QStringLiteral("DIAGRAM"), mode);
}
constexpr int Border = 24;
@@ -90,7 +66,8 @@ void shareBar(Dpi::Canvas &canvas, int x, int y, const QString &cap, int val0, i
{
loweredTextOut(canvas, -1, *MainTexture, x - 2, y, cap);
dLine(canvas, x - 2, x + 169, y + 16, MainTexture->colorTextShade, MainTexture->colorTextLight);
const QString s = val0 > 0 ? phrase(QStringLiteral("SHARE")).arg(val0).arg(val1) : QStringLiteral("0");
const QString s = val0 > 0 ? formatPhrase(QStringLiteral("SHARE"), { QString::number(val0), QString::number(val1) })
: QStringLiteral("0");
risedTextOut(canvas, x + 170 - biColorTextWidth(canvas, s), y, s);
}
@@ -261,11 +238,11 @@ void DiaDlg::offscreenPaint()
paintColonyShip(canvas, player, 8, innerWidth - 16, yArea);
shareBar(canvas, innerWidth / 2 - 85, innerHeight - 62, phrase(QStringLiteral("SHIPHAB")),
shareBar(canvas, innerWidth / 2 - 85, innerHeight - 62, phrases.lookup(QStringLiteral("SHIPHAB")),
ClientTools::myRO->Ship[player].Parts[spHab], 2);
shareBar(canvas, innerWidth / 2 - 85, innerHeight - 43, phrase(QStringLiteral("SHIPPOW")),
shareBar(canvas, innerWidth / 2 - 85, innerHeight - 43, phrases.lookup(QStringLiteral("SHIPPOW")),
ClientTools::myRO->Ship[player].Parts[spPow], 4);
shareBar(canvas, innerWidth / 2 - 85, innerHeight - 24, phrase(QStringLiteral("SHIPCOMP")),
shareBar(canvas, innerWidth / 2 - 85, innerHeight - 24, phrases.lookup(QStringLiteral("SHIPCOMP")),
ClientTools::myRO->Ship[player].Parts[spComp], 6);
}
@@ -308,8 +285,8 @@ void DiaDlg::showNewContentCharts(WindowMode newMode)
kind = DiagramKind::Chart;
mode = stPop;
ui->toggleBtn->setButtonIndex(15);
ui->toggleBtn->setToolTip(phrase(QStringLiteral("BTN_PAGE")));
setWindowTitle(phrase(QStringLiteral("TITLE_DIAGRAMS")));
ui->toggleBtn->setToolTip(phrases.lookup(QStringLiteral("BTN_PAGE")));
setWindowTitle(phrases.lookup(QStringLiteral("TITLE_DIAGRAMS")));
showNewContent(newMode);
}
@@ -326,8 +303,8 @@ void DiaDlg::showNewContentShip(WindowMode newMode, int p)
player = p;
}
ui->toggleBtn->setButtonIndex(28);
ui->toggleBtn->setToolTip(phrase(QStringLiteral("BTN_SELECT")));
setWindowTitle(phrase(QStringLiteral("TITLE_SHIPS")));
ui->toggleBtn->setToolTip(phrases.lookup(QStringLiteral("BTN_SELECT")));
setWindowTitle(phrases.lookup(QStringLiteral("TITLE_SHIPS")));
showNewContent(newMode);
}