mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-25 16:13:54 -07:00
language fix
This commit is contained in:
parent
5324012582
commit
a5280946c2
16 changed files with 1026 additions and 581 deletions
|
|
@ -103,7 +103,6 @@ void ChatWidget::retranslateUi()
|
|||
joinButton->setText(tr("Joi&n"));
|
||||
|
||||
QTreeWidgetItem *header = channelList->headerItem();
|
||||
Q_ASSERT(header != 0);
|
||||
header->setText(0, tr("Channel"));
|
||||
header->setText(1, tr("Players"));
|
||||
header->setTextAlignment(1, Qt::AlignRight);
|
||||
|
|
|
|||
|
|
@ -301,9 +301,9 @@ PendingCommand *Client::shuffle()
|
|||
return cmd("shuffle");
|
||||
}
|
||||
|
||||
PendingCommand *Client::rollDice(unsigned int sides)
|
||||
PendingCommand *Client::rollDie(unsigned int sides)
|
||||
{
|
||||
return cmd(QString("roll_dice|%1").arg(sides));
|
||||
return cmd(QString("roll_die|%1").arg(sides));
|
||||
}
|
||||
|
||||
PendingCommand *Client::drawCards(unsigned int number)
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ public slots:
|
|||
PendingCommand *login(const QString &name, const QString &pass);
|
||||
PendingCommand *say(const QString &s);
|
||||
PendingCommand *shuffle();
|
||||
PendingCommand *rollDice(unsigned int sides);
|
||||
PendingCommand *rollDie(unsigned int sides);
|
||||
PendingCommand *drawCards(unsigned int number);
|
||||
PendingCommand *moveCard(int cardid, const QString &startzone, const QString &targetzone, int x, int y = 0, bool faceDown = false);
|
||||
PendingCommand *createToken(const QString &zone, const QString &name, const QString &powtough, int x, int y);
|
||||
|
|
|
|||
|
|
@ -23,33 +23,25 @@ Game::Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_a
|
|||
connect(client, SIGNAL(gameEvent(const ServerEventData &)), this, SLOT(gameEvent(const ServerEventData &)));
|
||||
connect(client, SIGNAL(playerListReceived(QList<ServerPlayer *>)), this, SLOT(playerListReceived(QList<ServerPlayer *>)));
|
||||
|
||||
aUntapAll = new QAction(tr("&Untap all permanents"), this);
|
||||
aUntapAll->setShortcut(tr("Ctrl+U"));
|
||||
aUntapAll = new QAction(this);
|
||||
connect(aUntapAll, SIGNAL(triggered()), this, SLOT(actUntapAll()));
|
||||
|
||||
aDecLife = new QAction(tr("&Decrement life"), this);
|
||||
aDecLife->setShortcut(tr("F11"));
|
||||
aDecLife = new QAction(this);
|
||||
connect(aDecLife, SIGNAL(triggered()), this, SLOT(actDecLife()));
|
||||
aIncLife = new QAction(tr("&Increment life"), this);
|
||||
aIncLife->setShortcut(tr("F12"));
|
||||
aIncLife = new QAction(this);
|
||||
connect(aIncLife, SIGNAL(triggered()), this, SLOT(actIncLife()));
|
||||
aSetLife = new QAction(tr("&Set life"), this);
|
||||
aSetLife->setShortcut(tr("Ctrl+L"));
|
||||
aSetLife = new QAction(this);
|
||||
connect(aSetLife, SIGNAL(triggered()), this, SLOT(actSetLife()));
|
||||
|
||||
aRollDice = new QAction(tr("R&oll dice..."), this);
|
||||
aRollDice->setShortcut(tr("Ctrl+I"));
|
||||
connect(aRollDice, SIGNAL(triggered()), this, SLOT(actRollDice()));
|
||||
aRollDie = new QAction(this);
|
||||
connect(aRollDie, SIGNAL(triggered()), this, SLOT(actRollDie()));
|
||||
|
||||
aCreateToken = new QAction(tr("&Create token..."), this);
|
||||
aCreateToken->setShortcut(tr("Ctrl+T"));
|
||||
aCreateToken = new QAction(this);
|
||||
connect(aCreateToken, SIGNAL(triggered()), this, SLOT(actCreateToken()));
|
||||
|
||||
aNextPhase = new QAction(tr("Next &phase"), this);
|
||||
aNextPhase->setShortcut(tr("Ctrl+Space"));
|
||||
aNextPhase = new QAction(this);
|
||||
connect(aNextPhase, SIGNAL(triggered()), this, SLOT(actNextPhase()));
|
||||
aNextTurn = new QAction(tr("Next &turn"), this);
|
||||
aNextTurn->setShortcuts(QList<QKeySequence>() << QKeySequence(tr("Ctrl+Return")) << QKeySequence(tr("Ctrl+Enter")));
|
||||
aNextTurn = new QAction(this);
|
||||
connect(aNextTurn, SIGNAL(triggered()), this, SLOT(actNextTurn()));
|
||||
|
||||
actionsMenu->addAction(aNextPhase);
|
||||
|
|
@ -61,25 +53,25 @@ Game::Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_a
|
|||
actionsMenu->addAction(aIncLife);
|
||||
actionsMenu->addAction(aSetLife);
|
||||
actionsMenu->addSeparator();
|
||||
actionsMenu->addAction(aRollDice);
|
||||
actionsMenu->addAction(aRollDie);
|
||||
actionsMenu->addSeparator();
|
||||
actionsMenu->addAction(aCreateToken);
|
||||
actionsMenu->addSeparator();
|
||||
sayMenu = actionsMenu->addMenu(tr("S&ay"));
|
||||
sayMenu = actionsMenu->addMenu(QString());
|
||||
initSayMenu();
|
||||
|
||||
aTap = new QAction(tr("&Tap"), this);
|
||||
aUntap = new QAction(tr("&Untap"), this);
|
||||
aDoesntUntap = new QAction(tr("Toggle &normal untapping"), this);
|
||||
aFlip = new QAction(tr("&Flip"), this);
|
||||
aAddCounter = new QAction(tr("&Add counter"), this);
|
||||
aRemoveCounter = new QAction(tr("&Remove counter"), this);
|
||||
aSetCounters = new QAction(tr("&Set counters..."), this);
|
||||
aTap = new QAction(this);
|
||||
aUntap = new QAction(this);
|
||||
aDoesntUntap = new QAction(this);
|
||||
aFlip = new QAction(this);
|
||||
aAddCounter = new QAction(this);
|
||||
aRemoveCounter = new QAction(this);
|
||||
aSetCounters = new QAction(this);
|
||||
connect(aSetCounters, SIGNAL(triggered()), this, SLOT(actSetCounters()));
|
||||
aMoveToTopLibrary = new QAction(tr("&top of library"), this);
|
||||
aMoveToBottomLibrary = new QAction(tr("&bottom of library"), this);
|
||||
aMoveToGraveyard = new QAction(tr("&graveyard"), this);
|
||||
aMoveToExile = new QAction(tr("&exile"), this);
|
||||
aMoveToTopLibrary = new QAction(this);
|
||||
aMoveToBottomLibrary = new QAction(this);
|
||||
aMoveToGraveyard = new QAction(this);
|
||||
aMoveToExile = new QAction(this);
|
||||
|
||||
cardMenu->addAction(aTap);
|
||||
cardMenu->addAction(aUntap);
|
||||
|
|
@ -91,7 +83,7 @@ Game::Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_a
|
|||
cardMenu->addAction(aRemoveCounter);
|
||||
cardMenu->addAction(aSetCounters);
|
||||
cardMenu->addSeparator();
|
||||
moveMenu = cardMenu->addMenu(tr("&Move to"));
|
||||
moveMenu = cardMenu->addMenu(QString());
|
||||
|
||||
moveMenu->addAction(aMoveToTopLibrary);
|
||||
moveMenu->addAction(aMoveToBottomLibrary);
|
||||
|
|
@ -118,6 +110,8 @@ Game::Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_a
|
|||
dlgStartGame = new DlgStartGame(db);
|
||||
connect(dlgStartGame, SIGNAL(newDeckLoaded(const QStringList &)), client, SLOT(submitDeck(const QStringList &)));
|
||||
connect(dlgStartGame, SIGNAL(finished(int)), this, SLOT(readyStart()));
|
||||
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
Game::~Game()
|
||||
|
|
@ -129,6 +123,45 @@ Game::~Game()
|
|||
}
|
||||
}
|
||||
|
||||
void Game::retranslateUi()
|
||||
{
|
||||
aUntapAll->setText(tr("&Untap all permanents"));
|
||||
aUntapAll->setShortcut(tr("Ctrl+U"));
|
||||
aDecLife->setText(tr("&Decrement life"));
|
||||
aDecLife->setShortcut(tr("F11"));
|
||||
aIncLife->setText(tr("&Increment life"));
|
||||
aIncLife->setShortcut(tr("F12"));
|
||||
aSetLife->setText(tr("&Set life"));
|
||||
aSetLife->setShortcut(tr("Ctrl+L"));
|
||||
aRollDie->setText(tr("R&oll die..."));
|
||||
aRollDie->setShortcut(tr("Ctrl+I"));
|
||||
aCreateToken->setText(tr("&Create token..."));
|
||||
aCreateToken->setShortcut(tr("Ctrl+T"));
|
||||
aNextPhase->setText(tr("Next &phase"));
|
||||
aNextPhase->setShortcut(tr("Ctrl+Space"));
|
||||
aNextTurn->setText(tr("Next &turn"));
|
||||
aNextTurn->setShortcuts(QList<QKeySequence>() << QKeySequence(tr("Ctrl+Return")) << QKeySequence(tr("Ctrl+Enter")));
|
||||
|
||||
sayMenu->setTitle(tr("S&ay"));
|
||||
|
||||
aTap->setText(tr("&Tap"));
|
||||
aUntap->setText(tr("&Untap"));
|
||||
aDoesntUntap->setText(tr("Toggle &normal untapping"));
|
||||
aFlip->setText(tr("&Flip"));
|
||||
aAddCounter->setText(tr("&Add counter"));
|
||||
aRemoveCounter->setText(tr("&Remove counter"));
|
||||
aSetCounters->setText(tr("&Set counters..."));
|
||||
aMoveToTopLibrary->setText(tr("&top of library"));
|
||||
aMoveToBottomLibrary->setText(tr("&bottom of library"));
|
||||
aMoveToGraveyard->setText(tr("&graveyard"));
|
||||
aMoveToExile->setText(tr("&exile"));
|
||||
|
||||
moveMenu->setTitle(tr("&Move to"));
|
||||
|
||||
for (int i = 0; i < players.size(); ++i)
|
||||
players[i]->retranslateUi();
|
||||
}
|
||||
|
||||
void Game::initSayMenu()
|
||||
{
|
||||
sayMenu->clear();
|
||||
|
|
@ -238,11 +271,11 @@ void Game::gameEvent(const ServerEventData &msg)
|
|||
case eventShuffle:
|
||||
emit logShuffle(p);
|
||||
break;
|
||||
case eventRollDice: {
|
||||
case eventRollDie: {
|
||||
QStringList data = msg.getEventData();
|
||||
int sides = data[0].toInt();
|
||||
int roll = data[1].toInt();
|
||||
emit logRollDice(p, sides, roll);
|
||||
emit logRollDie(p, sides, roll);
|
||||
break;
|
||||
}
|
||||
case eventSetActivePlayer: {
|
||||
|
|
@ -279,12 +312,24 @@ void Game::gameEvent(const ServerEventData &msg)
|
|||
}
|
||||
case eventDumpZone: {
|
||||
QStringList data = msg.getEventData();
|
||||
emit logDumpZone(p, data[1], players.findPlayer(data[0].toInt())->getName(), data[2].toInt());
|
||||
Player *zoneOwner = players.findPlayer(data[0].toInt());
|
||||
if (!zoneOwner)
|
||||
break;
|
||||
CardZone *zone = zoneOwner->getZones()->findZone(data[1]);
|
||||
if (!zone)
|
||||
break;
|
||||
emit logDumpZone(p, zone, zoneOwner, data[2].toInt());
|
||||
break;
|
||||
}
|
||||
case eventStopDumpZone: {
|
||||
QStringList data = msg.getEventData();
|
||||
emit logStopDumpZone(p, data[1], players.findPlayer(data[0].toInt())->getName());
|
||||
Player *zoneOwner = players.findPlayer(data[0].toInt());
|
||||
if (!zoneOwner)
|
||||
break;
|
||||
CardZone *zone = zoneOwner->getZones()->findZone(data[1]);
|
||||
if (!zone)
|
||||
break;
|
||||
emit logStopDumpZone(p, zone, zoneOwner);
|
||||
break;
|
||||
}
|
||||
case eventMoveCard: {
|
||||
|
|
@ -345,12 +390,12 @@ void Game::actSetLife()
|
|||
client->setCounter("life", life);
|
||||
}
|
||||
|
||||
void Game::actRollDice()
|
||||
void Game::actRollDie()
|
||||
{
|
||||
bool ok;
|
||||
int sides = QInputDialog::getInteger(0, tr("Roll dice"), tr("Number of sides:"), 20, 2, 1000, 1, &ok);
|
||||
int sides = QInputDialog::getInteger(0, tr("Roll die"), tr("Number of sides:"), 20, 2, 1000, 1, &ok);
|
||||
if (ok)
|
||||
client->rollDice(sides);
|
||||
client->rollDie(sides);
|
||||
}
|
||||
|
||||
void Game::actCreateToken()
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ private:
|
|||
QMenu *actionsMenu, *sayMenu, *cardMenu, *moveMenu;
|
||||
QAction *aTap, *aUntap, *aDoesntUntap, *aFlip, *aAddCounter, *aRemoveCounter, *aSetCounters,
|
||||
*aMoveToTopLibrary, *aMoveToBottomLibrary, *aMoveToGraveyard, *aMoveToExile,
|
||||
*aNextPhase, *aNextTurn, *aUntapAll, *aDecLife, *aIncLife, *aSetLife, *aRollDice, *aCreateToken;
|
||||
*aNextPhase, *aNextTurn, *aUntapAll, *aDecLife, *aIncLife, *aSetLife, *aRollDie, *aCreateToken;
|
||||
DlgStartGame *dlgStartGame;
|
||||
|
||||
CardDatabase *db;
|
||||
|
|
@ -45,7 +45,7 @@ private slots:
|
|||
void actIncLife();
|
||||
void actDecLife();
|
||||
void actSetLife();
|
||||
void actRollDice();
|
||||
void actRollDie();
|
||||
void actCreateToken();
|
||||
|
||||
void showCardMenu(QPoint p);
|
||||
|
|
@ -80,7 +80,7 @@ signals:
|
|||
void logGameStart();
|
||||
void logSay(Player *player, QString text);
|
||||
void logShuffle(Player *player);
|
||||
void logRollDice(Player *player, int sides, int roll);
|
||||
void logRollDie(Player *player, int sides, int roll);
|
||||
void logDraw(Player *player, int number);
|
||||
void logMoveCard(Player *player, QString cardName, CardZone *startZone, int oldX, CardZone *targetZone, int newX);
|
||||
void logCreateToken(Player *player, QString cardName);
|
||||
|
|
@ -88,14 +88,15 @@ signals:
|
|||
void logSetTapped(Player *player, QString cardName, bool tapped);
|
||||
void logSetCounter(Player *player, QString counterName, int value, int oldValue);
|
||||
void logSetDoesntUntap(Player *player, QString cardName, bool doesntUntap);
|
||||
void logDumpZone(Player *player, QString zoneName, QString zoneOwner, int numberCards);
|
||||
void logStopDumpZone(Player *player, QString zoneName, QString zoneOwner);
|
||||
void logDumpZone(Player *player, CardZone *zone, Player *zoneOwner, int numberCards);
|
||||
void logStopDumpZone(Player *player, CardZone *zone, Player *zoneOwner);
|
||||
void logSetActivePlayer(Player *player);
|
||||
void setActivePhase(int phase);
|
||||
public:
|
||||
Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_actionsMenu, QMenu *_cardMenu, int playerId, const QString &playerName, QObject *parent = 0);
|
||||
~Game();
|
||||
Player *getLocalPlayer() const { return localPlayer; }
|
||||
void retranslateUi();
|
||||
void restartGameDialog();
|
||||
void hoverCardEvent(CardItem *card);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "player.h"
|
||||
#include "cardzone.h"
|
||||
|
||||
QString MessageLogWidget::sanitizeHtml(QString dirty)
|
||||
QString MessageLogWidget::sanitizeHtml(QString dirty) const
|
||||
{
|
||||
return dirty
|
||||
.replace("&", "&")
|
||||
|
|
@ -11,6 +11,29 @@ QString MessageLogWidget::sanitizeHtml(QString dirty)
|
|||
.replace(">", ">");
|
||||
}
|
||||
|
||||
QString MessageLogWidget::trZoneName(CardZone *zone, Player *owner, bool hisOwn, GrammaticalCase gc) const
|
||||
{
|
||||
if (zone->getName() == "hand")
|
||||
switch (gc) {
|
||||
// case CaseNominative: return hisOwn ? tr("his hand") : tr("%1's hand").arg(owner->getName());
|
||||
case CaseGenitive: return hisOwn ? tr("of his hand") : tr("of %1's hand").arg(owner->getName());
|
||||
case CaseAccusative: return hisOwn ? tr("his hand") : tr("%1's hand").arg(owner->getName());
|
||||
}
|
||||
else if (zone->getName() == "deck")
|
||||
switch (gc) {
|
||||
// case CaseNominative: return hisOwn ? tr("his library") : tr("%1's library").arg(owner->getName());
|
||||
case CaseGenitive: return hisOwn ? tr("of his library") : tr("of %1's library").arg(owner->getName());
|
||||
case CaseAccusative: return hisOwn ? tr("his library") : tr("%1's library").arg(owner->getName());
|
||||
}
|
||||
else if (zone->getName() == "sb")
|
||||
switch (gc) {
|
||||
// case CaseNominative: return hisOwn ? tr("his sideboard") : tr("%1's sideboard").arg(owner->getName());
|
||||
case CaseGenitive: return hisOwn ? tr("of his sideboard") : tr("of %1's sideboard").arg(owner->getName());
|
||||
case CaseAccusative: return hisOwn ? tr("his sideboard") : tr("%1's sideboard").arg(owner->getName());
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
void MessageLogWidget::logConnecting(QString hostname)
|
||||
{
|
||||
append(tr("Connecting to %1...").arg(sanitizeHtml(hostname)));
|
||||
|
|
@ -69,7 +92,7 @@ void MessageLogWidget::logReadyStart(Player *player)
|
|||
|
||||
void MessageLogWidget::logGameStart()
|
||||
{
|
||||
append(tr("Game has started."));
|
||||
append(tr("The game has started."));
|
||||
}
|
||||
|
||||
void MessageLogWidget::logSay(Player *player, QString message)
|
||||
|
|
@ -79,20 +102,20 @@ void MessageLogWidget::logSay(Player *player, QString message)
|
|||
|
||||
void MessageLogWidget::logShuffle(Player *player)
|
||||
{
|
||||
append(tr("%1 shuffles his/her library").arg(sanitizeHtml(player->getName())));
|
||||
append(tr("%1 shuffles his library.").arg(sanitizeHtml(player->getName())));
|
||||
}
|
||||
|
||||
void MessageLogWidget::logRollDice(Player *player, int sides, int roll)
|
||||
void MessageLogWidget::logRollDie(Player *player, int sides, int roll)
|
||||
{
|
||||
append(tr("%1 rolled a %2 with a %3-sided dice").arg(sanitizeHtml(player->getName())).arg(roll).arg(sides));
|
||||
append(tr("%1 rolls a %2 with a %3-sided die.").arg(sanitizeHtml(player->getName())).arg(roll).arg(sides));
|
||||
}
|
||||
|
||||
void MessageLogWidget::logDraw(Player *player, int number)
|
||||
{
|
||||
if (number == 1)
|
||||
append(tr("%1 draws a card").arg(sanitizeHtml(player->getName())));
|
||||
append(tr("%1 draws a card.").arg(sanitizeHtml(player->getName())));
|
||||
else
|
||||
append(tr("%1 draws %2 cards").arg(sanitizeHtml(player->getName())).arg(number));
|
||||
append(tr("%1 draws %2 cards.").arg(sanitizeHtml(player->getName())).arg(number));
|
||||
}
|
||||
|
||||
void MessageLogWidget::logMoveCard(Player *player, QString cardName, CardZone *startZone, int oldX, CardZone *targetZone, int newX)
|
||||
|
|
@ -102,60 +125,78 @@ void MessageLogWidget::logMoveCard(Player *player, QString cardName, CardZone *s
|
|||
if (((startName == "table") && (targetName == "table")) || ((startName == "hand") && (targetName == "hand")))
|
||||
return;
|
||||
QString fromStr;
|
||||
bool cardNameContainsStartZone = false;
|
||||
|
||||
if (startName == "table")
|
||||
fromStr = tr("from table");
|
||||
fromStr = tr(" from table");
|
||||
else if (startName == "grave")
|
||||
fromStr = tr("from graveyard");
|
||||
fromStr = tr(" from graveyard");
|
||||
else if (startName == "rfg")
|
||||
fromStr = tr("from exile");
|
||||
fromStr = tr(" from exile");
|
||||
else if (startName == "hand")
|
||||
fromStr = tr("from hand");
|
||||
fromStr = tr(" from hand");
|
||||
else if (startName == "deck") {
|
||||
if (oldX == startZone->getCards().size() - 1)
|
||||
fromStr = tr("from the bottom of his library");
|
||||
else if (oldX == 0)
|
||||
fromStr = tr("from the top of his library");
|
||||
else
|
||||
fromStr = tr("from library");
|
||||
if (oldX == startZone->getCards().size() - 1) {
|
||||
if (cardName.isEmpty()) {
|
||||
cardName = tr("the bottom card of his library");
|
||||
cardNameContainsStartZone = true;
|
||||
} else
|
||||
fromStr = tr(" from the bottom of his library");
|
||||
} else if (oldX == 0) {
|
||||
if (cardName.isEmpty()) {
|
||||
cardName = tr("the top card of his library");
|
||||
cardNameContainsStartZone = true;
|
||||
} else
|
||||
fromStr = tr(" from the top of his library");
|
||||
} else
|
||||
fromStr = tr(" from library");
|
||||
} else if (startName == "sb")
|
||||
fromStr = tr("from sideboard");
|
||||
fromStr = tr(" from sideboard");
|
||||
|
||||
QString finalStr;
|
||||
if (targetName == "table")
|
||||
finalStr = tr("%1 puts %2 into play %3");
|
||||
finalStr = tr("%1 puts %2 into play%3.");
|
||||
else if (targetName == "grave")
|
||||
finalStr = tr("%1 puts %2 %3 into graveyard");
|
||||
finalStr = tr("%1 puts %2%3 into graveyard.");
|
||||
else if (targetName == "rfg")
|
||||
finalStr = tr("%1 exiles %2 %3");
|
||||
finalStr = tr("%1 exiles %2%3.");
|
||||
else if (targetName == "hand")
|
||||
finalStr = tr("%1 moves %2 %3 to hand");
|
||||
finalStr = tr("%1 moves %2%3 to hand.");
|
||||
else if (targetName == "deck") {
|
||||
if (newX == -1)
|
||||
finalStr = tr("%1 puts %2 %3 into his library");
|
||||
finalStr = tr("%1 puts %2%3 into his library.");
|
||||
else if (newX == targetZone->getCards().size())
|
||||
finalStr = tr("%1 puts %2 %3 on bottom of his library");
|
||||
finalStr = tr("%1 puts %2%3 on bottom of his library.");
|
||||
else if (newX == 0)
|
||||
finalStr = tr("%1 puts %2 %3 on top of his library");
|
||||
finalStr = tr("%1 puts %2%3 on top of his library.");
|
||||
else
|
||||
finalStr = tr("%1 puts %2 %3 into his library at position %4");
|
||||
finalStr = tr("%1 puts %2%3 into his library at position %4.");
|
||||
} else if (targetName == "sb")
|
||||
finalStr = tr("%1 moves %2 %3 to sideboard");
|
||||
finalStr = tr("%1 moves %2%3 to sideboard.");
|
||||
|
||||
append(finalStr.arg(sanitizeHtml(player->getName())).arg(cardName.isEmpty() ? tr("a card") : QString("<font color=\"blue\">%1</font>").arg(sanitizeHtml(cardName))).arg(fromStr).arg(newX));
|
||||
QString cardStr;
|
||||
if (cardNameContainsStartZone)
|
||||
cardStr = cardName;
|
||||
else if (cardName.isEmpty())
|
||||
cardStr = tr("a card");
|
||||
else
|
||||
cardStr = QString("<font color=\"blue\">%1</font>").arg(sanitizeHtml(cardName));
|
||||
|
||||
append(finalStr.arg(sanitizeHtml(player->getName())).arg(cardStr).arg(fromStr).arg(newX));
|
||||
}
|
||||
|
||||
void MessageLogWidget::logCreateToken(Player *player, QString cardName)
|
||||
{
|
||||
append(tr("%1 creates token: %2").arg(sanitizeHtml(player->getName())).arg(QString("<font color=\"blue\">%1</font>").arg(sanitizeHtml(cardName))));
|
||||
append(tr("%1 creates token: %2.").arg(sanitizeHtml(player->getName())).arg(QString("<font color=\"blue\">%1</font>").arg(sanitizeHtml(cardName))));
|
||||
}
|
||||
|
||||
void MessageLogWidget::logSetCardCounters(Player *player, QString cardName, int value, int oldValue)
|
||||
{
|
||||
QString finalStr;
|
||||
if (value > oldValue)
|
||||
finalStr = tr("%1 places %2 counters on %3 (now %4)");
|
||||
finalStr = tr("%1 places %2 counters on %3 (now %4).");
|
||||
else
|
||||
finalStr = tr("%1 removes %2 counters from %3 (now %4)");
|
||||
finalStr = tr("%1 removes %2 counters from %3 (now %4).");
|
||||
append(finalStr.arg(sanitizeHtml(player->getName())).arg(abs(oldValue - value)).arg(QString("<font color=\"blue\">%1</font>").arg(sanitizeHtml(cardName))).arg(value));
|
||||
}
|
||||
|
||||
|
|
@ -166,12 +207,12 @@ void MessageLogWidget::logSetTapped(Player *player, QString cardName, bool tappe
|
|||
cardStr = tr("his permanents");
|
||||
else
|
||||
cardStr = QString("<font color=\"blue\">%1</font>").arg(sanitizeHtml(cardName));
|
||||
append(tr("%1 %2 %3").arg(sanitizeHtml(player->getName())).arg(tapped ? tr("taps") : tr("untaps")).arg(cardStr));
|
||||
append(tr("%1 %2 %3.").arg(sanitizeHtml(player->getName())).arg(tapped ? tr("taps") : tr("untaps")).arg(cardStr));
|
||||
}
|
||||
|
||||
void MessageLogWidget::logSetCounter(Player *player, QString counterName, int value, int oldValue)
|
||||
{
|
||||
append(tr("%1 sets counter \"%2\" to %3 (%4%5)").arg(sanitizeHtml(player->getName())).arg(counterName).arg(value).arg(value > oldValue ? "+" : "").arg(value - oldValue));
|
||||
append(tr("%1 sets counter \"%2\" to %3 (%4%5).").arg(sanitizeHtml(player->getName())).arg(counterName).arg(value).arg(value > oldValue ? "+" : "").arg(value - oldValue));
|
||||
}
|
||||
|
||||
void MessageLogWidget::logSetDoesntUntap(Player *player, QString cardName, bool doesntUntap)
|
||||
|
|
@ -184,17 +225,18 @@ void MessageLogWidget::logSetDoesntUntap(Player *player, QString cardName, bool
|
|||
append(finalStr.arg(sanitizeHtml(player->getName())).arg(QString("<font color=\"blue\">%1</font>").arg(sanitizeHtml(cardName))));
|
||||
}
|
||||
|
||||
void MessageLogWidget::logDumpZone(Player *player, QString zoneName, QString zoneOwner, int numberCards)
|
||||
void MessageLogWidget::logDumpZone(Player *player, CardZone *zone, Player *zoneOwner, int numberCards)
|
||||
{
|
||||
if (numberCards != -1)
|
||||
append(tr("%1 is looking at the top %2 cards of %3's %4").arg(sanitizeHtml(player->getName())).arg(numberCards).arg(zoneOwner).arg(zoneName));
|
||||
append(tr("%1 is looking at the top %2 cards %3.").arg(sanitizeHtml(player->getName())).arg(numberCards).arg(trZoneName(zone, zoneOwner, zoneOwner == player, CaseGenitive)));
|
||||
else
|
||||
append(tr("%1 is looking at %2's %3").arg(sanitizeHtml(player->getName())).arg(zoneOwner).arg(zoneName));
|
||||
append(tr("%1 is looking at %2.").arg(sanitizeHtml(player->getName())).arg(trZoneName(zone, zoneOwner, zoneOwner == player, CaseAccusative)));
|
||||
}
|
||||
|
||||
void MessageLogWidget::logStopDumpZone(Player *player, QString zoneName, QString zoneOwner)
|
||||
void MessageLogWidget::logStopDumpZone(Player *player, CardZone *zone, Player *zoneOwner)
|
||||
{
|
||||
append(tr("%1 stops looking at %2's %3").arg(sanitizeHtml(player->getName())).arg(zoneOwner).arg(zoneName));
|
||||
QString zoneName = trZoneName(zone, zoneOwner, zoneOwner == player, CaseAccusative);
|
||||
append(tr("%1 stops looking at %2.").arg(sanitizeHtml(player->getName())).arg(zoneName));
|
||||
}
|
||||
|
||||
void MessageLogWidget::logSetActivePlayer(Player *player)
|
||||
|
|
@ -218,7 +260,7 @@ void MessageLogWidget::logSetActivePhase(int phase)
|
|||
case 7: phaseName = tr("combat damage step"); break;
|
||||
case 8: phaseName = tr("end of combat step"); break;
|
||||
case 9: phaseName = tr("second main phase"); break;
|
||||
case 10: phaseName = tr("end of turn step"); break;
|
||||
case 10: phaseName = tr("ending phase"); break;
|
||||
}
|
||||
append("<font color=\"green\">" + tr("It is now the %1.").arg(phaseName) + "</font>");
|
||||
}
|
||||
|
|
@ -232,7 +274,7 @@ void MessageLogWidget::connectToGame(Game *game)
|
|||
connect(game, SIGNAL(logGameStart()), this, SLOT(logGameStart()));
|
||||
connect(game, SIGNAL(logSay(Player *, QString)), this, SLOT(logSay(Player *, QString)));
|
||||
connect(game, SIGNAL(logShuffle(Player *)), this, SLOT(logShuffle(Player *)));
|
||||
connect(game, SIGNAL(logRollDice(Player *, int, int)), this, SLOT(logRollDice(Player *, int, int)));
|
||||
connect(game, SIGNAL(logRollDie(Player *, int, int)), this, SLOT(logRollDie(Player *, int, int)));
|
||||
connect(game, SIGNAL(logDraw(Player *, int)), this, SLOT(logDraw(Player *, int)));
|
||||
connect(game, SIGNAL(logMoveCard(Player *, QString, CardZone *, int, CardZone *, int)), this, SLOT(logMoveCard(Player *, QString, CardZone *, int, CardZone *, int)));
|
||||
connect(game, SIGNAL(logCreateToken(Player *, QString)), this, SLOT(logCreateToken(Player *, QString)));
|
||||
|
|
@ -240,8 +282,8 @@ void MessageLogWidget::connectToGame(Game *game)
|
|||
connect(game, SIGNAL(logSetTapped(Player *, QString, bool)), this, SLOT(logSetTapped(Player *, QString, bool)));
|
||||
connect(game, SIGNAL(logSetCounter(Player *, QString, int, int)), this, SLOT(logSetCounter(Player *, QString, int, int)));
|
||||
connect(game, SIGNAL(logSetDoesntUntap(Player *, QString, bool)), this, SLOT(logSetDoesntUntap(Player *, QString, bool)));
|
||||
connect(game, SIGNAL(logDumpZone(Player *, QString, QString, int)), this, SLOT(logDumpZone(Player *, QString, QString, int)));
|
||||
connect(game, SIGNAL(logStopDumpZone(Player *, QString, QString)), this, SLOT(logStopDumpZone(Player *, QString, QString)));
|
||||
connect(game, SIGNAL(logDumpZone(Player *, CardZone *, Player *, int)), this, SLOT(logDumpZone(Player *, CardZone *, Player *, int)));
|
||||
connect(game, SIGNAL(logStopDumpZone(Player *, CardZone *, Player *)), this, SLOT(logStopDumpZone(Player *, CardZone *, Player *)));
|
||||
connect(game, SIGNAL(logSetActivePlayer(Player *)), this, SLOT(logSetActivePlayer(Player *)));
|
||||
connect(game, SIGNAL(setActivePhase(int)), this, SLOT(logSetActivePhase(int)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ class CardZone;
|
|||
class MessageLogWidget : public QTextEdit {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QString sanitizeHtml(QString dirty);
|
||||
enum GrammaticalCase { /*CaseNominative, */CaseGenitive, CaseAccusative };
|
||||
QString sanitizeHtml(QString dirty) const;
|
||||
QString trZoneName(CardZone *zone, Player *player, bool hisOwn, GrammaticalCase gc) const;
|
||||
public slots:
|
||||
void logConnecting(QString hostname);
|
||||
void logConnected(const QStringList WelcomeMsg);
|
||||
|
|
@ -27,7 +29,7 @@ private slots:
|
|||
void logGameStart();
|
||||
void logSay(Player *player, QString message);
|
||||
void logShuffle(Player *player);
|
||||
void logRollDice(Player *player, int sides, int roll);
|
||||
void logRollDie(Player *player, int sides, int roll);
|
||||
void logDraw(Player *player, int number);
|
||||
void logMoveCard(Player *player, QString cardName, CardZone *startZone, int oldX, CardZone *targetZone, int newX);
|
||||
void logCreateToken(Player *player, QString cardName);
|
||||
|
|
@ -35,8 +37,8 @@ private slots:
|
|||
void logSetTapped(Player *player, QString cardName, bool tapped);
|
||||
void logSetCounter(Player *player, QString counterName, int value, int oldValue);
|
||||
void logSetDoesntUntap(Player *player, QString cardName, bool doesntUntap);
|
||||
void logDumpZone(Player *player, QString zoneName, QString zoneOwner, int numberCards);
|
||||
void logStopDumpZone(Player *player, QString zoneName, QString zoneOwner);
|
||||
void logDumpZone(Player *player, CardZone *zone, Player *zoneOwner, int numberCards);
|
||||
void logStopDumpZone(Player *player, CardZone *zone, Player *zoneOwner);
|
||||
void logSetActivePlayer(Player *player);
|
||||
void logSetActivePhase(int phase);
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -17,50 +17,44 @@ Player::Player(const QString &_name, int _id, QPointF _base, bool _local, CardDa
|
|||
_scene->addItem(area);
|
||||
|
||||
if (local) {
|
||||
aMoveHandToTopLibrary = new QAction(tr("Move to &top of library"), this);
|
||||
aMoveHandToTopLibrary = new QAction(this);
|
||||
connect(aMoveHandToTopLibrary, SIGNAL(triggered()), this, SLOT(actMoveHandToTopLibrary()));
|
||||
aMoveHandToBottomLibrary = new QAction(tr("Move to &bottom of library"), this);
|
||||
aMoveHandToBottomLibrary = new QAction(this);
|
||||
connect(aMoveHandToBottomLibrary, SIGNAL(triggered()), this, SLOT(actMoveHandToBottomLibrary()));
|
||||
|
||||
aViewLibrary = new QAction(tr("&View library"), this);
|
||||
aViewLibrary->setShortcut(tr("F3"));
|
||||
aViewLibrary = new QAction(this);
|
||||
connect(aViewLibrary, SIGNAL(triggered()), this, SLOT(actViewLibrary()));
|
||||
aViewTopCards = new QAction(tr("View &top cards of library..."), this);
|
||||
aViewTopCards = new QAction(this);
|
||||
connect(aViewTopCards, SIGNAL(triggered()), this, SLOT(actViewTopCards()));
|
||||
}
|
||||
|
||||
aViewGraveyard = new QAction(tr("&View graveyard"), this);
|
||||
if (local)
|
||||
aViewGraveyard->setShortcut(tr("F4"));
|
||||
aViewGraveyard = new QAction(this);
|
||||
connect(aViewGraveyard, SIGNAL(triggered()), this, SLOT(actViewGraveyard()));
|
||||
|
||||
aViewRfg = new QAction(tr("&View removed cards"), this);
|
||||
aViewRfg = new QAction(this);
|
||||
connect(aViewRfg, SIGNAL(triggered()), this, SLOT(actViewRfg()));
|
||||
|
||||
if (local) {
|
||||
aViewSideboard = new QAction(tr("&View sideboard"), this);
|
||||
aViewSideboard = new QAction(this);
|
||||
connect(aViewSideboard, SIGNAL(triggered()), this, SLOT(actViewSideboard()));
|
||||
|
||||
aDrawCard = new QAction(tr("&Draw card"), this);
|
||||
aDrawCard = new QAction(this);
|
||||
connect(aDrawCard, SIGNAL(triggered()), this, SLOT(actDrawCard()));
|
||||
aDrawCard->setShortcut(tr("Ctrl+D"));
|
||||
aDrawCards = new QAction(tr("D&raw cards..."), this);
|
||||
aDrawCards = new QAction(this);
|
||||
connect(aDrawCards, SIGNAL(triggered()), this, SLOT(actDrawCards()));
|
||||
aDrawCards->setShortcut(tr("Ctrl+E"));
|
||||
aShuffle = new QAction(tr("&Shuffle"), this);
|
||||
aShuffle = new QAction(this);
|
||||
connect(aShuffle, SIGNAL(triggered()), this, SLOT(actShuffle()));
|
||||
aShuffle->setShortcut(tr("Ctrl+S"));
|
||||
}
|
||||
|
||||
playerMenu = new QMenu(tr("Player \"%1\"").arg(name));
|
||||
playerMenu = new QMenu(QString());
|
||||
|
||||
if (local) {
|
||||
QMenu *handMenu = playerMenu->addMenu(tr("&Hand"));
|
||||
handMenu = playerMenu->addMenu(QString());
|
||||
handMenu->addAction(aMoveHandToTopLibrary);
|
||||
handMenu->addAction(aMoveHandToBottomLibrary);
|
||||
zones.findZone("hand")->setMenu(handMenu);
|
||||
|
||||
QMenu *libraryMenu = playerMenu->addMenu(tr("&Library"));
|
||||
libraryMenu = playerMenu->addMenu(QString());
|
||||
libraryMenu->addAction(aDrawCard);
|
||||
libraryMenu->addAction(aDrawCards);
|
||||
libraryMenu->addSeparator();
|
||||
|
|
@ -69,21 +63,27 @@ Player::Player(const QString &_name, int _id, QPointF _base, bool _local, CardDa
|
|||
libraryMenu->addAction(aViewLibrary);
|
||||
libraryMenu->addAction(aViewTopCards);
|
||||
zones.findZone("deck")->setMenu(libraryMenu, aDrawCard);
|
||||
} else {
|
||||
handMenu = 0;
|
||||
libraryMenu = 0;
|
||||
}
|
||||
|
||||
QMenu *graveMenu = playerMenu->addMenu(tr("&Graveyard"));
|
||||
graveMenu = playerMenu->addMenu(QString());
|
||||
graveMenu->addAction(aViewGraveyard);
|
||||
zones.findZone("grave")->setMenu(graveMenu, aViewGraveyard);
|
||||
|
||||
QMenu *rfgMenu = playerMenu->addMenu(tr("&Removed cards"));
|
||||
rfgMenu = playerMenu->addMenu(QString());
|
||||
rfgMenu->addAction(aViewRfg);
|
||||
zones.findZone("rfg")->setMenu(rfgMenu, aViewRfg);
|
||||
|
||||
if (local) {
|
||||
QMenu *sbMenu = playerMenu->addMenu(tr("&Sideboard"));
|
||||
sbMenu = playerMenu->addMenu(QString());
|
||||
sbMenu->addAction(aViewSideboard);
|
||||
zones.findZone("sb")->setMenu(sbMenu, aViewSideboard);
|
||||
}
|
||||
} else
|
||||
sbMenu = 0;
|
||||
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
Player::~Player()
|
||||
|
|
@ -96,6 +96,35 @@ Player::~Player()
|
|||
delete area;
|
||||
}
|
||||
|
||||
void Player::retranslateUi()
|
||||
{
|
||||
aViewGraveyard->setText(tr("&View graveyard"));
|
||||
aViewRfg->setText(tr("&View exile"));
|
||||
playerMenu->setTitle(tr("Player \"%1\"").arg(name));
|
||||
graveMenu->setTitle(tr("&Graveyard"));
|
||||
rfgMenu->setTitle(tr("&Exile"));
|
||||
|
||||
if (local) {
|
||||
aMoveHandToTopLibrary->setText(tr("Move to &top of library"));
|
||||
aMoveHandToBottomLibrary->setText(tr("Move to &bottom of library"));
|
||||
aViewLibrary->setText(tr("&View library"));
|
||||
aViewLibrary->setShortcut(tr("F3"));
|
||||
aViewTopCards->setText(tr("View &top cards of library..."));
|
||||
aViewGraveyard->setShortcut(tr("F4"));
|
||||
aViewSideboard->setText(tr("&View sideboard"));
|
||||
aDrawCard->setText(tr("&Draw card"));
|
||||
aDrawCard->setShortcut(tr("Ctrl+D"));
|
||||
aDrawCards->setText(tr("D&raw cards..."));
|
||||
aDrawCards->setShortcut(tr("Ctrl+E"));
|
||||
aShuffle->setText(tr("&Shuffle"));
|
||||
aShuffle->setShortcut(tr("Ctrl+S"));
|
||||
|
||||
handMenu->setTitle(tr("&Hand"));
|
||||
sbMenu->setTitle(tr("&Sideboard"));
|
||||
libraryMenu->setTitle(tr("&Library"));
|
||||
}
|
||||
}
|
||||
|
||||
void Player::actMoveHandToTopLibrary()
|
||||
{
|
||||
zones.findZone("hand")->moveAllToZone("deck", 0);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ private slots:
|
|||
void actViewRfg();
|
||||
void actViewSideboard();
|
||||
private:
|
||||
QMenu *playerMenu;
|
||||
QMenu *playerMenu, *handMenu, *graveMenu, *rfgMenu, *libraryMenu, *sbMenu;
|
||||
QAction *aMoveHandToTopLibrary, *aMoveHandToBottomLibrary,
|
||||
*aViewLibrary, *aViewTopCards, *aViewGraveyard, *aViewRfg, *aViewSideboard,
|
||||
*aDrawCard, *aDrawCards, *aShuffle;
|
||||
|
|
@ -63,6 +63,7 @@ public:
|
|||
void addZone(CardZone *z);
|
||||
Player(const QString &_name, int _id, QPointF _base, bool _local, CardDatabase *_db, Client *_client, QGraphicsScene *_scene, Game *_parent);
|
||||
~Player();
|
||||
void retranslateUi();
|
||||
QMenu *getPlayerMenu() const { return playerMenu; }
|
||||
int getId() const { return id; }
|
||||
QString getName() const { return name; }
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ ServerEventData::ServerEventData(const QString &line)
|
|||
eventHash.insert("setup_zones", eventSetupZones);
|
||||
eventHash.insert("game_start", eventGameStart);
|
||||
eventHash.insert("shuffle", eventShuffle);
|
||||
eventHash.insert("roll_dice", eventRollDice);
|
||||
eventHash.insert("roll_die", eventRollDie);
|
||||
eventHash.insert("draw", eventDraw);
|
||||
eventHash.insert("move_card", eventMoveCard);
|
||||
eventHash.insert("create_token", eventCreateToken);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ enum ServerEventType {
|
|||
eventSetupZones,
|
||||
eventGameStart,
|
||||
eventShuffle,
|
||||
eventRollDice,
|
||||
eventRollDie,
|
||||
eventDraw,
|
||||
eventMoveCard,
|
||||
eventCreateToken,
|
||||
|
|
|
|||
|
|
@ -219,6 +219,8 @@ void MainWindow::retranslateUi()
|
|||
cardInfo->retranslateUi();
|
||||
chatWidget->retranslateUi();
|
||||
gameSelector->retranslateUi();
|
||||
if (game)
|
||||
game->retranslateUi();
|
||||
}
|
||||
|
||||
void MainWindow::createActions()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue