diff --git a/cockatrice/src/game.cpp b/cockatrice/src/game.cpp index 90fc9dcf..84bb8818 100644 --- a/cockatrice/src/game.cpp +++ b/cockatrice/src/game.cpp @@ -14,7 +14,7 @@ #include "counter.h" Game::Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_actionsMenu, QMenu *_cardMenu, int playerId, const QString &playerName, QObject *parent) - : QObject(parent), actionsMenu(_actionsMenu), cardMenu(_cardMenu), db(_db), client(_client), scene(_scene), started(false) + : QObject(parent), actionsMenu(_actionsMenu), cardMenu(_cardMenu), db(_db), client(_client), scene(_scene), started(false), currentPhase(-1) { QRectF sr = scene->sceneRect(); localPlayer = addPlayer(playerId, playerName, QPointF(0, sr.y() + sr.height() / 2 + 2), true); @@ -53,6 +53,16 @@ Game::Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_a aCreateToken->setShortcut(tr("Ctrl+T")); connect(aCreateToken, SIGNAL(triggered()), this, SLOT(actCreateToken())); + aNextPhase = new QAction(tr("Next &phase"), this); + aNextPhase->setShortcut(tr("Ctrl+Space")); + connect(aNextPhase, SIGNAL(triggered()), this, SLOT(actNextPhase())); + aNextTurn = new QAction(tr("Next &turn"), this); + aNextTurn->setShortcut(tr("Ctrl+Enter")); + connect(aNextTurn, SIGNAL(triggered()), this, SLOT(actNextTurn())); + + actionsMenu->addAction(aNextPhase); + actionsMenu->addAction(aNextTurn); + actionsMenu->addSeparator(); actionsMenu->addAction(aUntapAll); actionsMenu->addSeparator(); actionsMenu->addAction(aDecLife); @@ -240,6 +250,7 @@ void Game::gameEvent(const ServerEventData &msg) case eventSetActivePhase: { QStringList data = msg.getEventData(); int phase = data[0].toInt(); + currentPhase = phase; emit setActivePhase(phase); break; } @@ -284,6 +295,19 @@ void Game::gameEvent(const ServerEventData &msg) } } +void Game::actNextPhase() +{ + int phase = currentPhase; + if (++phase >= phaseCount) + phase = 0; + client->setActivePhase(phase); +} + +void Game::actNextTurn() +{ + client->nextTurn(); +} + void Game::actUntapAll() { client->setCardAttr("table", -1, "tapped", "false"); diff --git a/cockatrice/src/game.h b/cockatrice/src/game.h index 99e7357d..b899f2cb 100644 --- a/cockatrice/src/game.h +++ b/cockatrice/src/game.h @@ -15,9 +15,11 @@ class CardItem; class Game : public QObject { Q_OBJECT private: + static const int phaseCount = 11; + QMenu *actionsMenu, *sayMenu, *cardMenu; QAction *aTap, *aUntap, *aDoesntUntap, *aFlip, *aAddCounter, *aRemoveCounter, *aSetCounters, - *aUntapAll, *aDecLife, *aIncLife, *aSetLife, *aShuffle, *aDraw, *aDrawCards, *aRollDice, *aCreateToken; + *aNextPhase, *aNextTurn, *aUntapAll, *aDecLife, *aIncLife, *aSetLife, *aShuffle, *aDraw, *aDrawCards, *aRollDice, *aCreateToken; DlgStartGame *dlgStartGame; CardDatabase *db; @@ -26,9 +28,12 @@ private: PlayerList players; Player *localPlayer; bool started; + int currentPhase; Player *addPlayer(int playerId, const QString &playerName, QPointF base, bool local); void initSayMenu(); private slots: + void actNextPhase(); + void actNextTurn(); void actUntapAll(); void actIncLife(); void actDecLife(); diff --git a/cockatrice/src/messagelogwidget.cpp b/cockatrice/src/messagelogwidget.cpp index 6502d138..056f0933 100644 --- a/cockatrice/src/messagelogwidget.cpp +++ b/cockatrice/src/messagelogwidget.cpp @@ -97,9 +97,6 @@ void MessageLogWidget::logDraw(Player *player, int number) void MessageLogWidget::logMoveCard(Player *player, QString cardName, CardZone *startZone, int oldX, CardZone *targetZone, int newX) { - if (cardName.isEmpty()) - cardName = tr("a card"); - QString startName = startZone->getName(); QString targetName = targetZone->getName(); if (((startName == "table") && (targetName == "table")) || ((startName == "hand") && (targetName == "hand"))) @@ -144,7 +141,7 @@ void MessageLogWidget::logMoveCard(Player *player, QString cardName, CardZone *s } else if (targetName == "sb") finalStr = tr("%1 moves %2 %3 to sideboard"); - append(finalStr.arg(sanitizeHtml(player->getName())).arg(QString("%1").arg(sanitizeHtml(cardName))).arg(fromStr).arg(newX)); + append(finalStr.arg(sanitizeHtml(player->getName())).arg(cardName.isEmpty() ? tr("a card") : QString("%1").arg(sanitizeHtml(cardName))).arg(fromStr).arg(newX)); } void MessageLogWidget::logCreateToken(Player *player, QString cardName) diff --git a/cockatrice/src/phasestoolbar.cpp b/cockatrice/src/phasestoolbar.cpp index 53060474..233b6f26 100644 --- a/cockatrice/src/phasestoolbar.cpp +++ b/cockatrice/src/phasestoolbar.cpp @@ -7,7 +7,7 @@ PhaseButton::PhaseButton(QIcon icon) : QPushButton(icon, QString()), active(false) { - + setFixedSize(50, 50); } void PhaseButton::update() @@ -23,18 +23,16 @@ void PhaseButton::paintEvent(QPaintEvent *event) int height = size().height(); int width = size().width(); - QPen pen; - pen.setColor(QColor::fromRgb(180, 0, 0, 200)); - painter.setPen(pen); + painter.setPen(QPen(Qt::transparent)); QRadialGradient grad(QPointF(0.5, 0.5), 0.5); grad.setCoordinateMode(QGradient::ObjectBoundingMode); grad.setColorAt(0, QColor(180, 0, 0, 0)); grad.setColorAt(0.8, QColor(180, 0, 0, 0)); - grad.setColorAt(1, QColor(180, 0, 0, 200)); + grad.setColorAt(1, QColor(180, 0, 0, 255)); painter.setBrush(QBrush(grad)); - painter.drawRect(3, 3, width - 7, height - 7); + painter.drawRect(2, 2, width - 4, height - 4); } } @@ -70,6 +68,7 @@ PhasesToolbar::PhasesToolbar(QWidget *parent) QPushButton *nextTurnButton = new QPushButton(QIcon(":/resources/icon_nextturn.svg"), QString()); nextTurnButton->setIconSize(QSize(36, 36)); + nextTurnButton->setFixedSize(50, 50); connect(nextTurnButton, SIGNAL(clicked()), this, SIGNAL(signalNextTurn())); QVBoxLayout *layout = new QVBoxLayout; diff --git a/cockatrice/translations/cockatrice_de.ts b/cockatrice/translations/cockatrice_de.ts index 7a81997c..b93624ea 100644 --- a/cockatrice/translations/cockatrice_de.ts +++ b/cockatrice/translations/cockatrice_de.ts @@ -367,47 +367,67 @@ Ctrl+T Ctrl+T + + + Next &phase + Nächste &Phase + + + + Ctrl+Space + Ctrl+Space + + + + Next &turn + Nächster &Zug + + + + Ctrl+Enter + Ctrl+Enter + &Edit messages... Mitteilungen &bearbeiten... - + S&ay &Sagen - + &Tap &Tappen - + &Untap E&nttappen - + Toggle &normal untapping &Normales enttappen umschalten - + &Flip &Umdrehen - + &Add counter Zählm&arke hinzufügen - + &Remove counter Zählma&rke entfernen - + &Set counters... &Setze Zählmarken... @@ -416,78 +436,78 @@ Neu a&rrangieren - + F5 F5 - + F6 F6 - + F7 F7 - + F8 F8 - + F9 F9 - + F10 F10 - + Set life Setze Leben - + New life total: Neues Leben insgesammt: - + Roll dice Würfeln - + Number of sides: Anzahl der Seiten: - + Draw cards Karten ziehen - - + + Number: Anzahl: - + Create token Token erstellen - + Name: Name: - + Set counters Setze Zählmarke @@ -776,162 +796,162 @@ %1 zieht %2 Karten - + a card eine Karte - + from table vom Spielfeld - + from graveyard aus dem Friedhof - + from exile aus dem Exil - + from hand von der Hand - + from the bottom of his library von der Unterseite seiner Bibliothek - + from the top of his library oben von seiner Bibliothek - + from library von der Bibliothek - + from sideboard aus seinem Sideboard - + %1 puts %2 into play %3 %1 bringt %2 %3 ins Spiel - + %1 puts %2 %3 into graveyard %1 legt %2 %3 in den Friedhof - + %1 exiles %2 %3 %1 schickt %2 %3 ins Exil - + %1 moves %2 %3 to hand %1 nimmt %2 %3 auf die Hand - + %1 puts %2 %3 into his library %1 legt %2 %3 in seine Bibliothek - + %1 puts %2 %3 on bottom of his library %1 legt %2 %3 unter seine Bibliothek - + %1 puts %2 %3 on top of his library %1 legt %2 %3 auf die Bibliothek - + %1 puts %2 %3 into his library at position %4 %1 legt %2 %3 in seine Bibliothek an Stelle %4 - + %1 moves %2 %3 to sideboard %1 legt %2 %3 in sein Sideboard - + %1 stops looking at %2's %3 %1 sieht sich %2s %3 nicht mehr an - + It is now %1's turn. %1 ist am Zug. - + untap step das Enttappsegment - + upkeep step das Versorgungssegment - + draw step das Ziehsegment - + first main phase die erste Hauptphase - + beginning of combat step das Anfangssegment der Kampfphase - + declare attackers step das Angreifer-Deklarieren-Segment - + declare blockers step das Blocker-Deklarieren-Segment - + combat damage step das Kampfschadenssegment - + end of combat step das Endsegment der Kampfphase - + second main phase die zweite Hauptphase - + end of turn step das Ende-des-Zuges-Segment - + It is now the %1. Es ist nun %1. @@ -940,12 +960,12 @@ %1 bewegt %2 %3 nach %4 - + taps tappt - + untaps enttappt @@ -958,52 +978,52 @@ %1 bewegt %2 von %3 nach %4 - + %1 creates token: %2 %1 erstellt Token: %2 - + %1 places %2 counters on %3 (now %4) %1 legt %2 Zählmarken auf %3 (jetzt %4) - + %1 removes %2 counters from %3 (now %4) %1 entfernt %2 Zählmarken von %3 (jetzt %4) - + his permanents seine bleibenden Karten - + %1 %2 %3 %1 %2 %3 - + %1 sets counter "%2" to %3 (%4%5) %1 setzt Zähler "%2" auf %3 (%4%5) - + %1 sets %2 to not untap normally. %1 setzt %2 auf explizites Enttappen. - + %1 sets %2 to untap normally. %1 setzt %2 auf normales Enttappen. - + %1 is looking at the top %2 cards of %3's %4 %1 sieht sich die obersten %2 Karten von %3s %4 an - + %1 is looking at %2's %3 %1 sieht sich %2s %3 an @@ -1042,57 +1062,57 @@ PhasesToolbar - + Untap step Enttappsegment - + Upkeep step Versorgungssegment - + Draw step Ziehsegment - + First main phase erste Hauptphase - + Beginning of combat step Anfangssegment der Kampfphase - + Declare attackers step Angreifer-Deklarieren-Segment - + Declare blockers step Blocker-Deklarieren-Segment - + Combat damage step Kampfschadenssegment - + End of combat step Endsegment der Kampfphase - + Second main phase zweite Hauptphase - + End of turn step Ende-des-Zuges-Segment diff --git a/cockatrice/translations/cockatrice_en.ts b/cockatrice/translations/cockatrice_en.ts index bb499640..53217a97 100644 --- a/cockatrice/translations/cockatrice_en.ts +++ b/cockatrice/translations/cockatrice_en.ts @@ -309,118 +309,138 @@ - + + Next &phase + + + + + Ctrl+Space + + + + + Next &turn + + + + + Ctrl+Enter + + + + S&ay - + &Tap - + &Untap - + Toggle &normal untapping - + &Flip - + &Add counter - + &Remove counter - + &Set counters... - + F5 - + F6 - + F7 - + F8 - + F9 - + F10 - + Set life - + New life total: - + Roll dice - + Number of sides: - + Draw cards - - + + Number: - + Create token - + Name: - + Set counters @@ -709,222 +729,222 @@ - + a card - + from table - + from graveyard - + from exile - + from hand - + from the bottom of his library - + from the top of his library - + from library - + from sideboard - + %1 puts %2 into play %3 - + %1 puts %2 %3 into graveyard - + %1 exiles %2 %3 - + %1 moves %2 %3 to hand - + %1 puts %2 %3 into his library - + %1 puts %2 %3 on bottom of his library - + %1 puts %2 %3 on top of his library - + %1 puts %2 %3 into his library at position %4 - + %1 moves %2 %3 to sideboard - + %1 stops looking at %2's %3 - + It is now %1's turn. - + untap step - + upkeep step - + draw step - + first main phase - + beginning of combat step - + declare attackers step - + declare blockers step - + combat damage step - + end of combat step - + second main phase - + end of turn step - + It is now the %1. - + %1 creates token: %2 - + %1 places %2 counters on %3 (now %4) - + %1 removes %2 counters from %3 (now %4) - + %1 %2 %3 - + taps - + untaps - + %1 sets counter "%2" to %3 (%4%5) - + %1 sets %2 to not untap normally. - + %1 sets %2 to untap normally. - + %1 is looking at the top %2 cards of %3's %4 - + %1 is looking at %2's %3 - + his permanents @@ -955,57 +975,57 @@ PhasesToolbar - + Untap step - + Upkeep step - + Draw step - + First main phase - + Beginning of combat step - + Declare attackers step - + Declare blockers step - + Combat damage step - + End of combat step - + Second main phase - + End of turn step