From 0d84de2384234be3a2f4ae63103010229e6ad46a Mon Sep 17 00:00:00 2001 From: Max-Wilhelm Bruker Date: Sat, 22 Aug 2009 01:26:35 +0200 Subject: [PATCH] moved carddraw from game to player; qt 4.4 compilation fix; minor behaviour change --- cockatrice/src/game.cpp | 29 --- cockatrice/src/game.h | 6 +- cockatrice/src/main.cpp | 1 + cockatrice/src/player.cpp | 81 +++++--- cockatrice/src/player.h | 10 +- cockatrice/src/window_main.cpp | 5 + cockatrice/translations/cockatrice_de.ts | 214 ++++++++++++--------- cockatrice/translations/cockatrice_en.ts | 229 ++++++++++++----------- 8 files changed, 315 insertions(+), 260 deletions(-) diff --git a/cockatrice/src/game.cpp b/cockatrice/src/game.cpp index af537d9d..12ba6aee 100644 --- a/cockatrice/src/game.cpp +++ b/cockatrice/src/game.cpp @@ -37,15 +37,6 @@ Game::Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_a aSetLife->setShortcut(tr("Ctrl+L")); connect(aSetLife, SIGNAL(triggered()), this, SLOT(actSetLife())); - aShuffle = new QAction(tr("&Shuffle"), this); - aShuffle->setShortcut(tr("Ctrl+S")); - connect(aShuffle, SIGNAL(triggered()), this, SLOT(actShuffle())); - aDraw = new QAction(tr("&Draw a card"), this); - aDraw->setShortcut(tr("Ctrl+D")); - connect(aDraw, SIGNAL(triggered()), this, SLOT(actDrawCard())); - aDrawCards = new QAction(tr("D&raw cards..."), this); - connect(aDrawCards, SIGNAL(triggered()), this, SLOT(actDrawCards())); - aDrawCards->setShortcut(tr("Ctrl+E")); aRollDice = new QAction(tr("R&oll dice..."), this); aRollDice->setShortcut(tr("Ctrl+I")); connect(aRollDice, SIGNAL(triggered()), this, SLOT(actRollDice())); @@ -70,9 +61,6 @@ Game::Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_a actionsMenu->addAction(aIncLife); actionsMenu->addAction(aSetLife); actionsMenu->addSeparator(); - actionsMenu->addAction(aShuffle); - actionsMenu->addAction(aDraw); - actionsMenu->addAction(aDrawCards); actionsMenu->addAction(aRollDice); actionsMenu->addSeparator(); actionsMenu->addAction(aCreateToken); @@ -354,11 +342,6 @@ void Game::actSetLife() client->setCounter("life", life); } -void Game::actShuffle() -{ - client->shuffle(); -} - void Game::actRollDice() { bool ok; @@ -367,18 +350,6 @@ void Game::actRollDice() client->rollDice(sides); } -void Game::actDrawCard() -{ - client->drawCards(1); -} - -void Game::actDrawCards() -{ - int number = QInputDialog::getInteger(0, tr("Draw cards"), tr("Number:")); - if (number) - client->drawCards(number); -} - void Game::actCreateToken() { QString cardname = QInputDialog::getText(0, tr("Create token"), tr("Name:")); diff --git a/cockatrice/src/game.h b/cockatrice/src/game.h index 869aeb83..5db758c9 100644 --- a/cockatrice/src/game.h +++ b/cockatrice/src/game.h @@ -1,6 +1,7 @@ #ifndef GAME_H #define GAME_H +#include #include "playerlist.h" class ServerPlayer; @@ -23,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, *aShuffle, *aDraw, *aDrawCards, *aRollDice, *aCreateToken; + *aNextPhase, *aNextTurn, *aUntapAll, *aDecLife, *aIncLife, *aSetLife, *aRollDice, *aCreateToken; DlgStartGame *dlgStartGame; CardDatabase *db; @@ -44,9 +45,6 @@ private slots: void actIncLife(); void actDecLife(); void actSetLife(); - void actShuffle(); - void actDrawCard(); - void actDrawCards(); void actRollDice(); void actCreateToken(); diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index 8635cd4a..74da37ba 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include "window_main.h" diff --git a/cockatrice/src/player.cpp b/cockatrice/src/player.cpp index 5e063aa4..22c66602 100644 --- a/cockatrice/src/player.cpp +++ b/cockatrice/src/player.cpp @@ -16,17 +16,18 @@ Player::Player(const QString &_name, int _id, QPointF _base, bool _local, CardDa area->setPos(_base); _scene->addItem(area); - aMoveHandToTopLibrary = new QAction(tr("Move to &top of library"), this); - connect(aMoveHandToTopLibrary, SIGNAL(triggered()), this, SLOT(actMoveHandToTopLibrary())); - aMoveHandToBottomLibrary = new QAction(tr("Move to &bottom of library"), this); - connect(aMoveHandToBottomLibrary, SIGNAL(triggered()), this, SLOT(actMoveHandToBottomLibrary())); + if (local) { + aMoveHandToTopLibrary = new QAction(tr("Move to &top of library"), this); + connect(aMoveHandToTopLibrary, SIGNAL(triggered()), this, SLOT(actMoveHandToTopLibrary())); + aMoveHandToBottomLibrary = new QAction(tr("Move to &bottom of library"), this); + connect(aMoveHandToBottomLibrary, SIGNAL(triggered()), this, SLOT(actMoveHandToBottomLibrary())); - aViewLibrary = new QAction(tr("&View library"), this); - if (local) + aViewLibrary = new QAction(tr("&View library"), this); aViewLibrary->setShortcut(tr("F3")); - connect(aViewLibrary, SIGNAL(triggered()), this, SLOT(actViewLibrary())); - aViewTopCards = new QAction(tr("View &top cards of library..."), this); - connect(aViewTopCards, SIGNAL(triggered()), this, SLOT(actViewTopCards())); + connect(aViewLibrary, SIGNAL(triggered()), this, SLOT(actViewLibrary())); + aViewTopCards = new QAction(tr("View &top cards of library..."), this); + connect(aViewTopCards, SIGNAL(triggered()), this, SLOT(actViewTopCards())); + } aViewGraveyard = new QAction(tr("&View graveyard"), this); if (local) @@ -36,20 +37,37 @@ Player::Player(const QString &_name, int _id, QPointF _base, bool _local, CardDa aViewRfg = new QAction(tr("&View removed cards"), this); connect(aViewRfg, SIGNAL(triggered()), this, SLOT(actViewRfg())); - aViewSideboard = new QAction(tr("&View sideboard"), this); - connect(aViewSideboard, SIGNAL(triggered()), this, SLOT(actViewSideboard())); + if (local) { + aViewSideboard = new QAction(tr("&View sideboard"), this); + connect(aViewSideboard, SIGNAL(triggered()), this, SLOT(actViewSideboard())); + + aDrawCard = new QAction(tr("&Draw card"), this); + connect(aDrawCard, SIGNAL(triggered()), this, SLOT(actDrawCard())); + aDrawCard->setShortcut(tr("Ctrl+D")); + aDrawCards = new QAction(tr("D&raw cards..."), this); + connect(aDrawCards, SIGNAL(triggered()), this, SLOT(actDrawCards())); + aDrawCards->setShortcut(tr("Ctrl+E")); + aShuffle = new QAction(tr("&Shuffle"), this); + connect(aShuffle, SIGNAL(triggered()), this, SLOT(actShuffle())); + aShuffle->setShortcut(tr("Ctrl+S")); + } playerMenu = new QMenu(tr("Player \"%1\"").arg(name)); - QMenu *handMenu = playerMenu->addMenu(tr("&Hand")); - handMenu->addAction(aMoveHandToTopLibrary); - handMenu->addAction(aMoveHandToBottomLibrary); - zones.findZone("hand")->setMenu(handMenu); + if (local) { + QMenu *handMenu = playerMenu->addMenu(tr("&Hand")); + handMenu->addAction(aMoveHandToTopLibrary); + handMenu->addAction(aMoveHandToBottomLibrary); + zones.findZone("hand")->setMenu(handMenu); - QMenu *libraryMenu = playerMenu->addMenu(tr("&Library")); - libraryMenu->addAction(aViewLibrary); - libraryMenu->addAction(aViewTopCards); - zones.findZone("deck")->setMenu(libraryMenu, aViewLibrary); + QMenu *libraryMenu = playerMenu->addMenu(tr("&Library")); + libraryMenu->addAction(aDrawCard); + libraryMenu->addAction(aDrawCards); + libraryMenu->addSeparator(); + libraryMenu->addAction(aViewLibrary); + libraryMenu->addAction(aViewTopCards); + zones.findZone("deck")->setMenu(libraryMenu, aDrawCard); + } QMenu *graveMenu = playerMenu->addMenu(tr("&Graveyard")); graveMenu->addAction(aViewGraveyard); @@ -59,9 +77,11 @@ Player::Player(const QString &_name, int _id, QPointF _base, bool _local, CardDa rfgMenu->addAction(aViewRfg); zones.findZone("rfg")->setMenu(rfgMenu, aViewRfg); - QMenu *sbMenu = playerMenu->addMenu(tr("&Sideboard")); - sbMenu->addAction(aViewSideboard); - zones.findZone("sb")->setMenu(sbMenu, aViewSideboard); + if (local) { + QMenu *sbMenu = playerMenu->addMenu(tr("&Sideboard")); + sbMenu->addAction(aViewSideboard); + zones.findZone("sb")->setMenu(sbMenu, aViewSideboard); + } } Player::~Player() @@ -114,6 +134,23 @@ void Player::actViewSideboard() emit toggleZoneView(this, "sb", -1); } +void Player::actShuffle() +{ + client->shuffle(); +} + +void Player::actDrawCard() +{ + client->drawCards(1); +} + +void Player::actDrawCards() +{ + int number = QInputDialog::getInteger(0, tr("Draw cards"), tr("Number:")); + if (number) + client->drawCards(number); +} + void Player::addZone(CardZone *z) { zones << z; diff --git a/cockatrice/src/player.h b/cockatrice/src/player.h index b5d68dea..46a4fd99 100644 --- a/cockatrice/src/player.h +++ b/cockatrice/src/player.h @@ -33,18 +33,20 @@ private slots: void actMoveHandToTopLibrary(); void actMoveHandToBottomLibrary(); + void actShuffle(); + void actDrawCard(); + void actDrawCards(); + void actViewLibrary(); void actViewTopCards(); - void actViewGraveyard(); - void actViewRfg(); - void actViewSideboard(); private: QMenu *playerMenu; QAction *aMoveHandToTopLibrary, *aMoveHandToBottomLibrary, - *aViewLibrary, *aViewTopCards, *aViewGraveyard, *aViewRfg, *aViewSideboard; + *aViewLibrary, *aViewTopCards, *aViewGraveyard, *aViewRfg, *aViewSideboard, + *aDrawCard, *aDrawCards, *aShuffle; int defaultNumberTopCards; QString name; diff --git a/cockatrice/src/window_main.cpp b/cockatrice/src/window_main.cpp index 8c5043c6..fc7696d2 100644 --- a/cockatrice/src/window_main.cpp +++ b/cockatrice/src/window_main.cpp @@ -68,6 +68,7 @@ void MainWindow::statusChanged(ProtocolStatus _status) aDisconnect->setEnabled(false); aRestartGame->setEnabled(false); aLeaveGame->setEnabled(false); + phasesToolbar->setActivePhase(-1); phasesToolbar->setEnabled(false); emit logDisconnected(); break; @@ -82,10 +83,12 @@ void MainWindow::statusChanged(ProtocolStatus _status) } aRestartGame->setEnabled(false); aLeaveGame->setEnabled(false); + phasesToolbar->setActivePhase(-1); phasesToolbar->setEnabled(false); GameSelector *gameSelector = new GameSelector(client); viewLayout->insertWidget(0, gameSelector); + break; } case StatusPlaying: phasesToolbar->setEnabled(true); @@ -186,6 +189,8 @@ void MainWindow::serverTimeout() void MainWindow::retranslateUi() { + setWindowTitle(tr("Cockatrice")); + aConnect->setText(tr("&Connect...")); aDisconnect->setText(tr("&Disconnect")); aRestartGame->setText(tr("&Restart game...")); diff --git a/cockatrice/translations/cockatrice_de.ts b/cockatrice/translations/cockatrice_de.ts index 993c09df..8d0dc78e 100644 --- a/cockatrice/translations/cockatrice_de.ts +++ b/cockatrice/translations/cockatrice_de.ts @@ -1,6 +1,6 @@ - - + + @@ -29,7 +29,6 @@ Name - Name der Karte Name @@ -186,7 +185,6 @@ Spiel erstellen - Error Fehler @@ -320,100 +318,100 @@ &Shuffle - Mi&schen + Mi&schen Ctrl+S - Ctrl+S + Ctrl+S &Draw a card - Karte &ziehen + Karte &ziehen Ctrl+D - Ctrl+D + Ctrl+D D&raw cards... - Ka&rten ziehen... + Ka&rten ziehen... Ctrl+E - Ctrl+E + Ctrl+E - + R&oll dice... &Würfeln... - + Ctrl+I Ctrl+I - + &Create token... &Token erstellen... - + Ctrl+T Ctrl+T - + Next &phase Nächste &Phase - + Ctrl+Space Ctrl+Space - + Next &turn Nächster &Zug - + Ctrl+Enter Ctrl+Enter - + Ctrl+Return Ctrl+Return - + &top of library &auf die Bibliothek - + &bottom of library &unter die Bibliothek - + &graveyard in den &Friedhof - + &exile ins &Exil - + &Move to &Verschieben @@ -422,42 +420,42 @@ 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... @@ -466,78 +464,77 @@ 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 + Karten ziehen - - + Number: Anzahl: - + Create token Token erstellen - + Name: Name: - + Set counters Setze Zählmarke @@ -616,9 +613,6 @@ GeneralSettingsPage - - - Choose path Pfad auswählen @@ -659,7 +653,6 @@ Pfad zur Kartendatenbank: - English Deutsch @@ -668,95 +661,100 @@ MainWindow - + Error Fehler - + Server timeout Server Zeitüberschreitung - + &Connect... &Verbinden... - + &Disconnect Verbindung &trennen - + &Restart game... Spiel neu sta&rten... - + F2 F2 - + &Leave game Spiel ver&lassen - + &Deck editor &Deck-Editor - + &Full screen &Vollbild - + Ctrl+F Ctrl+F - + &Settings... &Einstellungen... - + &Exit &Beenden - + Close most recent zone view Letzte Zonenansicht schließen - + Esc Esc - + &Game Spi&el - + &Actions &Aktionen - + &Card &Karte - + &Say: &Sagen: + + + Cockatrice + Cockatrice + MessageLogWidget @@ -878,7 +876,7 @@ %1 puts %2 %3 into graveyard - %1 legt %2 %3 auf den Friedhof + %1 legt %2 %3 auf den Friedhof @@ -1150,17 +1148,17 @@ Player - + Move to &top of library Oben auf die Biblio&thek legen - + Move to &bottom of library Unter die &Bibliothek legen - + &View library &Zeige Bibliothek @@ -1175,65 +1173,105 @@ Zeige die oberen Kar&ten der Bibliothek... - + &View graveyard &Zeige Friedhof - + F4 F4 - + &View removed cards Zeige ent&fernte Karten - + &View sideboard Zeige &Sideboard - + Player "%1" Spieler "%1" - + &Hand &Hand - + &Library Bib&liothek - + &Graveyard &Friedhof - + &Removed cards Entfe&rnte Karten - + &Sideboard &Sideboard - + View top cards of library Zeige die obersten Karten der Bibliothek - + Number of cards: Anzahl der Karten: + + + &Draw card + Karte &ziehen + + + + Ctrl+D + Ctrl+D + + + + D&raw cards... + Ka&rten ziehen... + + + + Ctrl+E + Ctrl+E + + + + &Shuffle + Mi&schen + + + + Ctrl+S + Ctrl+S + + + + Draw cards + Karten ziehen + + + + Number: + Anzahl: + QObject @@ -1248,12 +1286,12 @@ Sideboard - + Cockatrice decks (*.cod) Cockatrice Decks (*.cod) - + Plain text decks (*.dec *.mwDeck) Text Decks (*.dec *.mwDeck) diff --git a/cockatrice/translations/cockatrice_en.ts b/cockatrice/translations/cockatrice_en.ts index 056d0b71..7d86c9a1 100644 --- a/cockatrice/translations/cockatrice_en.ts +++ b/cockatrice/translations/cockatrice_en.ts @@ -1,6 +1,5 @@ - - + CardDatabaseModel @@ -154,7 +153,6 @@ - Error @@ -260,217 +258,181 @@ - &Shuffle - - - - - Ctrl+S - - - - - &Draw a card - - - - - Ctrl+D - - - - - D&raw cards... - - - - - Ctrl+E - - - - R&oll dice... - + Ctrl+I - + &Create token... - + Ctrl+T - + Next &phase - + Ctrl+Space - + Next &turn - + Ctrl+Enter - + Ctrl+Return - + S&ay - + &Tap - + &Untap - + Toggle &normal untapping - + &Flip - + &Add counter - + &Remove counter - + &Set counters... - + &top of library - + &bottom of library - + &graveyard - + &exile - + &Move to - + F5 - + F6 - + F7 - + F8 - + F9 - + F10 - + Set life - + New life total: - + Roll dice - + Number of sides: - - Draw cards - - - - - + Number: - + Create token - + Name: - + Set counters @@ -549,9 +511,6 @@ GeneralSettingsPage - - - Choose path @@ -592,7 +551,6 @@ - English English @@ -601,95 +559,100 @@ MainWindow - + Error - + Server timeout - + &Connect... - + &Disconnect - + &Restart game... - + F2 - + &Leave game - + &Deck editor - + &Full screen - + Ctrl+F - + &Settings... - + &Exit - + Close most recent zone view - + Esc - + &Game - + &Actions - + &Card - + &Say: + + + Cockatrice + + MessageLogWidget @@ -1063,17 +1026,17 @@ Player - + Move to &top of library - + Move to &bottom of library - + &View library @@ -1088,65 +1051,105 @@ - + &View graveyard - + F4 - + &View removed cards - + &View sideboard - + Player "%1" - + &Hand - + &Library - + &Graveyard - + &Removed cards - + &Sideboard - + View top cards of library - + Number of cards: + + + &Draw card + + + + + Ctrl+D + + + + + D&raw cards... + + + + + Ctrl+E + + + + + &Shuffle + + + + + Ctrl+S + + + + + Draw cards + + + + + Number: + + QObject @@ -1161,12 +1164,12 @@ - + Cockatrice decks (*.cod) - + Plain text decks (*.dec *.mwDeck)