removed old temporary phrase and formatPrase implementations
This commit is contained in:
1 parent
6e634e13d2
commit
e96b871779
14 files changed
+231
-598
No files matched your search
@@ -32,11 +32,10 @@
|
||||
#include "Cevo/CevoScreenTools.h"
|
||||
#include "Cevo/CevoTexture.h"
|
||||
#include "ClientTools.h"
|
||||
#include "Global.h"
|
||||
#include "Term.h"
|
||||
#include "Tribes.h"
|
||||
|
||||
#include <QHash>
|
||||
|
||||
namespace Cevo {
|
||||
namespace Rates {
|
||||
|
||||
@@ -44,22 +43,6 @@ namespace {
|
||||
|
||||
constexpr int MessageLineSpacing = 20;
|
||||
|
||||
// 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_RATES"), QStringLiteral("Rates")},
|
||||
{QStringLiteral("NORATES"), QStringLiteral("The Statue of Liberty lets your people decide for themselves.")},
|
||||
{QStringLiteral("RATES"), QStringLiteral("Set your tax, science and luxury rates.\\(click the arrows)")},
|
||||
{QStringLiteral("SCIENCE"), QStringLiteral("Science")},
|
||||
{QStringLiteral("LUX"), QStringLiteral("Luxury")},
|
||||
{QStringLiteral("TAXRATE"), QStringLiteral("Tax")},
|
||||
};
|
||||
const auto it = table.constFind(key);
|
||||
return it != table.constEnd() ? it.value() : key;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
RatesDlg::RatesDlg(QWidget *parent) : BufferedDrawDlg(parent), ui(new Ui::RatesDlg)
|
||||
@@ -74,7 +57,7 @@ RatesDlg::RatesDlg(QWidget *parent) : BufferedDrawDlg(parent), ui(new Ui::RatesD
|
||||
ui->scienceBtn->onClick = [this] { taxLuxBtnClick(2); };
|
||||
ui->luxBtn->onClick = [this] { taxLuxBtnClick(3); };
|
||||
onShow = [this] {
|
||||
setWindowTitle(phrase(QStringLiteral("TITLE_RATES")));
|
||||
setWindowTitle(phrases.lookup(QStringLiteral("TITLE_RATES")));
|
||||
const bool hasLiberty = ClientTools::myRO->Wonder[woLiberty].EffectiveOwner == ClientTools::me;
|
||||
ui->scienceBtn->setVisible(!hasLiberty);
|
||||
ui->luxBtn->setVisible(!hasLiberty);
|
||||
@@ -101,11 +84,11 @@ void RatesDlg::offscreenPaint()
|
||||
|
||||
btnFrame(canvas, ui->closeBtn->geometry(), *MainTexture);
|
||||
canvas.font().assign(UniFont[static_cast<std::size_t>(FontType::Caption)]);
|
||||
QString s = phrase(QStringLiteral("TITLE_RATES"));
|
||||
QString s = phrases.lookup(QStringLiteral("TITLE_RATES"));
|
||||
risedTextOut(canvas, (width() - biColorTextWidth(canvas, s)) / 2 - 1, 7, s);
|
||||
|
||||
const bool hasLiberty = ClientTools::myRO->Wonder[woLiberty].EffectiveOwner == ClientTools::me;
|
||||
s = phrase(hasLiberty ? QStringLiteral("NORATES") : QStringLiteral("RATES"));
|
||||
s = phrases.lookup(hasLiberty ? QStringLiteral("NORATES") : QStringLiteral("RATES"));
|
||||
canvas.font().assign(UniFont[static_cast<std::size_t>(FontType::Normal)]);
|
||||
const int p = s.indexOf(QLatin1Char('\\'));
|
||||
if (p < 0) {
|
||||
@@ -125,7 +108,7 @@ void RatesDlg::offscreenPaint()
|
||||
bitBltBitmap(offscreen, width() / 2 - xSizeBig / 2, 52, xSizeBig, ySizeBig, *bigImp, (woLiberty % 7) * xSizeBig,
|
||||
(woLiberty / 7 + Term::SystemIconLines) * ySizeBig);
|
||||
} else {
|
||||
s = phrase(QStringLiteral("SCIENCE"));
|
||||
s = phrases.lookup(QStringLiteral("SCIENCE"));
|
||||
risedTextOut(canvas, 16 + 120 - biColorTextWidth(canvas, s), 44, s);
|
||||
s = QStringLiteral("%1%").arg(100 - ClientTools::myRO->TaxRate - ClientTools::myRO->LuxRate);
|
||||
risedTextOut(canvas, 16 + 120 - biColorTextWidth(canvas, s), 60, s);
|
||||
@@ -145,7 +128,7 @@ void RatesDlg::offscreenPaint()
|
||||
canvas.fillRect(QRect(x, y, max - current, 7));
|
||||
canvas.brush().setStyle(Qt::NoBrush);
|
||||
|
||||
risedTextOut(canvas, 16 + 160, 44, phrase(QStringLiteral("LUX")));
|
||||
risedTextOut(canvas, 16 + 160, 44, phrases.lookup(QStringLiteral("LUX")));
|
||||
s = QStringLiteral("%1%").arg(ClientTools::myRO->LuxRate);
|
||||
risedTextOut(canvas, 16 + 160, 60, s);
|
||||
paintProgressBar(canvas, 5, 16 + 160, 81, ClientTools::myRO->LuxRate * 120 / 100, 0, 120, *MainTexture);
|
||||
@@ -154,7 +137,7 @@ void RatesDlg::offscreenPaint()
|
||||
}
|
||||
|
||||
dLine(canvas, 1, width() - 2, 154, MainTexture->colorBevelShade, MainTexture->colorBevelLight);
|
||||
risedTextOut(canvas, 16 + 80, 164, phrase(QStringLiteral("TAXRATE")));
|
||||
risedTextOut(canvas, 16 + 80, 164, phrases.lookup(QStringLiteral("TAXRATE")));
|
||||
s = QStringLiteral("%1%").arg(ClientTools::myRO->TaxRate);
|
||||
risedTextOut(canvas, 16 + 80, 180, s);
|
||||
paintProgressBar(canvas, 0, 16 + 80, 201, ClientTools::myRO->TaxRate * 120 / 100, 0, 120, *MainTexture);
|
||||
|
||||
Reference in new issue
Block a user