diff --git a/cockatrice/src/phasestoolbar.cpp b/cockatrice/src/phasestoolbar.cpp index ec3a78b9..9c474be4 100644 --- a/cockatrice/src/phasestoolbar.cpp +++ b/cockatrice/src/phasestoolbar.cpp @@ -24,14 +24,14 @@ PhaseButton::PhaseButton(const QString &_name, QGraphicsItem *parent, QAction *_ connect(activeAnimationTimer, SIGNAL(timeout()), this, SLOT(updateAnimation())); activeAnimationTimer->setSingleShot(false); } else - activeAnimationCounter = 9.0; + activeAnimationCounter = 9; setCacheMode(DeviceCoordinateCache); } QRectF PhaseButton::boundingRect() const { - return QRectF(0, 0, width, width); + return {0, 0, width, width}; } void PhaseButton::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) @@ -39,21 +39,24 @@ void PhaseButton::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*op QRectF iconRect = boundingRect().adjusted(3, 3, -3, -3); QRectF translatedIconRect = painter->combinedTransform().mapRect(iconRect); qreal scaleFactor = translatedIconRect.width() / iconRect.width(); - QPixmap iconPixmap = PhasePixmapGenerator::generatePixmap(round(translatedIconRect.height()), name); + QPixmap iconPixmap = + PhasePixmapGenerator::generatePixmap(static_cast(round(translatedIconRect.height())), name); - painter->setBrush(QColor(220 * (activeAnimationCounter / 10.0), 220 * (activeAnimationCounter / 10.0), - 220 * (activeAnimationCounter / 10.0))); + painter->setBrush(QColor(static_cast(220 * (activeAnimationCounter / 10.0)), + static_cast(220 * (activeAnimationCounter / 10.0)), + static_cast(220 * (activeAnimationCounter / 10.0)))); painter->setPen(Qt::gray); - painter->drawRect(0, 0, width - 1, width - 1); + painter->drawRect(0, 0, static_cast(width - 1), static_cast(width - 1)); painter->save(); painter->resetTransform(); - painter->drawPixmap(iconPixmap.rect().translated(round(3 * scaleFactor), round(3 * scaleFactor)), iconPixmap, - iconPixmap.rect()); + painter->drawPixmap(iconPixmap.rect().translated(static_cast(round(3 * scaleFactor)), + static_cast(round(3 * scaleFactor))), + iconPixmap, iconPixmap.rect()); painter->restore(); - painter->setBrush(QColor(0, 0, 0, 255 * ((10 - activeAnimationCounter) / 15.0))); + painter->setBrush(QColor(0, 0, 0, static_cast(255 * ((10 - activeAnimationCounter) / 15.0)))); painter->setPen(Qt::gray); - painter->drawRect(0, 0, width - 1, width - 1); + painter->drawRect(0, 0, static_cast(width - 1), static_cast(width - 1)); } void PhaseButton::setWidth(double _width) @@ -105,9 +108,9 @@ void PhaseButton::triggerDoubleClickAction() PhasesToolbar::PhasesToolbar(QGraphicsItem *parent) : QGraphicsItem(parent), width(100), height(100), ySpacing(1), symbolSize(8) { - QAction *aUntapAll = new QAction(this); + auto *aUntapAll = new QAction(this); connect(aUntapAll, SIGNAL(triggered()), this, SLOT(actUntapAll())); - QAction *aDrawCard = new QAction(this); + auto *aDrawCard = new QAction(this); connect(aDrawCard, SIGNAL(triggered()), this, SLOT(actDrawCard())); PhaseButton *untapButton = new PhaseButton("untap", this, aUntapAll); @@ -125,10 +128,10 @@ PhasesToolbar::PhasesToolbar(QGraphicsItem *parent) buttonList << untapButton << upkeepButton << drawButton << main1Button << combatStartButton << combatAttackersButton << combatBlockersButton << combatDamageButton << combatEndButton << main2Button << cleanupButton; - for (int i = 0; i < buttonList.size(); ++i) - connect(buttonList[i], SIGNAL(clicked()), this, SLOT(phaseButtonClicked())); + for (auto &i : buttonList) + connect(i, SIGNAL(clicked()), this, SLOT(phaseButtonClicked())); - nextTurnButton = new PhaseButton("nextturn", this, 0, false); + nextTurnButton = new PhaseButton("nextturn", this, nullptr, false); connect(nextTurnButton, SIGNAL(clicked()), this, SLOT(actNextTurn())); rearrangeButtons(); @@ -138,7 +141,7 @@ PhasesToolbar::PhasesToolbar(QGraphicsItem *parent) QRectF PhasesToolbar::boundingRect() const { - return QRectF(0, 0, width, height); + return {0, 0, width, height}; } void PhasesToolbar::retranslateUi() @@ -186,8 +189,8 @@ const double PhasesToolbar::marginSize = 3; void PhasesToolbar::rearrangeButtons() { - for (int i = 0; i < buttonList.size(); ++i) - buttonList[i]->setWidth(symbolSize); + for (auto &i : buttonList) + i->setWidth(symbolSize); nextTurnButton->setWidth(symbolSize); double y = marginSize; @@ -208,7 +211,7 @@ void PhasesToolbar::rearrangeButtons() buttonList[10]->setPos(marginSize, y += symbolSize); y += ySpacing; y += ySpacing; - nextTurnButton->setPos(marginSize, y += symbolSize); + nextTurnButton->setPos(marginSize, y + symbolSize); } void PhasesToolbar::setHeight(double _height) @@ -232,14 +235,21 @@ void PhasesToolbar::setActivePhase(int phase) buttonList[i]->setActive(i == phase); } +void PhasesToolbar::triggerPhaseAction(int phase) +{ + if (0 <= phase && phase < buttonList.size()) { + buttonList[phase]->triggerDoubleClickAction(); + } +} + void PhasesToolbar::phaseButtonClicked() { - PhaseButton *button = qobject_cast(sender()); + auto *button = qobject_cast(sender()); if (button->getActive()) button->triggerDoubleClickAction(); Command_SetActivePhase cmd; - cmd.set_phase(buttonList.indexOf(button)); + cmd.set_phase(static_cast(buttonList.indexOf(button))); emit sendGameCommand(cmd, -1); } diff --git a/cockatrice/src/phasestoolbar.h b/cockatrice/src/phasestoolbar.h index baa6ad91..f52f45f9 100644 --- a/cockatrice/src/phasestoolbar.h +++ b/cockatrice/src/phasestoolbar.h @@ -27,16 +27,16 @@ private: QAction *doubleClickAction; double width; - void updatePixmap(QPixmap &pixmap); + // void updatePixmap(QPixmap &pixmap); private slots: void updateAnimation(); public: - PhaseButton(const QString &_name, - QGraphicsItem *parent = 0, - QAction *_doubleClickAction = 0, - bool _highlightable = true); - QRectF boundingRect() const; + explicit PhaseButton(const QString &_name, + QGraphicsItem *parent = nullptr, + QAction *_doubleClickAction = nullptr, + bool _highlightable = true); + QRectF boundingRect() const override; void setWidth(double _width); void setActive(bool _active); bool getActive() const @@ -48,9 +48,9 @@ signals: void clicked(); protected: - void paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/); - void mousePressEvent(QGraphicsSceneMouseEvent *event); - void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + void paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) override; + void mousePressEvent(QGraphicsSceneMouseEvent *event) override; + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override; }; class PhasesToolbar : public QObject, public QGraphicsItem @@ -67,8 +67,8 @@ private: void rearrangeButtons(); public: - PhasesToolbar(QGraphicsItem *parent = 0); - QRectF boundingRect() const; + explicit PhasesToolbar(QGraphicsItem *parent = nullptr); + QRectF boundingRect() const override; void retranslateUi(); void setHeight(double _height); double getWidth() const @@ -82,6 +82,7 @@ public: QString getLongPhaseName(int phase) const; public slots: void setActivePhase(int phase); + void triggerPhaseAction(int phase); private slots: void phaseButtonClicked(); void actNextTurn(); @@ -91,7 +92,7 @@ signals: void sendGameCommand(const ::google::protobuf::Message &command, int playerId); protected: - void paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/); + void paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) override; }; #endif diff --git a/cockatrice/src/sequenceEdit/ui_shortcutstab.h b/cockatrice/src/sequenceEdit/ui_shortcutstab.h index 3a826e94..4fb14772 100644 --- a/cockatrice/src/sequenceEdit/ui_shortcutstab.h +++ b/cockatrice/src/sequenceEdit/ui_shortcutstab.h @@ -246,12 +246,14 @@ public: SequenceEdit *TabGame_phase10; QLabel *lbl_TabGame_aNextTurn; SequenceEdit *TabGame_aNextPhase; + QLabel *lbl_TabGame_aNextPhaseAction; + SequenceEdit *TabGame_aNextPhaseAction; + SequenceEdit *TabGame_aNextTurn; QGroupBox *groupBox_13; QGridLayout *gridLayout_13; QLabel *lbl_Player_aTap; SequenceEdit *Player_aTap; - SequenceEdit *Player_aUntap; QLabel *lbl_Player_aUntapAll; SequenceEdit *Player_aUntapAll; QLabel *lbl_Player_aDoesntUntap; @@ -1249,6 +1251,11 @@ public: gridLayout_5->addWidget(lbl_TabGame_aNextPhase, 11, 0, 1, 1); + lbl_TabGame_aNextPhaseAction = new QLabel(groupBox_8); + lbl_TabGame_aNextPhaseAction->setObjectName("lbl_TabGame_aNextPhaseAction"); + + gridLayout_5->addWidget(lbl_TabGame_aNextPhaseAction, 12, 0, 1, 1); + TabGame_phase10 = new SequenceEdit("Player/phase10", groupBox_8); TabGame_phase10->setObjectName("TabGame_phase10"); @@ -1257,17 +1264,22 @@ public: lbl_TabGame_aNextTurn = new QLabel(groupBox_8); lbl_TabGame_aNextTurn->setObjectName("lbl_TabGame_aNextTurn"); - gridLayout_5->addWidget(lbl_TabGame_aNextTurn, 12, 0, 1, 1); + gridLayout_5->addWidget(lbl_TabGame_aNextTurn, 13, 0, 1, 1); TabGame_aNextPhase = new SequenceEdit("Player/aNextPhase", groupBox_8); TabGame_aNextPhase->setObjectName("TabGame_aNextPhase"); gridLayout_5->addWidget(TabGame_aNextPhase, 11, 1, 1, 1); + TabGame_aNextPhaseAction = new SequenceEdit("Player/aNextPhaseAction", groupBox_8); + TabGame_aNextPhaseAction->setObjectName("TabGame_aaNextPhaseAction"); + + gridLayout_5->addWidget(TabGame_aNextPhaseAction, 12, 1, 1, 1); + TabGame_aNextTurn = new SequenceEdit("Player/aNextTurn", groupBox_8); TabGame_aNextTurn->setObjectName("TabGame_aNextTurn"); - gridLayout_5->addWidget(TabGame_aNextTurn, 12, 1, 1, 1); + gridLayout_5->addWidget(TabGame_aNextTurn, 13, 1, 1, 1); gridLayout_17->addWidget(groupBox_8, 0, 0, 1, 1); @@ -1766,7 +1778,7 @@ public: gridLayout_20->addItem(verticalSpacer_3, 2, 1, 1, 1); tabWidget->addTab(tab_3, QString()); tab_4 = new QWidget(tabWidget); - QGridLayout *grid = new QGridLayout(tab_4); + auto *grid = new QGridLayout(tab_4); grid->addWidget(groupBox_3); grid->addItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding), 1, 0); @@ -1782,7 +1794,7 @@ public: btnResetAll->setIcon(QPixmap("theme:icons/update")); btnClearAll->setIcon(QPixmap("theme:icons/clearsearch")); - QHBoxLayout *buttonsLayout = new QHBoxLayout(shortcutsTab); + auto *buttonsLayout = new QHBoxLayout(shortcutsTab); buttonsLayout->addWidget(btnClearAll); buttonsLayout->addWidget(btnResetAll); @@ -1822,181 +1834,180 @@ public: void retranslateUi(QWidget * /*shortcutsTab */) { - groupBox->setTitle(QApplication::translate("shortcutsTab", "Main Window", 0)); - lbl_MainWindow_aDeckEditor->setText(QApplication::translate("shortcutsTab", "Deck editor", 0)); - lbl_MainWindow_aSinglePlayer->setText(QApplication::translate("shortcutsTab", "Local gameplay", 0)); - lbl_MainWindow_aWatchReplay->setText(QApplication::translate("shortcutsTab", "Watch replay", 0)); - lbl_MainWindow_aConnect->setText(QApplication::translate("shortcutsTab", "Connect", 0)); - lbl_MainWindow_aRegister->setText(QApplication::translate("shortcutsTab", "Register", 0)); - lbl_MainWindow_aFullScreen->setText(QApplication::translate("shortcutsTab", "Full screen", 0)); - lbl_MainWindow_aSettings->setText(QApplication::translate("shortcutsTab", "Settings", 0)); - lbl_MainWindow_aCheckCardUpdates->setText(QApplication::translate("shortcutsTab", "Check for card updates", 0)); - lbl_MainWindow_aDisconnect->setText(QApplication::translate("shortcutsTab", "Disconnect", 0)); - lbl_MainWindow_aExit->setText(QApplication::translate("shortcutsTab", "Exit", 0)); - groupBox_2->setTitle(QApplication::translate("shortcutsTab", "Deck Editor", 0)); - lbl_TabDeckEditor_aAnalyzeDeck->setText(QApplication::translate("shortcutsTab", "Analyze deck", 0)); + groupBox->setTitle(QApplication::translate("shortcutsTab", "Main Window")); + lbl_MainWindow_aDeckEditor->setText(QApplication::translate("shortcutsTab", "Deck editor")); + lbl_MainWindow_aSinglePlayer->setText(QApplication::translate("shortcutsTab", "Local gameplay")); + lbl_MainWindow_aWatchReplay->setText(QApplication::translate("shortcutsTab", "Watch replay")); + lbl_MainWindow_aConnect->setText(QApplication::translate("shortcutsTab", "Connect")); + lbl_MainWindow_aRegister->setText(QApplication::translate("shortcutsTab", "Register")); + lbl_MainWindow_aFullScreen->setText(QApplication::translate("shortcutsTab", "Full screen")); + lbl_MainWindow_aSettings->setText(QApplication::translate("shortcutsTab", "Settings")); + lbl_MainWindow_aCheckCardUpdates->setText(QApplication::translate("shortcutsTab", "Check for card updates")); + lbl_MainWindow_aDisconnect->setText(QApplication::translate("shortcutsTab", "Disconnect")); + lbl_MainWindow_aExit->setText(QApplication::translate("shortcutsTab", "Exit")); + groupBox_2->setTitle(QApplication::translate("shortcutsTab", "Deck Editor")); + lbl_TabDeckEditor_aAnalyzeDeck->setText(QApplication::translate("shortcutsTab", "Analyze deck")); lbl_TabDeckEditor_aLoadDeckFromClipboard->setText( - QApplication::translate("shortcutsTab", "Load deck (clipboard)", 0)); - lbl_TabDeckEditor_aClearFilterAll->setText(QApplication::translate("shortcutsTab", "Clear all filters", 0)); - lbl_TabDeckEditor_aNewDeck->setText(QApplication::translate("shortcutsTab", "New deck", 0)); - lbl_TabDeckEditor_aClearFilterOne->setText(QApplication::translate("shortcutsTab", "Clear selected filter", 0)); - lbl_TabDeckEditor_aOpenCustomFolder->setText( - QApplication::translate("shortcutsTab", "Open custom pic folder", 0)); - lbl_TabDeckEditor_aClose->setText(QApplication::translate("shortcutsTab", "Close", 0)); - lbl_TabDeckEditor_aPrintDeck->setText(QApplication::translate("shortcutsTab", "Print deck", 0)); - lbl_TabDeckEditor_aManageSets->setText(QApplication::translate("shortcutsTab", "Manage sets", 0)); - lbl_TabDeckEditor_aRemoveCard->setText(QApplication::translate("shortcutsTab", "Delete card", 0)); - lbl_TabDeckEditor_aEditTokens->setText(QApplication::translate("shortcutsTab", "Edit tokens", 0)); - lbl_TabDeckEditor_aResetLayout->setText(QApplication::translate("shortcutsTab", "Reset layout", 0)); - lbl_TabDeckEditor_aIncrement->setText(QApplication::translate("shortcutsTab", "Add card", 0)); - lbl_TabDeckEditor_aSaveDeck->setText(QApplication::translate("shortcutsTab", "Save deck", 0)); - lbl_TabDeckEditor_aExportDeckDecklist->setText(QApplication::translate("shortcutsTab", "Export deck", 0)); - lbl_TabDeckEditor_aDecrement->setText(QApplication::translate("shortcutsTab", "Remove card", 0)); - lbl_TabDeckEditor_aSaveDeckAs->setText(QApplication::translate("shortcutsTab", "Save deck as", 0)); - lbl_TabDeckEditor_aLoadDeck->setText(QApplication::translate("shortcutsTab", "Load deck", 0)); - lbl_TabDeckEditor_aSaveDeckToClipboard->setText(QApplication::translate("shortcutsTab", "Save deck (clip)", 0)); + QApplication::translate("shortcutsTab", "Load deck (clipboard)")); + lbl_TabDeckEditor_aClearFilterAll->setText(QApplication::translate("shortcutsTab", "Clear all filters")); + lbl_TabDeckEditor_aNewDeck->setText(QApplication::translate("shortcutsTab", "New deck")); + lbl_TabDeckEditor_aClearFilterOne->setText(QApplication::translate("shortcutsTab", "Clear selected filter")); + lbl_TabDeckEditor_aOpenCustomFolder->setText(QApplication::translate("shortcutsTab", "Open custom pic folder")); + lbl_TabDeckEditor_aClose->setText(QApplication::translate("shortcutsTab", "Close")); + lbl_TabDeckEditor_aPrintDeck->setText(QApplication::translate("shortcutsTab", "Print deck")); + lbl_TabDeckEditor_aManageSets->setText(QApplication::translate("shortcutsTab", "Manage sets")); + lbl_TabDeckEditor_aRemoveCard->setText(QApplication::translate("shortcutsTab", "Delete card")); + lbl_TabDeckEditor_aEditTokens->setText(QApplication::translate("shortcutsTab", "Edit tokens")); + lbl_TabDeckEditor_aResetLayout->setText(QApplication::translate("shortcutsTab", "Reset layout")); + lbl_TabDeckEditor_aIncrement->setText(QApplication::translate("shortcutsTab", "Add card")); + lbl_TabDeckEditor_aSaveDeck->setText(QApplication::translate("shortcutsTab", "Save deck")); + lbl_TabDeckEditor_aExportDeckDecklist->setText(QApplication::translate("shortcutsTab", "Export deck")); + lbl_TabDeckEditor_aDecrement->setText(QApplication::translate("shortcutsTab", "Remove card")); + lbl_TabDeckEditor_aSaveDeckAs->setText(QApplication::translate("shortcutsTab", "Save deck as")); + lbl_TabDeckEditor_aLoadDeck->setText(QApplication::translate("shortcutsTab", "Load deck")); + lbl_TabDeckEditor_aSaveDeckToClipboard->setText(QApplication::translate("shortcutsTab", "Save deck (clip)")); lbl_TabDeckEditor_aSaveDeckToClipboardRaw->setText( - QApplication::translate("shortcutsTab", "Save deck (clip; no annotations)", 0)); - groupBox_3->setTitle(QApplication::translate("shortcutsTab", "Counters", 0)); - groupBox_4->setTitle(QApplication::translate("shortcutsTab", "Life", 0)); - lbl_abstractCounter_sSet->setText(QApplication::translate("shortcutsTab", "Set", 0)); - lbl_abstractCounter_aInc->setText(QApplication::translate("shortcutsTab", "Add", 0)); - lbl_abstractCounter_aDec->setText(QApplication::translate("shortcutsTab", "Remove", 0)); - groupBox_5->setTitle(QApplication::translate("shortcutsTab", "Red", 0)); - lbl_Player_aSCRed->setText(QApplication::translate("shortcutsTab", "Set", 0)); - lbl_Player_aCCRed->setText(QApplication::translate("shortcutsTab", "Add", 0)); - lbl_Player_aRCRed->setText(QApplication::translate("shortcutsTab", "Remove", 0)); - groupBox_6->setTitle(QApplication::translate("shortcutsTab", "Green", 0)); - lbl_Player_aSCGreen->setText(QApplication::translate("shortcutsTab", "Set", 0)); - lbl_Player_aCCGreen->setText(QApplication::translate("shortcutsTab", "Add", 0)); - lbl_Player_aRCGreen->setText(QApplication::translate("shortcutsTab", "Remove", 0)); - groupBox_7->setTitle(QApplication::translate("shortcutsTab", "Yellow", 0)); - lbl_Player_aSCYellow->setText(QApplication::translate("shortcutsTab", "Set", 0)); - lbl_Player_aCCYellow->setText(QApplication::translate("shortcutsTab", "Add", 0)); - lbl_Player_aRCYellow->setText(QApplication::translate("shortcutsTab", "Remove", 0)); + QApplication::translate("shortcutsTab", "Save deck (clip; no annotations)")); + groupBox_3->setTitle(QApplication::translate("shortcutsTab", "Counters")); + groupBox_4->setTitle(QApplication::translate("shortcutsTab", "Life")); + lbl_abstractCounter_sSet->setText(QApplication::translate("shortcutsTab", "Set")); + lbl_abstractCounter_aInc->setText(QApplication::translate("shortcutsTab", "Add")); + lbl_abstractCounter_aDec->setText(QApplication::translate("shortcutsTab", "Remove")); + groupBox_5->setTitle(QApplication::translate("shortcutsTab", "Red")); + lbl_Player_aSCRed->setText(QApplication::translate("shortcutsTab", "Set")); + lbl_Player_aCCRed->setText(QApplication::translate("shortcutsTab", "Add")); + lbl_Player_aRCRed->setText(QApplication::translate("shortcutsTab", "Remove")); + groupBox_6->setTitle(QApplication::translate("shortcutsTab", "Green")); + lbl_Player_aSCGreen->setText(QApplication::translate("shortcutsTab", "Set")); + lbl_Player_aCCGreen->setText(QApplication::translate("shortcutsTab", "Add")); + lbl_Player_aRCGreen->setText(QApplication::translate("shortcutsTab", "Remove")); + groupBox_7->setTitle(QApplication::translate("shortcutsTab", "Yellow")); + lbl_Player_aSCYellow->setText(QApplication::translate("shortcutsTab", "Set")); + lbl_Player_aCCYellow->setText(QApplication::translate("shortcutsTab", "Add")); + lbl_Player_aRCYellow->setText(QApplication::translate("shortcutsTab", "Remove")); - groupBox_counterStorm->setTitle(QApplication::translate("shortcutsTab", "Storm", 0)); - lbl_Player_aSetCStorm->setText(QApplication::translate("shortcutsTab", "Set", 0)); - lbl_Player_aIncCStorm->setText(QApplication::translate("shortcutsTab", "Add", 0)); - lbl_Player_aDecCStorm->setText(QApplication::translate("shortcutsTab", "Remove", 0)); - groupBox_counterW->setTitle(QApplication::translate("shortcutsTab", "W", 0)); - lbl_Player_aSetCW->setText(QApplication::translate("shortcutsTab", "Set", 0)); - lbl_Player_aIncCW->setText(QApplication::translate("shortcutsTab", "Add", 0)); - lbl_Player_aDecCW->setText(QApplication::translate("shortcutsTab", "Remove", 0)); - groupBox_counterU->setTitle(QApplication::translate("shortcutsTab", "U", 0)); - lbl_Player_aSetCU->setText(QApplication::translate("shortcutsTab", "Set", 0)); - lbl_Player_aIncCU->setText(QApplication::translate("shortcutsTab", "Add", 0)); - lbl_Player_aDecCU->setText(QApplication::translate("shortcutsTab", "Remove", 0)); - groupBox_counterB->setTitle(QApplication::translate("shortcutsTab", "B", 0)); - lbl_Player_aSetCB->setText(QApplication::translate("shortcutsTab", "Set", 0)); - lbl_Player_aIncCB->setText(QApplication::translate("shortcutsTab", "Add", 0)); - lbl_Player_aDecCB->setText(QApplication::translate("shortcutsTab", "Remove", 0)); - groupBox_counterR->setTitle(QApplication::translate("shortcutsTab", "R", 0)); - lbl_Player_aSetCR->setText(QApplication::translate("shortcutsTab", "Set", 0)); - lbl_Player_aIncCR->setText(QApplication::translate("shortcutsTab", "Add", 0)); - lbl_Player_aDecCR->setText(QApplication::translate("shortcutsTab", "Remove", 0)); - groupBox_counterG->setTitle(QApplication::translate("shortcutsTab", "G", 0)); - lbl_Player_aSetCG->setText(QApplication::translate("shortcutsTab", "Set", 0)); - lbl_Player_aIncCG->setText(QApplication::translate("shortcutsTab", "Add", 0)); - lbl_Player_aDecCG->setText(QApplication::translate("shortcutsTab", "Remove", 0)); - groupBox_counterX->setTitle(QApplication::translate("shortcutsTab", "X", 0)); - lbl_Player_aSetCX->setText(QApplication::translate("shortcutsTab", "Set", 0)); - lbl_Player_aIncCX->setText(QApplication::translate("shortcutsTab", "Add", 0)); - lbl_Player_aDecCX->setText(QApplication::translate("shortcutsTab", "Remove", 0)); + groupBox_counterStorm->setTitle(QApplication::translate("shortcutsTab", "Storm")); + lbl_Player_aSetCStorm->setText(QApplication::translate("shortcutsTab", "Set")); + lbl_Player_aIncCStorm->setText(QApplication::translate("shortcutsTab", "Add")); + lbl_Player_aDecCStorm->setText(QApplication::translate("shortcutsTab", "Remove")); + groupBox_counterW->setTitle(QApplication::translate("shortcutsTab", "W")); + lbl_Player_aSetCW->setText(QApplication::translate("shortcutsTab", "Set")); + lbl_Player_aIncCW->setText(QApplication::translate("shortcutsTab", "Add")); + lbl_Player_aDecCW->setText(QApplication::translate("shortcutsTab", "Remove")); + groupBox_counterU->setTitle(QApplication::translate("shortcutsTab", "U")); + lbl_Player_aSetCU->setText(QApplication::translate("shortcutsTab", "Set")); + lbl_Player_aIncCU->setText(QApplication::translate("shortcutsTab", "Add")); + lbl_Player_aDecCU->setText(QApplication::translate("shortcutsTab", "Remove")); + groupBox_counterB->setTitle(QApplication::translate("shortcutsTab", "B")); + lbl_Player_aSetCB->setText(QApplication::translate("shortcutsTab", "Set")); + lbl_Player_aIncCB->setText(QApplication::translate("shortcutsTab", "Add")); + lbl_Player_aDecCB->setText(QApplication::translate("shortcutsTab", "Remove")); + groupBox_counterR->setTitle(QApplication::translate("shortcutsTab", "R")); + lbl_Player_aSetCR->setText(QApplication::translate("shortcutsTab", "Set")); + lbl_Player_aIncCR->setText(QApplication::translate("shortcutsTab", "Add")); + lbl_Player_aDecCR->setText(QApplication::translate("shortcutsTab", "Remove")); + groupBox_counterG->setTitle(QApplication::translate("shortcutsTab", "G")); + lbl_Player_aSetCG->setText(QApplication::translate("shortcutsTab", "Set")); + lbl_Player_aIncCG->setText(QApplication::translate("shortcutsTab", "Add")); + lbl_Player_aDecCG->setText(QApplication::translate("shortcutsTab", "Remove")); + groupBox_counterX->setTitle(QApplication::translate("shortcutsTab", "X")); + lbl_Player_aSetCX->setText(QApplication::translate("shortcutsTab", "Set")); + lbl_Player_aIncCX->setText(QApplication::translate("shortcutsTab", "Add")); + lbl_Player_aDecCX->setText(QApplication::translate("shortcutsTab", "Remove")); - lbl_Player_aSCYellow->setText(QApplication::translate("shortcutsTab", "Set", 0)); - lbl_Player_aCCYellow->setText(QApplication::translate("shortcutsTab", "Add", 0)); - lbl_Player_aRCYellow->setText(QApplication::translate("shortcutsTab", "Remove", 0)); + lbl_Player_aSCYellow->setText(QApplication::translate("shortcutsTab", "Set")); + lbl_Player_aCCYellow->setText(QApplication::translate("shortcutsTab", "Add")); + lbl_Player_aRCYellow->setText(QApplication::translate("shortcutsTab", "Remove")); tabWidget->setTabText(tabWidget->indexOf(tab), - QApplication::translate("shortcutsTab", "Main Window | Deck Editor", 0)); - groupBox_9->setTitle(QApplication::translate("shortcutsTab", "Power / Toughness", 0)); - groupBox_12->setTitle(QApplication::translate("shortcutsTab", "Power and Toughness", 0)); - lbl_Player_aIncPT->setText(QApplication::translate("shortcutsTab", "Add (+1/+1)", 0)); - lbl_Player_aDecPT->setText(QApplication::translate("shortcutsTab", "Remove (-1/-1)", 0)); - lbl_Player_aResetPT->setText(QApplication::translate("shortcutsTab", "Reset", 0)); - lbl_Player_aSetPT->setText(QApplication::translate("shortcutsTab", "Set", 0)); - groupBox_11->setTitle(QApplication::translate("shortcutsTab", "Toughness", 0)); - lbl_Player_aDecT->setText(QApplication::translate("shortcutsTab", "Remove (-0/-1)", 0)); - lbl_Player_aIncT->setText(QApplication::translate("shortcutsTab", "Add (+0/+1)", 0)); - groupBox_10->setTitle(QApplication::translate("shortcutsTab", "Power", 0)); - lbl_Player_aDecP->setText(QApplication::translate("shortcutsTab", "Remove (-1/-0)", 0)); - lbl_Player_aIncP->setText(QApplication::translate("shortcutsTab", "Add (+1/+0)", 0)); - groupBox_8->setTitle(QApplication::translate("shortcutsTab", "Game Phases", 0)); - lbl_TabGame_phase0->setText(QApplication::translate("shortcutsTab", "Untap", 0)); - lbl_TabGame_phase1->setText(QApplication::translate("shortcutsTab", "Upkeep", 0)); - lbl_TabGame_phase2->setText(QApplication::translate("shortcutsTab", "Draw", 0)); - lbl_TabGame_phase3->setText(QApplication::translate("shortcutsTab", "Main 1", 0)); - lbl_TabGame_phase4->setText(QApplication::translate("shortcutsTab", "Start combat", 0)); - lbl_TabGame_phase5->setText(QApplication::translate("shortcutsTab", "Attack", 0)); - lbl_TabGame_phase6->setText(QApplication::translate("shortcutsTab", "Block", 0)); - lbl_TabGame_phase7->setText(QApplication::translate("shortcutsTab", "Damage", 0)); - lbl_TabGame_phase8->setText(QApplication::translate("shortcutsTab", "End combat", 0)); - lbl_TabGame_phase9->setText(QApplication::translate("shortcutsTab", "Main 2", 0)); - lbl_TabGame_phase10->setText(QApplication::translate("shortcutsTab", "End", 0)); - lbl_TabGame_aNextPhase->setText(QApplication::translate("shortcutsTab", "Next phase", 0)); - lbl_TabGame_aNextTurn->setText(QApplication::translate("shortcutsTab", "Next turn", 0)); - groupBox_13->setTitle(QApplication::translate("shortcutsTab", "Playing Area", 0)); - lbl_Player_aTap->setText(QApplication::translate("shortcutsTab", "Tap / Untap Card", 0)); - lbl_Player_aUntapAll->setText(QApplication::translate("shortcutsTab", "Untap all", 0)); - lbl_Player_aDoesntUntap->setText(QApplication::translate("shortcutsTab", "Toggle untap", 0)); - lbl_Player_aFlip->setText(QApplication::translate("shortcutsTab", "Flip card", 0)); - lbl_Player_aPeek->setText(QApplication::translate("shortcutsTab", "Peek card", 0)); - lbl_Player_aPlay->setText(QApplication::translate("shortcutsTab", "Play card", 0)); - lbl_Player_aAttach->setText(QApplication::translate("shortcutsTab", "Attach card", 0)); - lbl_Player_aUnattach->setText(QApplication::translate("shortcutsTab", "Unattach card", 0)); - lbl_Player_aClone->setText(QApplication::translate("shortcutsTab", "Clone card", 0)); - lbl_Player_aCreateToken->setText(QApplication::translate("shortcutsTab", "Create token", 0)); - lbl_Player_aCreateRelatedTokens->setText( - QApplication::translate("shortcutsTab", "Create all related tokens", 0)); - lbl_Player_aCreateAnotherToken->setText(QApplication::translate("shortcutsTab", "Create another token", 0)); - lbl_Player_aSetAnnotation->setText(QApplication::translate("shortcutsTab", "Set annotation", 0)); + QApplication::translate("shortcutsTab", "Main Window | Deck Editor")); + groupBox_9->setTitle(QApplication::translate("shortcutsTab", "Power / Toughness")); + groupBox_12->setTitle(QApplication::translate("shortcutsTab", "Power and Toughness")); + lbl_Player_aIncPT->setText(QApplication::translate("shortcutsTab", "Add (+1/+1)")); + lbl_Player_aDecPT->setText(QApplication::translate("shortcutsTab", "Remove (-1/-1)")); + lbl_Player_aResetPT->setText(QApplication::translate("shortcutsTab", "Reset")); + lbl_Player_aSetPT->setText(QApplication::translate("shortcutsTab", "Set")); + groupBox_11->setTitle(QApplication::translate("shortcutsTab", "Toughness")); + lbl_Player_aDecT->setText(QApplication::translate("shortcutsTab", "Remove (-0/-1)")); + lbl_Player_aIncT->setText(QApplication::translate("shortcutsTab", "Add (+0/+1)")); + groupBox_10->setTitle(QApplication::translate("shortcutsTab", "Power")); + lbl_Player_aDecP->setText(QApplication::translate("shortcutsTab", "Remove (-1/-nullptr)")); + lbl_Player_aIncP->setText(QApplication::translate("shortcutsTab", "Add (+1/+nullptr)")); + groupBox_8->setTitle(QApplication::translate("shortcutsTab", "Game Phases")); + lbl_TabGame_phase0->setText(QApplication::translate("shortcutsTab", "Untap")); + lbl_TabGame_phase1->setText(QApplication::translate("shortcutsTab", "Upkeep")); + lbl_TabGame_phase2->setText(QApplication::translate("shortcutsTab", "Draw")); + lbl_TabGame_phase3->setText(QApplication::translate("shortcutsTab", "Main 1")); + lbl_TabGame_phase4->setText(QApplication::translate("shortcutsTab", "Start combat")); + lbl_TabGame_phase5->setText(QApplication::translate("shortcutsTab", "Attack")); + lbl_TabGame_phase6->setText(QApplication::translate("shortcutsTab", "Block")); + lbl_TabGame_phase7->setText(QApplication::translate("shortcutsTab", "Damage")); + lbl_TabGame_phase8->setText(QApplication::translate("shortcutsTab", "End combat")); + lbl_TabGame_phase9->setText(QApplication::translate("shortcutsTab", "Main 2")); + lbl_TabGame_phase10->setText(QApplication::translate("shortcutsTab", "End")); + lbl_TabGame_aNextPhase->setText(QApplication::translate("shortcutsTab", "Next phase")); + lbl_TabGame_aNextPhaseAction->setText(QApplication::translate("shortcutsTab", "Next phase action")); + lbl_TabGame_aNextTurn->setText(QApplication::translate("shortcutsTab", "Next turn")); + groupBox_13->setTitle(QApplication::translate("shortcutsTab", "Playing Area")); + lbl_Player_aTap->setText(QApplication::translate("shortcutsTab", "Tap / Untap Card")); + lbl_Player_aUntapAll->setText(QApplication::translate("shortcutsTab", "Untap all")); + lbl_Player_aDoesntUntap->setText(QApplication::translate("shortcutsTab", "Toggle untap")); + lbl_Player_aFlip->setText(QApplication::translate("shortcutsTab", "Flip card")); + lbl_Player_aPeek->setText(QApplication::translate("shortcutsTab", "Peek card")); + lbl_Player_aPlay->setText(QApplication::translate("shortcutsTab", "Play card")); + lbl_Player_aAttach->setText(QApplication::translate("shortcutsTab", "Attach card")); + lbl_Player_aUnattach->setText(QApplication::translate("shortcutsTab", "Unattach card")); + lbl_Player_aClone->setText(QApplication::translate("shortcutsTab", "Clone card")); + lbl_Player_aCreateToken->setText(QApplication::translate("shortcutsTab", "Create token")); + lbl_Player_aCreateRelatedTokens->setText(QApplication::translate("shortcutsTab", "Create all related tokens")); + lbl_Player_aCreateAnotherToken->setText(QApplication::translate("shortcutsTab", "Create another token")); + lbl_Player_aSetAnnotation->setText(QApplication::translate("shortcutsTab", "Set annotation")); tabWidget->setTabText(tabWidget->indexOf(tab_2), - QApplication::translate("shortcutsTab", "Phases | P/T | Playing Area", 0)); - groupBox_moveCard->setTitle(QApplication::translate("shortcutsTab", "Move selected card to", 0)); - lbl_Player_aMoveToBottomLibrary->setText(QApplication::translate("shortcutsTab", "Bottom library", 0)); - lbl_Player_aMoveToTopLibrary->setText(QApplication::translate("shortcutsTab", "Top library", 0)); - lbl_Player_aMoveToGraveyard->setText(QApplication::translate("shortcutsTab", "Graveyard", 0)); - lbl_Player_aMoveToExile->setText(QApplication::translate("shortcutsTab", "Exile", 0)); - lbl_Player_aMoveToHand->setText(QApplication::translate("shortcutsTab", "Hand", 0)); + QApplication::translate("shortcutsTab", "Phases | P/T | Playing Area")); + groupBox_moveCard->setTitle(QApplication::translate("shortcutsTab", "Move selected card to")); + lbl_Player_aMoveToBottomLibrary->setText(QApplication::translate("shortcutsTab", "Bottom library")); + lbl_Player_aMoveToTopLibrary->setText(QApplication::translate("shortcutsTab", "Top library")); + lbl_Player_aMoveToGraveyard->setText(QApplication::translate("shortcutsTab", "Graveyard")); + lbl_Player_aMoveToExile->setText(QApplication::translate("shortcutsTab", "Exile")); + lbl_Player_aMoveToHand->setText(QApplication::translate("shortcutsTab", "Hand")); lbl_Player_aMoveTopToPlayFaceDown->setText(QApplication::translate("shortcutsTab", "Play face down")); - groupBox_view->setTitle(QApplication::translate("shortcutsTab", "View", 0)); - lbl_Player_aViewGraveyard->setText(QApplication::translate("shortcutsTab", "Graveyard", 0)); - lbl_Player_aViewLibrary->setText(QApplication::translate("shortcutsTab", "Library", 0)); - lbl_Player_aViewTopCards->setText(QApplication::translate("shortcutsTab", "Top cards of library", 0)); - lbl_Player_aViewSideboard->setText(QApplication::translate("shortcutsTab", "Sideboard", 0)); - lbl_Player_aViewRfg->setText(QApplication::translate("shortcutsTab", "Exile", 0)); - lbl_GameView_aCloseMostRecentZoneView->setText(QApplication::translate("shortcutsTab", "Close recent view", 0)); - groupBox_moveDeck->setTitle(QApplication::translate("shortcutsTab", "Move top card to", 0)); - lbl_Player_aMoveTopCardToGraveyard->setText(QApplication::translate("shortcutsTab", "Graveyard Once", 0)); - lbl_Player_aMoveTopCardsToGraveyard->setText(QApplication::translate("shortcutsTab", "Graveyard Multiple", 0)); - lbl_Player_aMoveTopCardToExile->setText(QApplication::translate("shortcutsTab", "Exile Once", 0)); - lbl_Player_aMoveTopCardsToExile->setText(QApplication::translate("shortcutsTab", "Exile Multiple", 0)); - groupBox_gameLobby->setTitle(QApplication::translate("shortcutsTab", "Game Lobby", 0)); - lbl_DeckViewContainer_loadRemoteButton->setText(QApplication::translate("shortcutsTab", "Load remote deck", 0)); - lbl_DeckViewContainer_loadLocalButton->setText(QApplication::translate("shortcutsTab", "Load local deck", 0)); - groupBox_gameplay->setTitle(QApplication::translate("shortcutsTab", "Gameplay", 0)); - lbl_Player_aDrawArrow->setText(QApplication::translate("shortcutsTab", "Draw arrow", 0)); - lbl_TabGame_aLeaveGame->setText(QApplication::translate("shortcutsTab", "Leave game", 0)); - lbl_TabGame_aRemoveLocalArrows->setText(QApplication::translate("shortcutsTab", "Remove local arrows", 0)); - lbl_TabGame_aConcede->setText(QApplication::translate("shortcutsTab", "Concede", 0)); - lbl_Player_aRollDie->setText(QApplication::translate("shortcutsTab", "Roll dice", 0)); - lbl_TabGame_aRotateViewCW->setText(QApplication::translate("shortcutsTab", "Rotate view CW", 0)); - lbl_Player_aShuffle->setText(QApplication::translate("shortcutsTab", "Shuffle library", 0)); - lbl_TabGame_aRotateViewCCW->setText(QApplication::translate("shortcutsTab", "Rotate view CCW", 0)); - groupBox_draw->setTitle(QApplication::translate("shortcutsTab", "Drawing", 0)); - lbl_Player_aMulligan->setText(QApplication::translate("shortcutsTab", "Mulligan", 0)); - lbl_Player_aDrawCard->setText(QApplication::translate("shortcutsTab", "Draw card", 0)); - lbl_Player_aDrawCards->setText(QApplication::translate("shortcutsTab", "Draw cards", 0)); - lbl_Player_aUndoDraw->setText(QApplication::translate("shortcutsTab", "Undo draw", 0)); - lbl_Player_aAlwaysRevealTopCard->setText(QApplication::translate("shortcutsTab", "Always reveal top card", 0)); + groupBox_view->setTitle(QApplication::translate("shortcutsTab", "View")); + lbl_Player_aViewGraveyard->setText(QApplication::translate("shortcutsTab", "Graveyard")); + lbl_Player_aViewLibrary->setText(QApplication::translate("shortcutsTab", "Library")); + lbl_Player_aViewTopCards->setText(QApplication::translate("shortcutsTab", "Top cards of library")); + lbl_Player_aViewSideboard->setText(QApplication::translate("shortcutsTab", "Sideboard")); + lbl_Player_aViewRfg->setText(QApplication::translate("shortcutsTab", "Exile")); + lbl_GameView_aCloseMostRecentZoneView->setText(QApplication::translate("shortcutsTab", "Close recent view")); + groupBox_moveDeck->setTitle(QApplication::translate("shortcutsTab", "Move top card to")); + lbl_Player_aMoveTopCardToGraveyard->setText(QApplication::translate("shortcutsTab", "Graveyard Once")); + lbl_Player_aMoveTopCardsToGraveyard->setText(QApplication::translate("shortcutsTab", "Graveyard Multiple")); + lbl_Player_aMoveTopCardToExile->setText(QApplication::translate("shortcutsTab", "Exile Once")); + lbl_Player_aMoveTopCardsToExile->setText(QApplication::translate("shortcutsTab", "Exile Multiple")); + groupBox_gameLobby->setTitle(QApplication::translate("shortcutsTab", "Game Lobby")); + lbl_DeckViewContainer_loadRemoteButton->setText(QApplication::translate("shortcutsTab", "Load remote deck")); + lbl_DeckViewContainer_loadLocalButton->setText(QApplication::translate("shortcutsTab", "Load local deck")); + groupBox_gameplay->setTitle(QApplication::translate("shortcutsTab", "Gameplay")); + lbl_Player_aDrawArrow->setText(QApplication::translate("shortcutsTab", "Draw arrow")); + lbl_TabGame_aLeaveGame->setText(QApplication::translate("shortcutsTab", "Leave game")); + lbl_TabGame_aRemoveLocalArrows->setText(QApplication::translate("shortcutsTab", "Remove local arrows")); + lbl_TabGame_aConcede->setText(QApplication::translate("shortcutsTab", "Concede")); + lbl_Player_aRollDie->setText(QApplication::translate("shortcutsTab", "Roll dice")); + lbl_TabGame_aRotateViewCW->setText(QApplication::translate("shortcutsTab", "Rotate view CW")); + lbl_Player_aShuffle->setText(QApplication::translate("shortcutsTab", "Shuffle library")); + lbl_TabGame_aRotateViewCCW->setText(QApplication::translate("shortcutsTab", "Rotate view CCW")); + groupBox_draw->setTitle(QApplication::translate("shortcutsTab", "Drawing")); + lbl_Player_aMulligan->setText(QApplication::translate("shortcutsTab", "Mulligan")); + lbl_Player_aDrawCard->setText(QApplication::translate("shortcutsTab", "Draw card")); + lbl_Player_aDrawCards->setText(QApplication::translate("shortcutsTab", "Draw cards")); + lbl_Player_aUndoDraw->setText(QApplication::translate("shortcutsTab", "Undo draw")); + lbl_Player_aAlwaysRevealTopCard->setText(QApplication::translate("shortcutsTab", "Always reveal top card")); tabWidget->setTabText(tabWidget->indexOf(tab_3), - QApplication::translate("shortcutsTab", "Gameplay | Draw | Move | View", 0)); - tabWidget->setTabText(tabWidget->indexOf(tab_4), QApplication::translate("shortcutsTab", "Counters", 0)); + QApplication::translate("shortcutsTab", "Gameplay | Draw | Move | View")); + tabWidget->setTabText(tabWidget->indexOf(tab_4), QApplication::translate("shortcutsTab", "Counters")); faqLabel->setText(QString("%2") .arg(WIKI) - .arg(QApplication::translate("shortcutsTab", "How to set custom shortcuts", 0))); - btnResetAll->setText(QApplication::translate("shortcutsTab", "Restore all default shortcuts", 0)); - btnClearAll->setText(QApplication::translate("shortcutsTab", "Clear all shortcuts", 0)); + .arg(QApplication::translate("shortcutsTab", "How to set custom shortcuts"))); + btnResetAll->setText(QApplication::translate("shortcutsTab", "Restore all default shortcuts")); + btnClearAll->setText(QApplication::translate("shortcutsTab", "Clear all shortcuts")); } // retranslateUi }; diff --git a/cockatrice/src/shortcutssettings.cpp b/cockatrice/src/shortcutssettings.cpp index 002ae8e5..4fe4d844 100644 --- a/cockatrice/src/shortcutssettings.cpp +++ b/cockatrice/src/shortcutssettings.cpp @@ -86,8 +86,8 @@ QString ShortcutsSettings::getShortcutString(const QString &name) const QString ShortcutsSettings::stringifySequence(const QList &Sequence) const { QStringList stringSequence; - for (int i = 0; i < Sequence.size(); ++i) { - stringSequence.append(Sequence.at(i).toString(QKeySequence::PortableText)); + for (const auto &i : Sequence) { + stringSequence.append(i.toString(QKeySequence::PortableText)); } return stringSequence.join(sep); diff --git a/cockatrice/src/shortcutssettings.h b/cockatrice/src/shortcutssettings.h index 902db3d7..6887cf75 100644 --- a/cockatrice/src/shortcutssettings.h +++ b/cockatrice/src/shortcutssettings.h @@ -143,6 +143,7 @@ private: {"Player/aConcede", parseSequenceString("F2")}, {"Player/aLeaveGame", parseSequenceString("Ctrl+Q")}, {"Player/aNextPhase", parseSequenceString("Ctrl+Space;Tab")}, + {"Player/aNextPhaseAction", parseSequenceString("Shift+Tab")}, {"Player/aNextTurn", parseSequenceString("Ctrl+Return;Ctrl+Enter")}, {"Player/aRemoveLocalArrows", parseSequenceString("Ctrl+R")}, {"Player/aRotateViewCCW", parseSequenceString("")}, diff --git a/cockatrice/src/tab_game.cpp b/cockatrice/src/tab_game.cpp index 580af983..b659d667 100644 --- a/cockatrice/src/tab_game.cpp +++ b/cockatrice/src/tab_game.cpp @@ -95,7 +95,7 @@ void ToggleButton::setState(bool _state) } DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent) - : QWidget(0), parentGame(parent), playerId(_playerId) + : QWidget(nullptr), parentGame(parent), playerId(_playerId) { loadLocalButton = new QPushButton; loadRemoteButton = new QPushButton; @@ -112,7 +112,7 @@ DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent) connect(sideboardLockButton, SIGNAL(clicked()), this, SLOT(sideboardLockButtonClicked())); connect(sideboardLockButton, SIGNAL(stateChanged()), this, SLOT(updateSideboardLockButtonText())); - QHBoxLayout *buttonHBox = new QHBoxLayout; + auto *buttonHBox = new QHBoxLayout; buttonHBox->addWidget(loadLocalButton); buttonHBox->addWidget(loadRemoteButton); buttonHBox->addWidget(readyStartButton); @@ -123,7 +123,7 @@ DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent) connect(deckView, SIGNAL(newCardAdded(AbstractCardItem *)), this, SIGNAL(newCardAdded(AbstractCardItem *))); connect(deckView, SIGNAL(sideboardPlanChanged()), this, SLOT(sideboardPlanChanged())); - QVBoxLayout *deckViewLayout = new QVBoxLayout; + auto *deckViewLayout = new QVBoxLayout; deckViewLayout->addLayout(buttonHBox); deckViewLayout->addWidget(deckView); deckViewLayout->setContentsMargins(0, 0, 0, 0); @@ -209,6 +209,9 @@ void TabGame::refreshShortcuts() if (aNextPhase) { aNextPhase->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aNextPhase")); } + if (aNextPhaseAction) { + aNextPhaseAction->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aNextPhaseAction")); + } if (aNextTurn) { aNextTurn->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aNextTurn")); } @@ -299,8 +302,8 @@ void DeckViewContainer::sideboardPlanChanged() { Command_SetSideboardPlan cmd; const QList &newPlan = deckView->getSideboardPlan(); - for (int i = 0; i < newPlan.size(); ++i) - cmd.add_move_list()->CopyFrom(newPlan.at(i)); + for (const auto &i : newPlan) + cmd.add_move_list()->CopyFrom(i); parentGame->sendGameCommand(cmd, playerId); } @@ -330,7 +333,8 @@ void DeckViewContainer::setDeck(const DeckLoader &deck) TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay) : Tab(_tabSupervisor), secondsElapsed(0), hostId(-1), localPlayerId(-1), isLocalGame(_tabSupervisor->getIsLocalGame()), spectator(true), gameStateKnown(false), resuming(false), - currentPhase(-1), activeCard(0), gameClosed(false), replay(_replay), currentReplayStep(0), sayLabel(0), sayEdit(0) + currentPhase(-1), activeCard(nullptr), gameClosed(false), replay(_replay), currentReplayStep(0), + sayLabel(nullptr), sayEdit(nullptr) { // THIS CTOR IS USED ON REPLAY gameInfo.CopyFrom(replay->game_info()); @@ -389,8 +393,8 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, const QMap &_roomGameTypes) : Tab(_tabSupervisor), clients(_clients), gameInfo(event.game_info()), roomGameTypes(_roomGameTypes), hostId(event.host_id()), localPlayerId(event.player_id()), isLocalGame(_tabSupervisor->getIsLocalGame()), - spectator(event.spectator()), gameStateKnown(false), resuming(event.resuming()), currentPhase(-1), activeCard(0), - gameClosed(false), replay(0), replayDock(0) + spectator(event.spectator()), gameStateKnown(false), resuming(event.resuming()), currentPhase(-1), + activeCard(nullptr), gameClosed(false), replay(nullptr), replayDock(nullptr) { // THIS CTOR IS USED ON GAMES gameInfo.set_started(false); @@ -486,6 +490,9 @@ void TabGame::retranslateUi() if (aNextPhase) { aNextPhase->setText(tr("Next &phase")); } + if (aNextPhaseAction) { + aNextPhaseAction->setText(tr("Next phase with &action")); + } if (aNextTurn) { aNextTurn->setText(tr("Next &turn")); } @@ -554,7 +561,7 @@ void TabGame::closeRequest() void TabGame::replayNextEvent() { - processGameEventContainer(replay->event_list(timelineWidget->getCurrentEvent()), 0); + processGameEventContainer(replay->event_list(timelineWidget->getCurrentEvent()), nullptr); } void TabGame::replayFinished() @@ -671,7 +678,7 @@ void TabGame::actPhaseAction() { int phase = phaseActions.indexOf(static_cast(sender())); Command_SetActivePhase cmd; - cmd.set_phase(phase); + cmd.set_phase(static_cast(phase)); sendGameCommand(cmd); } @@ -681,10 +688,29 @@ void TabGame::actNextPhase() if (++phase >= phasesToolbar->phaseCount()) phase = 0; Command_SetActivePhase cmd; - cmd.set_phase(phase); + cmd.set_phase(static_cast(phase)); sendGameCommand(cmd); } +void TabGame::actNextPhaseAction() +{ + int phase = currentPhase + 1; + if (phase >= phasesToolbar->phaseCount()) { + phase = 0; + } + + if (phase == 0) { + Command_NextTurn cmd; + sendGameCommand(cmd); + } else { + Command_SetActivePhase cmd; + cmd.set_phase(static_cast(phase)); + sendGameCommand(cmd); + } + + phasesToolbar->triggerPhaseAction(phase); +} + void TabGame::actNextTurn() { sendGameCommand(Command_NextTurn()); @@ -725,7 +751,7 @@ void TabGame::actCompleterChanged() Player *TabGame::addPlayer(int playerId, const ServerInfo_User &info) { bool local = ((clients.size() > 1) || (playerId == localPlayerId)); - Player *newPlayer = new Player(info, playerId, local, this); + auto *newPlayer = new Player(info, playerId, local, this); connect(newPlayer, SIGNAL(openDeckEditor(const DeckLoader *)), this, SIGNAL(openDeckEditor(const DeckLoader *))); QString newPlayerName = "@" + newPlayer->getName(); if (sayEdit && !autocompleteUserList.contains(newPlayerName)) { @@ -741,7 +767,7 @@ Player *TabGame::addPlayer(int playerId, const ServerInfo_User &info) if (clients.size() == 1) newPlayer->setShortcutsActive(); - DeckViewContainer *deckView = new DeckViewContainer(playerId, this); + auto *deckView = new DeckViewContainer(playerId, this); connect(deckView, SIGNAL(newCardAdded(AbstractCardItem *)), this, SLOT(newCardAdded(AbstractCardItem *))); deckViewContainers.insert(playerId, deckView); deckViewContainerLayout->addWidget(deckView); @@ -762,7 +788,7 @@ void TabGame::processGameEventContainer(const GameEventContainer &cont, Abstract for (int i = 0; i < eventListSize; ++i) { const GameEvent &event = cont.event_list(i); const int playerId = event.player_id(); - const GameEvent::GameEventType eventType = static_cast(getPbExtension(event)); + const auto eventType = static_cast(getPbExtension(event)); if (spectators.contains(playerId)) { switch (eventType) { case GameEvent::GAME_SAY: @@ -834,7 +860,7 @@ AbstractClient *TabGame::getClientForPlayer(int playerId) const return clients.at(playerId); } else if (clients.isEmpty()) - return 0; + return nullptr; else return clients.first(); } @@ -871,7 +897,7 @@ void TabGame::commandFinished(const Response &response) PendingCommand *TabGame::prepareGameCommand(const ::google::protobuf::Message &cmd) { CommandContainer cont; - cont.set_game_id(gameInfo.game_id()); + cont.set_game_id(static_cast(gameInfo.game_id())); GameCommand *c = cont.add_game_command(); c->GetReflection()->MutableMessage(c, cmd.GetDescriptor()->FindExtensionByName("ext"))->CopyFrom(cmd); return new PendingCommand(cont); @@ -880,13 +906,11 @@ PendingCommand *TabGame::prepareGameCommand(const ::google::protobuf::Message &c PendingCommand *TabGame::prepareGameCommand(const QList &cmdList) { CommandContainer cont; - cont.set_game_id(gameInfo.game_id()); - for (int i = 0; i < cmdList.size(); ++i) { + cont.set_game_id(static_cast(gameInfo.game_id())); + for (auto i : cmdList) { GameCommand *c = cont.add_game_command(); - c->GetReflection() - ->MutableMessage(c, cmdList[i]->GetDescriptor()->FindExtensionByName("ext")) - ->CopyFrom(*cmdList[i]); - delete cmdList[i]; + c->GetReflection()->MutableMessage(c, i->GetDescriptor()->FindExtensionByName("ext"))->CopyFrom(*i); + delete i; } return new PendingCommand(cont); } @@ -1040,8 +1064,7 @@ void TabGame::eventPlayerPropertiesChanged(const Event_PlayerPropertiesChanged & const ServerInfo_PlayerProperties &prop = event.player_properties(); playerListWidget->updatePlayerProperties(prop, eventPlayerId); - const GameEventContext::ContextType contextType = - static_cast(getPbExtension(context)); + const auto contextType = static_cast(getPbExtension(context)); switch (contextType) { case GameEventContext::READY_START: { bool ready = prop.ready_start(); @@ -1195,7 +1218,7 @@ Player *TabGame::setActivePlayer(int id) { Player *player = players.value(id, 0); if (!player) - return 0; + return nullptr; activePlayer = id; playerListWidget->setActivePlayer(id); QMapIterator i(players); @@ -1259,11 +1282,11 @@ CardItem *TabGame::getCard(int playerId, const QString &zoneName, int cardId) co { Player *player = players.value(playerId, 0); if (!player) - return 0; + return nullptr; CardZone *zone = player->getZones().value(zoneName, 0); if (!zone) - return 0; + return nullptr; return zone->getCard(cardId, QString()); } @@ -1271,7 +1294,7 @@ CardItem *TabGame::getCard(int playerId, const QString &zoneName, int cardId) co QString TabGame::getTabText() const { QString gameTypeInfo; - if (gameTypes.size() != 0) { + if (!gameTypes.empty()) { gameTypeInfo = gameTypes.at(0); if (gameTypes.size() > 1) gameTypeInfo.append("..."); @@ -1312,7 +1335,7 @@ Player *TabGame::getActiveLocalPlayer() const return temp; } - return 0; + return nullptr; } void TabGame::updateCardMenu(AbstractCardItem *card) @@ -1329,6 +1352,8 @@ void TabGame::createMenuItems() { aNextPhase = new QAction(this); connect(aNextPhase, SIGNAL(triggered()), this, SLOT(actNextPhase())); + aNextPhaseAction = new QAction(this); + connect(aNextPhaseAction, SIGNAL(triggered()), this, SLOT(actNextPhaseAction())); aNextTurn = new QAction(this); connect(aNextTurn, SIGNAL(triggered()), this, SLOT(actNextTurn())); aRemoveLocalArrows = new QAction(this); @@ -1343,7 +1368,7 @@ void TabGame::createMenuItems() connect(aConcede, SIGNAL(triggered()), this, SLOT(actConcede())); aLeaveGame = new QAction(this); connect(aLeaveGame, SIGNAL(triggered()), this, SLOT(actLeaveGame())); - aCloseReplay = 0; + aCloseReplay = nullptr; phasesMenu = new QMenu(this); for (int i = 0; i < phasesToolbar->phaseCount(); ++i) { @@ -1355,6 +1380,7 @@ void TabGame::createMenuItems() phasesMenu->addSeparator(); phasesMenu->addAction(aNextPhase); + phasesMenu->addAction(aNextPhaseAction); gameMenu = new QMenu(this); playersSeparator = gameMenu->addSeparator(); @@ -1373,19 +1399,20 @@ void TabGame::createMenuItems() void TabGame::createReplayMenuItems() { - aNextPhase = 0; - aNextTurn = 0; - aRemoveLocalArrows = 0; - aRotateViewCW = 0; - aRotateViewCCW = 0; - aResetLayout = 0; - aGameInfo = 0; - aConcede = 0; - aLeaveGame = 0; + aNextPhase = nullptr; + aNextPhaseAction = nullptr; + aNextTurn = nullptr; + aRemoveLocalArrows = nullptr; + aRotateViewCW = nullptr; + aRotateViewCCW = nullptr; + aResetLayout = nullptr; + aGameInfo = nullptr; + aConcede = nullptr; + aLeaveGame = nullptr; aCloseReplay = new QAction(this); connect(aCloseReplay, SIGNAL(triggered()), this, SLOT(actLeaveGame())); - phasesMenu = 0; + phasesMenu = nullptr; gameMenu = new QMenu(this); gameMenu->addAction(aCloseReplay); addTabMenu(gameMenu); @@ -1659,7 +1686,7 @@ void TabGame::createCardInfoDock(bool bReplay) void TabGame::createPlayerListDock(bool bReplay) { if (bReplay) { - playerListWidget = new PlayerListWidget(0, 0, this); + playerListWidget = new PlayerListWidget(nullptr, nullptr, this); } else { playerListWidget = new PlayerListWidget(tabSupervisor, clients.first(), this); connect(playerListWidget, SIGNAL(openMessageDialog(QString, bool)), this, diff --git a/cockatrice/src/tab_game.h b/cockatrice/src/tab_game.h index 72d3331d..41f56ddc 100644 --- a/cockatrice/src/tab_game.h +++ b/cockatrice/src/tab_game.h @@ -163,8 +163,8 @@ private: QAction *playersSeparator; QMenu *gameMenu, *phasesMenu, *viewMenu, *cardInfoDockMenu, *messageLayoutDockMenu, *playerListDockMenu, *replayDockMenu; - QAction *aGameInfo, *aConcede, *aLeaveGame, *aCloseReplay, *aNextPhase, *aNextTurn, *aRemoveLocalArrows, - *aRotateViewCW, *aRotateViewCCW, *aResetLayout, *aResetReplayLayout; + QAction *aGameInfo, *aConcede, *aLeaveGame, *aCloseReplay, *aNextPhase, *aNextPhaseAction, *aNextTurn, + *aRemoveLocalArrows, *aRotateViewCW, *aRotateViewCCW, *aResetLayout, *aResetReplayLayout; QAction *aCardInfoDockVisible, *aCardInfoDockFloating, *aMessageLayoutDockVisible, *aMessageLayoutDockFloating, *aPlayerListDockVisible, *aPlayerListDockFloating, *aReplayDockVisible, *aReplayDockFloating; QList phaseActions; @@ -233,6 +233,7 @@ private slots: void actSay(); void actPhaseAction(); void actNextPhase(); + void actNextPhaseAction(); void actNextTurn(); void addMentionTag(QString value); @@ -246,7 +247,7 @@ private slots: void actResetLayout(); void freeDocksSize(); - bool eventFilter(QObject *o, QEvent *e); + bool eventFilter(QObject *o, QEvent *e) override; void dockVisibleTriggered(); void dockFloatingTriggered(); void dockTopLevelChanged(bool topLevel); @@ -257,10 +258,10 @@ public: const Event_GameJoined &event, const QMap &_roomGameTypes); TabGame(TabSupervisor *_tabSupervisor, GameReplay *replay); - ~TabGame(); - void retranslateUi(); + ~TabGame() override; + void retranslateUi() override; void updatePlayerListDockTitle(); - void closeRequest(); + void closeRequest() override; const QMap &getPlayers() const { return players; @@ -278,7 +279,7 @@ public: { return gameInfo.game_id(); } - QString getTabText() const; + QString getTabText() const override; bool getSpectator() const { return spectator;