diff --git a/cockatrice/src/game/deckview/deck_view.cpp b/cockatrice/src/game/deckview/deck_view.cpp index 6c5e51fc4..48c906100 100644 --- a/cockatrice/src/game/deckview/deck_view.cpp +++ b/cockatrice/src/game/deckview/deck_view.cpp @@ -41,8 +41,8 @@ void DeckViewCardDragItem::updatePosition(const QPointF &cursorScenePos) void DeckViewCardDragItem::handleDrop(DeckViewCardContainer *target) { - DeckViewCard *card = static_cast(item); - DeckViewCardContainer *start = static_cast(item->parentItem()); + auto *card = static_cast(item); + auto *start = static_cast(item->parentItem()); start->removeCard(card); target->addCard(card); card->setParentItem(target); @@ -51,13 +51,13 @@ void DeckViewCardDragItem::handleDrop(DeckViewCardContainer *target) void DeckViewCardDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { setCursor(Qt::OpenHandCursor); - DeckViewScene *sc = static_cast(scene()); + auto *sc = static_cast(scene()); sc->removeItem(this); if (currentZone) { handleDrop(currentZone); for (int i = 0; i < childDrags.size(); i++) { - DeckViewCardDragItem *c = static_cast(childDrags[i]); + auto *c = static_cast(childDrags[i]); c->handleDrop(currentZone); sc->removeItem(c); } @@ -118,12 +118,12 @@ void DeckViewCard::mouseMoveEvent(QGraphicsSceneMouseEvent *event) QList sel = scene()->selectedItems(); int j = 0; for (int i = 0; i < sel.size(); i++) { - DeckViewCard *c = static_cast(sel.at(i)); + auto *c = static_cast(sel.at(i)); if (c == this) continue; ++j; - QPointF childPos = QPointF(j * CARD_WIDTH / 2, 0); - DeckViewCardDragItem *drag = new DeckViewCardDragItem(c, childPos, dragItem); + auto childPos = QPointF(j * CARD_WIDTH / 2, 0); + auto *drag = new DeckViewCardDragItem(c, childPos, dragItem); drag->setPos(dragItem->pos() + childPos); scene()->addItem(drag); } @@ -140,8 +140,8 @@ void DeckView::mouseDoubleClickEvent(QMouseEvent *event) QList sel = scene()->selectedItems(); for (int i = 0; i < sel.size(); i++) { - DeckViewCard *c = static_cast(sel.at(i)); - DeckViewCardContainer *zone = static_cast(c->parentItem()); + auto *c = static_cast(sel.at(i)); + auto *zone = static_cast(c->parentItem()); MoveCard_ToZone m; m.set_card_name(c->getName().toStdString()); m.set_start_zone(zone->getName().toStdString()); @@ -345,7 +345,7 @@ void DeckViewScene::rebuildTree() InnerDecklistNode *listRoot = deck->getRoot(); for (int i = 0; i < listRoot->size(); i++) { - InnerDecklistNode *currentZone = dynamic_cast(listRoot->at(i)); + auto *currentZone = dynamic_cast(listRoot->at(i)); DeckViewCardContainer *container = cardContainers.value(currentZone->getName(), 0); if (!container) { @@ -355,12 +355,12 @@ void DeckViewScene::rebuildTree() } for (int j = 0; j < currentZone->size(); j++) { - DecklistCardNode *currentCard = dynamic_cast(currentZone->at(j)); + auto *currentCard = dynamic_cast(currentZone->at(j)); if (!currentCard) continue; for (int k = 0; k < currentCard->getNumber(); ++k) { - DeckViewCard *newCard = new DeckViewCard(container, currentCard->toCardRef(), currentZone->getName()); + auto *newCard = new DeckViewCard(container, currentCard->toCardRef(), currentZone->getName()); container->addCard(newCard); emit newCardAdded(newCard); } diff --git a/cockatrice/src/game/dialogs/dlg_create_token.cpp b/cockatrice/src/game/dialogs/dlg_create_token.cpp index 7cafc3219..6594e339d 100644 --- a/cockatrice/src/game/dialogs/dlg_create_token.cpp +++ b/cockatrice/src/game/dialogs/dlg_create_token.cpp @@ -67,7 +67,7 @@ DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *pa faceDownCheckBox = new QCheckBox(tr("Create face-down (Only hides name)")); connect(faceDownCheckBox, &QCheckBox::toggled, this, &DlgCreateToken::faceDownCheckBoxToggled); - QGridLayout *grid = new QGridLayout; + auto *grid = new QGridLayout; grid->addWidget(nameLabel, 0, 0); grid->addWidget(nameEdit, 0, 1); grid->addWidget(colorLabel, 1, 0); @@ -79,7 +79,7 @@ DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *pa grid->addWidget(destroyCheckBox, 4, 0, 1, 2); grid->addWidget(faceDownCheckBox, 5, 0, 1, 2); - QGroupBox *tokenDataGroupBox = new QGroupBox(tr("Token data")); + auto *tokenDataGroupBox = new QGroupBox(tr("Token data")); tokenDataGroupBox->setLayout(grid); cardDatabaseModel = new CardDatabaseModel(CardDatabaseManager::getInstance(), false, this); @@ -125,25 +125,25 @@ DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *pa #endif } - QVBoxLayout *tokenChooseLayout = new QVBoxLayout; + auto *tokenChooseLayout = new QVBoxLayout; tokenChooseLayout->addWidget(chooseTokenFromAllRadioButton); tokenChooseLayout->addWidget(chooseTokenFromDeckRadioButton); tokenChooseLayout->addWidget(chooseTokenView); - QGroupBox *tokenChooseGroupBox = new QGroupBox(tr("Choose token from list")); + auto *tokenChooseGroupBox = new QGroupBox(tr("Choose token from list")); tokenChooseGroupBox->setLayout(tokenChooseLayout); - QGridLayout *hbox = new QGridLayout; + auto *hbox = new QGridLayout; hbox->addWidget(pic, 0, 0, 1, 1); hbox->addWidget(tokenDataGroupBox, 1, 0, 1, 1); hbox->addWidget(tokenChooseGroupBox, 0, 1, 2, 1); hbox->setColumnStretch(1, 1); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + auto *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, &QDialogButtonBox::accepted, this, &DlgCreateToken::actOk); connect(buttonBox, &QDialogButtonBox::rejected, this, &DlgCreateToken::actReject); - QVBoxLayout *mainLayout = new QVBoxLayout; + auto *mainLayout = new QVBoxLayout; mainLayout->addLayout(hbox); mainLayout->addWidget(buttonBox); setLayout(mainLayout); diff --git a/cockatrice/src/game/player/player.cpp b/cockatrice/src/game/player/player.cpp index a18e464d6..300300de3 100644 --- a/cockatrice/src/game/player/player.cpp +++ b/cockatrice/src/game/player/player.cpp @@ -194,7 +194,7 @@ void Player::processPlayerInfo(const ServerInfo_Player &info) } else { for (int j = 0; j < cardListSize; ++j) { const ServerInfo_Card &cardInfo = zoneInfo.card_list(j); - CardItem *card = new CardItem(this); + auto *card = new CardItem(this); card->processCardInfo(cardInfo); zone->addCard(card, false, cardInfo.x(), cardInfo.y()); } diff --git a/cockatrice/src/game/player/player_graphics_item.cpp b/cockatrice/src/game/player/player_graphics_item.cpp index e609591b3..27fbc82c8 100644 --- a/cockatrice/src/game/player/player_graphics_item.cpp +++ b/cockatrice/src/game/player/player_graphics_item.cpp @@ -50,8 +50,8 @@ void PlayerGraphicsItem::onPlayerActiveChanged(bool _active) void PlayerGraphicsItem::initializeZones() { deckZoneGraphicsItem = new PileZone(player->getDeckZone(), this); - QPointF base = QPointF(counterAreaWidth + (CARD_HEIGHT - CARD_WIDTH + 15) / 2.0, - 10 + playerTarget->boundingRect().height() + 5 - (CARD_HEIGHT - CARD_WIDTH) / 2.0); + auto base = QPointF(counterAreaWidth + (CARD_HEIGHT - CARD_WIDTH + 15) / 2.0, + 10 + playerTarget->boundingRect().height() + 5 - (CARD_HEIGHT - CARD_WIDTH) / 2.0); deckZoneGraphicsItem->setPos(base); qreal h = deckZoneGraphicsItem->boundingRect().width() + 5; @@ -147,7 +147,7 @@ void PlayerGraphicsItem::rearrangeCounters() void PlayerGraphicsItem::rearrangeZones() { - QPointF base = QPointF(CARD_HEIGHT + counterAreaWidth + 15, 0); + auto base = QPointF(CARD_HEIGHT + counterAreaWidth + 15, 0); if (SettingsCache::instance().getHorizontalHand()) { if (mirrored) { if (player->getHandZone()->contentsKnown()) { diff --git a/cockatrice/src/game/player/player_list_widget.cpp b/cockatrice/src/game/player/player_list_widget.cpp index 3281d8541..7cf7c34a6 100644 --- a/cockatrice/src/game/player/player_list_widget.cpp +++ b/cockatrice/src/game/player/player_list_widget.cpp @@ -27,7 +27,7 @@ bool PlayerListItemDelegate::editorEvent(QEvent *event, const QModelIndex &index) { if ((event->type() == QEvent::MouseButtonPress) && index.isValid()) { - QMouseEvent *const mouseEvent = static_cast(event); + auto *const mouseEvent = static_cast(event); if (mouseEvent->button() == Qt::RightButton) { #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) static_cast(parent())->showContextMenu(mouseEvent->globalPosition().toPoint(), index); diff --git a/cockatrice/src/interface/widgets/dialogs/dlg_create_game.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_create_game.cpp index d69c7a08a..2b1b63065 100644 --- a/cockatrice/src/interface/widgets/dialogs/dlg_create_game.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_create_game.cpp @@ -35,7 +35,7 @@ void DlgCreateGame::sharedCtor() maxPlayersEdit->setValue(2); maxPlayersLabel->setBuddy(maxPlayersEdit); - QGridLayout *generalGrid = new QGridLayout; + auto *generalGrid = new QGridLayout; generalGrid->addWidget(descriptionLabel, 0, 0); generalGrid->addWidget(descriptionEdit, 0, 1); generalGrid->addWidget(maxPlayersLabel, 1, 0); @@ -43,17 +43,17 @@ void DlgCreateGame::sharedCtor() generalGroupBox = new QGroupBox(tr("General")); generalGroupBox->setLayout(generalGrid); - QVBoxLayout *gameTypeLayout = new QVBoxLayout; + auto *gameTypeLayout = new QVBoxLayout; QMapIterator gameTypeIterator(gameTypes); while (gameTypeIterator.hasNext()) { gameTypeIterator.next(); - QRadioButton *gameTypeRadioButton = new QRadioButton(gameTypeIterator.value(), this); + auto *gameTypeRadioButton = new QRadioButton(gameTypeIterator.value(), this); gameTypeLayout->addWidget(gameTypeRadioButton); gameTypeCheckBoxes.insert(gameTypeIterator.key(), gameTypeRadioButton); bool isChecked = SettingsCache::instance().getGameTypes().contains(gameTypeIterator.value() + ", "); gameTypeCheckBoxes[gameTypeIterator.key()]->setChecked(isChecked); } - QGroupBox *gameTypeGroupBox = new QGroupBox(tr("Game type")); + auto *gameTypeGroupBox = new QGroupBox(tr("Game type")); gameTypeGroupBox->setLayout(gameTypeLayout); passwordLabel = new QLabel(tr("&Password:")); @@ -70,13 +70,13 @@ void DlgCreateGame::sharedCtor() onlyRegisteredCheckBox->setEnabled(false); } - QGridLayout *joinRestrictionsLayout = new QGridLayout; + auto *joinRestrictionsLayout = new QGridLayout; joinRestrictionsLayout->addWidget(passwordLabel, 0, 0); joinRestrictionsLayout->addWidget(passwordEdit, 0, 1); joinRestrictionsLayout->addWidget(onlyBuddiesCheckBox, 1, 0, 1, 2); joinRestrictionsLayout->addWidget(onlyRegisteredCheckBox, 2, 0, 1, 2); - QGroupBox *joinRestrictionsGroupBox = new QGroupBox(tr("Joining restrictions")); + auto *joinRestrictionsGroupBox = new QGroupBox(tr("Joining restrictions")); joinRestrictionsGroupBox->setLayout(joinRestrictionsLayout); spectatorsAllowedCheckBox = new QCheckBox(tr("&Spectators can watch")); @@ -86,7 +86,7 @@ void DlgCreateGame::sharedCtor() spectatorsCanTalkCheckBox = new QCheckBox(tr("Spectators can &chat")); spectatorsSeeEverythingCheckBox = new QCheckBox(tr("Spectators can see &hands")); createGameAsSpectatorCheckBox = new QCheckBox(tr("Create game as spectator")); - QVBoxLayout *spectatorsLayout = new QVBoxLayout; + auto *spectatorsLayout = new QVBoxLayout; spectatorsLayout->addWidget(spectatorsAllowedCheckBox); spectatorsLayout->addWidget(spectatorsNeedPasswordCheckBox); spectatorsLayout->addWidget(spectatorsCanTalkCheckBox); @@ -106,7 +106,7 @@ void DlgCreateGame::sharedCtor() shareDecklistsOnLoadCheckBox = new QCheckBox(); shareDecklistsOnLoadLabel->setBuddy(shareDecklistsOnLoadCheckBox); - QGridLayout *gameSetupOptionsLayout = new QGridLayout; + auto *gameSetupOptionsLayout = new QGridLayout; gameSetupOptionsLayout->addWidget(startingLifeTotalLabel, 0, 0); gameSetupOptionsLayout->addWidget(startingLifeTotalEdit, 0, 1); gameSetupOptionsLayout->addWidget(shareDecklistsOnLoadLabel, 1, 0); @@ -136,7 +136,7 @@ void DlgCreateGame::sharedCtor() buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok); connect(buttonBox, &QDialogButtonBox::rejected, this, &DlgCreateGame::reject); - QVBoxLayout *mainLayout = new QVBoxLayout; + auto *mainLayout = new QVBoxLayout; mainLayout->addLayout(grid); mainLayout->addWidget(buttonBox); @@ -275,7 +275,7 @@ void DlgCreateGame::actOK() cmd.set_starting_life_total(startingLifeTotalEdit->value()); cmd.set_share_decklists_on_load(shareDecklistsOnLoadCheckBox->isChecked()); - QString _gameTypes = QString(); + auto _gameTypes = QString(); QMapIterator gameTypeCheckBoxIterator(gameTypeCheckBoxes); while (gameTypeCheckBoxIterator.hasNext()) { gameTypeCheckBoxIterator.next(); diff --git a/cockatrice/src/interface/widgets/dialogs/dlg_edit_avatar.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_edit_avatar.cpp index 28be359a3..7330c749b 100644 --- a/cockatrice/src/interface/widgets/dialogs/dlg_edit_avatar.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_edit_avatar.cpp @@ -23,16 +23,16 @@ DlgEditAvatar::DlgEditAvatar(QWidget *parent) : QDialog(parent), image() browseButton = new QPushButton(tr("Browse...")); connect(browseButton, &QPushButton::clicked, this, &DlgEditAvatar::actBrowse); - QGridLayout *grid = new QGridLayout; + auto *grid = new QGridLayout; grid->addWidget(imageLabel, 0, 0, 1, 2); grid->addWidget(textLabel, 1, 0); grid->addWidget(browseButton, 1, 1); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + auto *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, &QDialogButtonBox::accepted, this, &DlgEditAvatar::actOk); connect(buttonBox, &QDialogButtonBox::rejected, this, &DlgEditAvatar::reject); - QVBoxLayout *mainLayout = new QVBoxLayout; + auto *mainLayout = new QVBoxLayout; mainLayout->addLayout(grid); mainLayout->addWidget(buttonBox); setLayout(mainLayout); diff --git a/cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_challenge.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_challenge.cpp index c8c86d1f1..7ad957e6c 100644 --- a/cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_challenge.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_challenge.cpp @@ -66,7 +66,7 @@ DlgForgotPasswordChallenge::DlgForgotPasswordChallenge(QWidget *parent) : QDialo playernameEdit->hide(); } - QGridLayout *grid = new QGridLayout; + auto *grid = new QGridLayout; grid->addWidget(infoLabel, 0, 0, 1, 2); grid->addWidget(hostLabel, 1, 0); grid->addWidget(hostEdit, 1, 1); @@ -77,11 +77,11 @@ DlgForgotPasswordChallenge::DlgForgotPasswordChallenge(QWidget *parent) : QDialo grid->addWidget(emailLabel, 4, 0); grid->addWidget(emailEdit, 4, 1); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + auto *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, &QDialogButtonBox::accepted, this, &DlgForgotPasswordChallenge::actOk); connect(buttonBox, &QDialogButtonBox::rejected, this, &DlgForgotPasswordChallenge::reject); - QVBoxLayout *mainLayout = new QVBoxLayout; + auto *mainLayout = new QVBoxLayout; mainLayout->addLayout(grid); mainLayout->addWidget(buttonBox); setLayout(mainLayout); diff --git a/cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_request.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_request.cpp index 4921630f3..8f79b543f 100644 --- a/cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_request.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_forgot_password_request.cpp @@ -45,7 +45,7 @@ DlgForgotPasswordRequest::DlgForgotPasswordRequest(QWidget *parent) : QDialog(pa playernameEdit->setMaxLength(MAX_NAME_LENGTH); playernameLabel->setBuddy(playernameEdit); - QGridLayout *grid = new QGridLayout; + auto *grid = new QGridLayout; grid->addWidget(infoLabel, 0, 0, 1, 2); grid->addWidget(hostLabel, 1, 0); grid->addWidget(hostEdit, 1, 1); @@ -54,11 +54,11 @@ DlgForgotPasswordRequest::DlgForgotPasswordRequest(QWidget *parent) : QDialog(pa grid->addWidget(playernameLabel, 3, 0); grid->addWidget(playernameEdit, 3, 1); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + auto *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, &QDialogButtonBox::accepted, this, &DlgForgotPasswordRequest::actOk); connect(buttonBox, &QDialogButtonBox::rejected, this, &DlgForgotPasswordRequest::reject); - QVBoxLayout *mainLayout = new QVBoxLayout; + auto *mainLayout = new QVBoxLayout; mainLayout->addLayout(grid); mainLayout->addWidget(buttonBox); setLayout(mainLayout); diff --git a/cockatrice/src/interface/widgets/dialogs/dlg_load_deck_from_clipboard.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_load_deck_from_clipboard.cpp index 59170c0fc..b1f4d066f 100644 --- a/cockatrice/src/interface/widgets/dialogs/dlg_load_deck_from_clipboard.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_load_deck_from_clipboard.cpp @@ -24,7 +24,7 @@ AbstractDlgDeckTextEdit::AbstractDlgDeckTextEdit(QWidget *parent) : QDialog(pare refreshButton = new QPushButton(tr("&Refresh")); connect(refreshButton, &QPushButton::clicked, this, &AbstractDlgDeckTextEdit::actRefresh); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + auto *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); buttonBox->addButton(refreshButton, QDialogButtonBox::ActionRole); connect(buttonBox, &QDialogButtonBox::accepted, this, &AbstractDlgDeckTextEdit::actOK); connect(buttonBox, &QDialogButtonBox::rejected, this, &AbstractDlgDeckTextEdit::reject); diff --git a/cockatrice/src/interface/widgets/dialogs/dlg_load_remote_deck.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_load_remote_deck.cpp index 9abe1949a..214ccc588 100644 --- a/cockatrice/src/interface/widgets/dialogs/dlg_load_remote_deck.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_load_remote_deck.cpp @@ -18,7 +18,7 @@ DlgLoadRemoteDeck::DlgLoadRemoteDeck(AbstractClient *_client, QWidget *parent) : connect(buttonBox, &QDialogButtonBox::accepted, this, &DlgLoadRemoteDeck::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &DlgLoadRemoteDeck::reject); - QVBoxLayout *mainLayout = new QVBoxLayout; + auto *mainLayout = new QVBoxLayout; mainLayout->addWidget(dirView); mainLayout->addWidget(buttonBox); diff --git a/cockatrice/src/interface/widgets/dialogs/dlg_register.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_register.cpp index dff99e4d8..3493c1047 100644 --- a/cockatrice/src/interface/widgets/dialogs/dlg_register.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_register.cpp @@ -321,7 +321,7 @@ DlgRegister::DlgRegister(QWidget *parent) : QDialog(parent) realnameEdit->setMaxLength(MAX_NAME_LENGTH); realnameLabel->setBuddy(realnameEdit); - QGridLayout *grid = new QGridLayout; + auto *grid = new QGridLayout; grid->addWidget(infoLabel, 0, 0, 1, 2); grid->addWidget(hostLabel, 1, 0); grid->addWidget(hostEdit, 1, 1); @@ -342,11 +342,11 @@ DlgRegister::DlgRegister(QWidget *parent) : QDialog(parent) grid->addWidget(realnameLabel, 10, 0); grid->addWidget(realnameEdit, 10, 1); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + auto *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, &QDialogButtonBox::accepted, this, &DlgRegister::actOk); connect(buttonBox, &QDialogButtonBox::rejected, this, &DlgRegister::reject); - QVBoxLayout *mainLayout = new QVBoxLayout; + auto *mainLayout = new QVBoxLayout; mainLayout->addLayout(grid); mainLayout->addWidget(buttonBox); setLayout(mainLayout); diff --git a/cockatrice/src/interface/widgets/dialogs/dlg_settings.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_settings.cpp index d825a2125..73508d843 100644 --- a/cockatrice/src/interface/widgets/dialogs/dlg_settings.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_settings.cpp @@ -141,38 +141,38 @@ GeneralSettingsPage::GeneralSettingsPage() deckPathEdit = new QLineEdit(settings.getDeckPath()); deckPathEdit->setReadOnly(true); - QPushButton *deckPathButton = new QPushButton("..."); + auto *deckPathButton = new QPushButton("..."); connect(deckPathButton, &QPushButton::clicked, this, &GeneralSettingsPage::deckPathButtonClicked); filtersPathEdit = new QLineEdit(settings.getFiltersPath()); filtersPathEdit->setReadOnly(true); - QPushButton *filtersPathButton = new QPushButton("..."); + auto *filtersPathButton = new QPushButton("..."); connect(filtersPathButton, &QPushButton::clicked, this, &GeneralSettingsPage::filtersPathButtonClicked); replaysPathEdit = new QLineEdit(settings.getReplaysPath()); replaysPathEdit->setReadOnly(true); - QPushButton *replaysPathButton = new QPushButton("..."); + auto *replaysPathButton = new QPushButton("..."); connect(replaysPathButton, &QPushButton::clicked, this, &GeneralSettingsPage::replaysPathButtonClicked); picsPathEdit = new QLineEdit(settings.getPicsPath()); picsPathEdit->setReadOnly(true); - QPushButton *picsPathButton = new QPushButton("..."); + auto *picsPathButton = new QPushButton("..."); connect(picsPathButton, &QPushButton::clicked, this, &GeneralSettingsPage::picsPathButtonClicked); cardDatabasePathEdit = new QLineEdit(settings.getCardDatabasePath()); cardDatabasePathEdit->setReadOnly(true); - QPushButton *cardDatabasePathButton = new QPushButton("..."); + auto *cardDatabasePathButton = new QPushButton("..."); connect(cardDatabasePathButton, &QPushButton::clicked, this, &GeneralSettingsPage::cardDatabasePathButtonClicked); customCardDatabasePathEdit = new QLineEdit(settings.getCustomCardDatabasePath()); customCardDatabasePathEdit->setReadOnly(true); - QPushButton *customCardDatabasePathButton = new QPushButton("..."); + auto *customCardDatabasePathButton = new QPushButton("..."); connect(customCardDatabasePathButton, &QPushButton::clicked, this, &GeneralSettingsPage::customCardDatabaseButtonClicked); tokenDatabasePathEdit = new QLineEdit(settings.getTokenDatabasePath()); tokenDatabasePathEdit->setReadOnly(true); - QPushButton *tokenDatabasePathButton = new QPushButton("..."); + auto *tokenDatabasePathButton = new QPushButton("..."); connect(tokenDatabasePathButton, &QPushButton::clicked, this, &GeneralSettingsPage::tokenDatabasePathButtonClicked); // Required init here to avoid crashing on Portable builds diff --git a/cockatrice/src/interface/widgets/printing_selector/printing_selector.cpp b/cockatrice/src/interface/widgets/printing_selector/printing_selector.cpp index 1a47c56a6..a551ac290 100644 --- a/cockatrice/src/interface/widgets/printing_selector/printing_selector.cpp +++ b/cockatrice/src/interface/widgets/printing_selector/printing_selector.cpp @@ -218,7 +218,7 @@ void PrintingSelector::getAllSetsForCurrentCard() connect(widgetLoadingBufferTimer, &QTimer::timeout, this, [=, this]() mutable { for (int i = 0; i < BATCH_SIZE && currentIndex < printingsToUse.size(); ++i, ++currentIndex) { - ExactCard card = ExactCard(selectedCard, printingsToUse[currentIndex]); + auto card = ExactCard(selectedCard, printingsToUse[currentIndex]); auto *cardDisplayWidget = new PrintingSelectorCardDisplayWidget( this, deckEditor, deckModel, deckView, cardSizeWidget->getSlider(), card, currentZone); flowWidget->addWidget(cardDisplayWidget); diff --git a/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_selection_widget.cpp b/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_selection_widget.cpp index 9c046a51b..57d5fd895 100644 --- a/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_selection_widget.cpp +++ b/cockatrice/src/interface/widgets/printing_selector/printing_selector_card_selection_widget.cpp @@ -47,7 +47,7 @@ void PrintingSelectorCardSelectionWidget::connectSignals() void PrintingSelectorCardSelectionWidget::selectSetForCards() { - DlgSelectSetForCards *setSelectionDialog = new DlgSelectSetForCards(nullptr, parent->getDeckModel()); + auto *setSelectionDialog = new DlgSelectSetForCards(nullptr, parent->getDeckModel()); if (!setSelectionDialog->exec()) { return; } diff --git a/cockatrice/src/interface/widgets/server/games_model.cpp b/cockatrice/src/interface/widgets/server/games_model.cpp index 1da92cdad..4c68390c9 100644 --- a/cockatrice/src/interface/widgets/server/games_model.cpp +++ b/cockatrice/src/interface/widgets/server/games_model.cpp @@ -28,7 +28,7 @@ enum GameListColumn const int DEFAULT_MAX_PLAYERS_MIN = 1; const int DEFAULT_MAX_PLAYERS_MAX = 99; -constexpr QTime DEFAULT_MAX_GAME_AGE = QTime(); +constexpr auto DEFAULT_MAX_GAME_AGE = QTime(); const QString GamesModel::getGameCreatedString(const int secs) { @@ -333,7 +333,7 @@ void GamesProxyModel::setGameFilters(bool _hideBuddiesOnlyGames, int GamesProxyModel::getNumFilteredGames() const { - GamesModel *model = qobject_cast(sourceModel()); + auto *model = qobject_cast(sourceModel()); if (!model) return 0; diff --git a/cockatrice/src/interface/widgets/server/remote/remote_replay_list_tree_widget.cpp b/cockatrice/src/interface/widgets/server/remote/remote_replay_list_tree_widget.cpp index a5e8e46df..5152880d9 100644 --- a/cockatrice/src/interface/widgets/server/remote/remote_replay_list_tree_widget.cpp +++ b/cockatrice/src/interface/widgets/server/remote/remote_replay_list_tree_widget.cpp @@ -48,7 +48,7 @@ int RemoteReplayList_TreeModel::rowCount(const QModelIndex &parent) const if (!parent.isValid()) return replayMatches.size(); - MatchNode *matchNode = dynamic_cast(static_cast(parent.internalPointer())); + auto *matchNode = dynamic_cast(static_cast(parent.internalPointer())); if (matchNode) return matchNode->size(); else @@ -62,7 +62,7 @@ QVariant RemoteReplayList_TreeModel::data(const QModelIndex &index, int role) co if (index.column() >= numberOfColumns) return QVariant(); - ReplayNode *replayNode = dynamic_cast(static_cast(index.internalPointer())); + auto *replayNode = dynamic_cast(static_cast(index.internalPointer())); if (replayNode) { const ServerInfo_Replay &replayInfo = replayNode->getReplayInfo(); switch (role) { @@ -84,7 +84,7 @@ QVariant RemoteReplayList_TreeModel::data(const QModelIndex &index, int role) co return index.column() == 0 ? fileIcon : QVariant(); } } else { - MatchNode *matchNode = dynamic_cast(static_cast(index.internalPointer())); + auto *matchNode = dynamic_cast(static_cast(index.internalPointer())); const ServerInfo_ReplayMatch &matchInfo = matchNode->getMatchInfo(); switch (role) { case Qt::TextAlignmentRole: @@ -170,7 +170,7 @@ QModelIndex RemoteReplayList_TreeModel::index(int row, int column, const QModelI if (!hasIndex(row, column, parent)) return QModelIndex(); - MatchNode *matchNode = dynamic_cast(static_cast(parent.internalPointer())); + auto *matchNode = dynamic_cast(static_cast(parent.internalPointer())); if (matchNode) { if (row >= matchNode->size()) return QModelIndex(); @@ -188,7 +188,7 @@ QModelIndex RemoteReplayList_TreeModel::parent(const QModelIndex &ind) const if (matchNode) return QModelIndex(); else { - ReplayNode *replayNode = dynamic_cast(static_cast(ind.internalPointer())); + auto *replayNode = dynamic_cast(static_cast(ind.internalPointer())); return createIndex(replayNode->getParent()->indexOf(replayNode), 0, replayNode->getParent()); } } @@ -206,7 +206,7 @@ ServerInfo_Replay const *RemoteReplayList_TreeModel::getReplay(const QModelIndex if (!index.isValid()) return 0; - ReplayNode *node = dynamic_cast(static_cast(index.internalPointer())); + auto *node = dynamic_cast(static_cast(index.internalPointer())); if (!node) return 0; return &node->getReplayInfo(); diff --git a/cockatrice/src/interface/widgets/server/user/user_context_menu.cpp b/cockatrice/src/interface/widgets/server/user/user_context_menu.cpp index a255a38d5..cb7d2eca9 100644 --- a/cockatrice/src/interface/widgets/server/user/user_context_menu.cpp +++ b/cockatrice/src/interface/widgets/server/user/user_context_menu.cpp @@ -110,7 +110,7 @@ void UserContextMenu::gamesOfUserReceived(const Response &resp, const CommandCon gameTypeMap.insert(roomInfo.room_id(), tempMap); } - GameSelector *selector = new GameSelector(client, tabSupervisor, nullptr, roomMap, gameTypeMap, false, false); + auto *selector = new GameSelector(client, tabSupervisor, nullptr, roomMap, gameTypeMap, false, false); selector->setParent(static_cast(parent()), Qt::Window); const int gameListSize = response.game_list_size(); for (int i = 0; i < gameListSize; ++i) { @@ -128,7 +128,7 @@ void UserContextMenu::banUser_processUserInfoResponse(const Response &r) const Response_GetUserInfo &response = r.GetExtension(Response_GetUserInfo::ext); // The dialog needs to be non-modal in order to not block the event queue of the client. - BanDialog *dlg = new BanDialog(response.user_info(), static_cast(parent())); + auto *dlg = new BanDialog(response.user_info(), static_cast(parent())); connect(dlg, &QDialog::accepted, this, &UserContextMenu::banUser_dialogFinished); dlg->show(); } @@ -141,7 +141,7 @@ void UserContextMenu::warnUser_processGetWarningsListResponse(const Response &r) QString clientid = QString::fromStdString(response.user_clientid()).simplified(); // The dialog needs to be non-modal in order to not block the event queue of the client. - WarningDialog *dlg = new WarningDialog(user, clientid, static_cast(parent())); + auto *dlg = new WarningDialog(user, clientid, static_cast(parent())); connect(dlg, &QDialog::accepted, this, &UserContextMenu::warnUser_dialogFinished); if (response.warning_size() > 0) { @@ -171,7 +171,7 @@ void UserContextMenu::banUserHistory_processResponse(const Response &resp) if (resp.response_code() == Response::RespOk) { if (response.ban_list_size() > 0) { - QTableWidget *table = new QTableWidget(); + auto *table = new QTableWidget(); table->setWindowTitle(tr("Ban History")); table->setRowCount(response.ban_list_size()); table->setColumnCount(5); @@ -209,7 +209,7 @@ void UserContextMenu::warnUserHistory_processResponse(const Response &resp) if (resp.response_code() == Response::RespOk) { if (response.warn_list_size() > 0) { - QTableWidget *table = new QTableWidget(); + auto *table = new QTableWidget(); table->setWindowTitle(tr("Warning History")); table->setRowCount(response.warn_list_size()); table->setColumnCount(4); @@ -278,7 +278,7 @@ void UserContextMenu::adjustMod_processUserResponse(const Response &resp, const void UserContextMenu::banUser_dialogFinished() { - BanDialog *dlg = static_cast(sender()); + auto *dlg = static_cast(sender()); Command_BanFromServer cmd; cmd.set_user_name(dlg->getBanName().toStdString()); @@ -297,7 +297,7 @@ void UserContextMenu::banUser_dialogFinished() void UserContextMenu::warnUser_dialogFinished() { - WarningDialog *dlg = static_cast(sender()); + auto *dlg = static_cast(sender()); if (dlg->getName().isEmpty() || userListProxy->getOwnUsername().simplified().isEmpty()) return; @@ -433,7 +433,7 @@ void UserContextMenu::showContextMenu(const QPoint &pos, QAction *actionClicked = menu->exec(pos); if (actionClicked == nullptr) { } else if (actionClicked == aDetails) { - UserInfoBox *infoWidget = + auto *infoWidget = new UserInfoBox(client, false, static_cast(parent()), Qt::Dialog | Qt::WindowTitleHint | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint); infoWidget->setAttribute(Qt::WA_DeleteOnClose); diff --git a/cockatrice/src/interface/widgets/tabs/api/edhrec/tab_edhrec_main.cpp b/cockatrice/src/interface/widgets/tabs/api/edhrec/tab_edhrec_main.cpp index 95754e8ad..208a5f717 100644 --- a/cockatrice/src/interface/widgets/tabs/api/edhrec/tab_edhrec_main.cpp +++ b/cockatrice/src/interface/widgets/tabs/api/edhrec/tab_edhrec_main.cpp @@ -64,14 +64,14 @@ TabEdhRecMain::TabEdhRecMain(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor auto cardDatabaseModel = new CardDatabaseModel(CardDatabaseManager::getInstance(), false, this); auto displayModel = new CardDatabaseDisplayModel(this); displayModel->setSourceModel(cardDatabaseModel); - CardSearchModel *searchModel = new CardSearchModel(displayModel, this); + auto *searchModel = new CardSearchModel(displayModel, this); - CardCompleterProxyModel *proxyModel = new CardCompleterProxyModel(this); + auto *proxyModel = new CardCompleterProxyModel(this); proxyModel->setSourceModel(searchModel); proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); proxyModel->setFilterRole(Qt::DisplayRole); - QCompleter *completer = new QCompleter(proxyModel, this); + auto *completer = new QCompleter(proxyModel, this); completer->setCompletionRole(Qt::DisplayRole); completer->setCompletionMode(QCompleter::PopupCompletion); completer->setCaseSensitivity(Qt::CaseInsensitive); diff --git a/cockatrice/src/interface/widgets/tabs/tab_admin.cpp b/cockatrice/src/interface/widgets/tabs/tab_admin.cpp index 3ddb53579..533e1cc83 100644 --- a/cockatrice/src/interface/widgets/tabs/tab_admin.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_admin.cpp @@ -17,22 +17,22 @@ ShutdownDialog::ShutdownDialog(QWidget *parent) : QDialog(parent) { - QLabel *reasonLabel = new QLabel(tr("&Reason for shutdown:")); + auto *reasonLabel = new QLabel(tr("&Reason for shutdown:")); reasonEdit = new QLineEdit; reasonEdit->setMaxLength(MAX_TEXT_LENGTH); reasonLabel->setBuddy(reasonEdit); - QLabel *minutesLabel = new QLabel(tr("&Time until shutdown (minutes):")); + auto *minutesLabel = new QLabel(tr("&Time until shutdown (minutes):")); minutesEdit = new QSpinBox; minutesLabel->setBuddy(minutesEdit); minutesEdit->setMinimum(0); minutesEdit->setValue(5); minutesEdit->setMaximum(999); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + auto *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, &QDialogButtonBox::accepted, this, &ShutdownDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &ShutdownDialog::reject); - QGridLayout *mainLayout = new QGridLayout; + auto *mainLayout = new QGridLayout; mainLayout->addWidget(reasonLabel, 0, 0); mainLayout->addWidget(reasonEdit, 0, 1); mainLayout->addWidget(minutesLabel, 1, 0); @@ -109,7 +109,7 @@ TabAdmin::TabAdmin(TabSupervisor *_tabSupervisor, AbstractClient *_client, bool lockButton->setEnabled(false); connect(lockButton, &QPushButton::clicked, this, &TabAdmin::actLock); - QVBoxLayout *mainLayout = new QVBoxLayout; + auto *mainLayout = new QVBoxLayout; mainLayout->addWidget(adminGroupBox); mainLayout->addWidget(moderatorGroupBox); mainLayout->addStretch(); @@ -118,7 +118,7 @@ TabAdmin::TabAdmin(TabSupervisor *_tabSupervisor, AbstractClient *_client, bool retranslateUi(); - QWidget *mainWidget = new QWidget(this); + auto *mainWidget = new QWidget(this); mainWidget->setLayout(mainLayout); setCentralWidget(mainWidget); diff --git a/cockatrice/src/interface/widgets/tabs/tab_game.cpp b/cockatrice/src/interface/widgets/tabs/tab_game.cpp index 02d176cef..8f187575c 100644 --- a/cockatrice/src/interface/widgets/tabs/tab_game.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_game.cpp @@ -982,7 +982,7 @@ void TabGame::createMenuItems() phasesMenu = new TearOffMenu(this); for (int i = 0; i < phasesToolbar->phaseCount(); ++i) { - QAction *temp = new QAction(QString(), this); + auto *temp = new QAction(QString(), this); connect(temp, &QAction::triggered, this, &TabGame::actPhaseAction); phasesMenu->addAction(temp); phaseActions.append(temp); diff --git a/cockatrice/src/interface/widgets/tabs/tab_message.cpp b/cockatrice/src/interface/widgets/tabs/tab_message.cpp index f1a942f16..bd0457990 100644 --- a/cockatrice/src/interface/widgets/tabs/tab_message.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_message.cpp @@ -34,7 +34,7 @@ TabMessage::TabMessage(TabSupervisor *_tabSupervisor, sayEdit->setMaxLength(MAX_TEXT_LENGTH); connect(sayEdit, &LineEditUnfocusable::returnPressed, this, &TabMessage::sendMessage); - QVBoxLayout *vbox = new QVBoxLayout; + auto *vbox = new QVBoxLayout; vbox->addWidget(chatView); vbox->addWidget(sayEdit); @@ -47,7 +47,7 @@ TabMessage::TabMessage(TabSupervisor *_tabSupervisor, retranslateUi(); - QWidget *mainWidget = new QWidget(this); + auto *mainWidget = new QWidget(this); mainWidget->setLayout(vbox); setCentralWidget(mainWidget); } diff --git a/cockatrice/src/interface/widgets/tabs/tab_room.cpp b/cockatrice/src/interface/widgets/tabs/tab_room.cpp index e1fcca216..92e38662b 100644 --- a/cockatrice/src/interface/widgets/tabs/tab_room.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_room.cpp @@ -67,7 +67,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, sayLabel->setBuddy(sayEdit); connect(sayEdit, &LineEditCompleter::returnPressed, this, &TabRoom::sendMessage); - QMenu *chatSettingsMenu = new QMenu(this); + auto *chatSettingsMenu = new QMenu(this); aClearChat = chatSettingsMenu->addAction(QString()); connect(aClearChat, &QAction::triggered, this, &TabRoom::actClearChat); @@ -77,28 +77,28 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, aOpenChatSettings = chatSettingsMenu->addAction(QString()); connect(aOpenChatSettings, &QAction::triggered, this, &TabRoom::actOpenChatSettings); - QToolButton *chatSettingsButton = new QToolButton; + auto *chatSettingsButton = new QToolButton; chatSettingsButton->setIcon(QPixmap("theme:icons/settings")); chatSettingsButton->setMenu(chatSettingsMenu); chatSettingsButton->setPopupMode(QToolButton::InstantPopup); - QHBoxLayout *sayHbox = new QHBoxLayout; + auto *sayHbox = new QHBoxLayout; sayHbox->addWidget(sayLabel); sayHbox->addWidget(sayEdit); sayHbox->addWidget(chatSettingsButton); - QVBoxLayout *chatVbox = new QVBoxLayout; + auto *chatVbox = new QVBoxLayout; chatVbox->addWidget(chatView); chatVbox->addLayout(sayHbox); chatGroupBox = new QGroupBox; chatGroupBox->setLayout(chatVbox); - QSplitter *splitter = new QSplitter(Qt::Vertical); + auto *splitter = new QSplitter(Qt::Vertical); splitter->addWidget(gameSelector); splitter->addWidget(chatGroupBox); - QHBoxLayout *hbox = new QHBoxLayout; + auto *hbox = new QHBoxLayout; hbox->addWidget(splitter, 3); hbox->addWidget(userList, 1); @@ -133,7 +133,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, retranslateUi(); - QWidget *mainWidget = new QWidget(this); + auto *mainWidget = new QWidget(this); mainWidget->setLayout(hbox); setCentralWidget(mainWidget); } diff --git a/cockatrice/src/interface/widgets/tabs/tab_supervisor.cpp b/cockatrice/src/interface/widgets/tabs/tab_supervisor.cpp index 6d6f2d4ec..6d550be01 100644 --- a/cockatrice/src/interface/widgets/tabs/tab_supervisor.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_supervisor.cpp @@ -931,7 +931,7 @@ void TabSupervisor::deckEditorClosed(AbstractTabDeckEditor *tab) void TabSupervisor::tabUserEvent(bool globalEvent) { - Tab *tab = static_cast(sender()); + auto *tab = static_cast(sender()); if (tab != currentWidget()) { tab->setContentsChanged(true); setTabIcon(indexOf(tab), QPixmap("theme:icons/tab_changed")); @@ -1032,7 +1032,7 @@ void TabSupervisor::processUserJoined(const ServerInfo_User &userInfoJoined) void TabSupervisor::updateCurrent(int index) { if (index != -1) { - Tab *tab = static_cast(widget(index)); + auto *tab = static_cast(widget(index)); if (tab->getContentsChanged()) { setTabIcon(index, QIcon()); tab->setContentsChanged(false); diff --git a/libcockatrice_card/libcockatrice/card/card_info.h b/libcockatrice_card/libcockatrice/card/card_info.h index 598313789..b72d1fbbe 100644 --- a/libcockatrice_card/libcockatrice/card/card_info.h +++ b/libcockatrice_card/libcockatrice/card/card_info.h @@ -160,7 +160,7 @@ public: */ CardInfoPtr clone() const { - CardInfoPtr newCardInfo = CardInfoPtr(new CardInfo(*this)); + auto newCardInfo = CardInfoPtr(new CardInfo(*this)); newCardInfo->setSmartPointer(newCardInfo); // Set the smart pointer for the new instance return newCardInfo; } diff --git a/libcockatrice_deck_list/libcockatrice/deck_list/inner_deck_list_node.cpp b/libcockatrice_deck_list/libcockatrice/deck_list/inner_deck_list_node.cpp index c91b3ea14..eca58963a 100644 --- a/libcockatrice_deck_list/libcockatrice/deck_list/inner_deck_list_node.cpp +++ b/libcockatrice_deck_list/libcockatrice/deck_list/inner_deck_list_node.cpp @@ -145,10 +145,10 @@ bool InnerDecklistNode::readElement(QXmlStreamReader *xml) const QString childName = xml->name().toString(); if (xml->isStartElement()) { if (childName == "zone") { - InnerDecklistNode *newZone = new InnerDecklistNode(xml->attributes().value("name").toString(), this); + auto *newZone = new InnerDecklistNode(xml->attributes().value("name").toString(), this); newZone->readElement(xml); } else if (childName == "card") { - DecklistCardNode *newCard = new DecklistCardNode( + auto *newCard = new DecklistCardNode( xml->attributes().value("name").toString(), xml->attributes().value("number").toString().toInt(), this, -1, xml->attributes().value("setShortName").toString(), xml->attributes().value("collectorNumber").toString(), xml->attributes().value("uuid").toString()); diff --git a/libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_player.cpp b/libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_player.cpp index 5ac0a26ad..1c81b6823 100644 --- a/libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_player.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_player.cpp @@ -1095,12 +1095,11 @@ Server_AbstractPlayer::cmdCreateToken(const Command_CreateToken &cmd, ResponseCo arrowInfo->set_start_player_id(player->getPlayerId()); arrowInfo->set_start_zone(startCard->getZone()->getName().toStdString()); arrowInfo->set_start_card_id(startCard->getId()); - const Server_AbstractPlayer *arrowTargetPlayer = - qobject_cast(targetItem); + const auto *arrowTargetPlayer = qobject_cast(targetItem); if (arrowTargetPlayer != nullptr) { arrowInfo->set_target_player_id(arrowTargetPlayer->getPlayerId()); } else { - const Server_Card *arrowTargetCard = qobject_cast(targetItem); + const auto *arrowTargetCard = qobject_cast(targetItem); arrowInfo->set_target_player_id(arrowTargetCard->getZone()->getPlayer()->getPlayerId()); arrowInfo->set_target_zone(arrowTargetCard->getZone()->getName().toStdString()); arrowInfo->set_target_card_id(arrowTargetCard->getId()); diff --git a/libcockatrice_network/libcockatrice/network/server/remote/game/server_arrow.cpp b/libcockatrice_network/libcockatrice/network/server/remote/game/server_arrow.cpp index e077416bc..9433d8d3f 100644 --- a/libcockatrice_network/libcockatrice/network/server/remote/game/server_arrow.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_arrow.cpp @@ -19,7 +19,7 @@ void Server_Arrow::getInfo(ServerInfo_Arrow *info) info->set_start_card_id(startCard->getId()); info->mutable_arrow_color()->CopyFrom(arrowColor); - Server_Card *targetCard = qobject_cast(targetItem); + auto *targetCard = qobject_cast(targetItem); if (targetCard) { info->set_target_player_id(targetCard->getZone()->getPlayer()->getPlayerId()); info->set_target_zone(targetCard->getZone()->getName().toStdString()); diff --git a/libcockatrice_network/libcockatrice/network/server/remote/game/server_game.cpp b/libcockatrice_network/libcockatrice/network/server/remote/game/server_game.cpp index 647d1d078..82b24ccde 100644 --- a/libcockatrice_network/libcockatrice/network/server/remote/game/server_game.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_game.cpp @@ -589,7 +589,7 @@ void Server_Game::removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_Abst for (Server_AbstractPlayer *anyPlayer : getPlayers().values()) { QList toDelete; for (auto *arrow : anyPlayer->getArrows().values()) { - Server_Card *targetCard = qobject_cast(arrow->getTargetItem()); + auto *targetCard = qobject_cast(arrow->getTargetItem()); if (targetCard) { if (targetCard->getZone() != nullptr && targetCard->getZone()->getPlayer() == player) toDelete.append(arrow); @@ -781,7 +781,7 @@ void Server_Game::sendGameEventContainer(GameEventContainer *cont, GameEventContainer * Server_Game::prepareGameEvent(const ::google::protobuf::Message &gameEvent, int playerId, GameEventContext *context) { - GameEventContainer *cont = new GameEventContainer; + auto *cont = new GameEventContainer; cont->set_game_id(gameId); if (context) cont->mutable_context()->CopyFrom(*context); diff --git a/libcockatrice_network/libcockatrice/network/server/remote/server_abstractuserinterface.cpp b/libcockatrice_network/libcockatrice/network/server/remote/server_abstractuserinterface.cpp index 96626a4bf..e228f0128 100644 --- a/libcockatrice_network/libcockatrice/network/server/remote/server_abstractuserinterface.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/server_abstractuserinterface.cpp @@ -35,7 +35,7 @@ void Server_AbstractUserInterface::sendProtocolItemByType(ServerMessage::Message SessionEvent *Server_AbstractUserInterface::prepareSessionEvent(const ::google::protobuf::Message &sessionEvent) { - SessionEvent *event = new SessionEvent; + auto *event = new SessionEvent; event->GetReflection() ->MutableMessage(event, sessionEvent.GetDescriptor()->FindExtensionByName("ext")) ->CopyFrom(sessionEvent); diff --git a/libcockatrice_network/libcockatrice/network/server/remote/server_protocolhandler.cpp b/libcockatrice_network/libcockatrice/network/server/remote/server_protocolhandler.cpp index 92dcf4230..bfd8d113c 100644 --- a/libcockatrice_network/libcockatrice/network/server/remote/server_protocolhandler.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/server_protocolhandler.cpp @@ -473,7 +473,7 @@ Response::ResponseCode Server_ProtocolHandler::cmdLogin(const Command_Login &cmd if (!missingClientFeatures.isEmpty()) { if (features.isRequiredFeaturesMissing(missingClientFeatures, server->getServerRequiredFeatureList())) { - Response_Login *re = new Response_Login; + auto *re = new Response_Login; re->set_denied_reason_str("Client upgrade required"); QMap::iterator i; for (i = missingClientFeatures.begin(); i != missingClientFeatures.end(); ++i) { @@ -491,7 +491,7 @@ Response::ResponseCode Server_ProtocolHandler::cmdLogin(const Command_Login &cmd clientId, clientVersion, connectionType); switch (res) { case UserIsBanned: { - Response_Login *re = new Response_Login; + auto *re = new Response_Login; re->set_denied_reason_str(reasonStr.toStdString()); if (banSecondsLeft != 0) re->set_denied_end_time(QDateTime::currentDateTime().addSecs(banSecondsLeft).toSecsSinceEpoch()); @@ -503,7 +503,7 @@ Response::ResponseCode Server_ProtocolHandler::cmdLogin(const Command_Login &cmd case WouldOverwriteOldSession: return Response::RespWouldOverwriteOldSession; case UsernameInvalid: { - Response_Login *re = new Response_Login; + auto *re = new Response_Login; re->set_denied_reason_str(reasonStr.toStdString()); rc.setResponseExtension(re); return Response::RespUsernameInvalid; @@ -534,7 +534,7 @@ Response::ResponseCode Server_ProtocolHandler::cmdLogin(const Command_Login &cmd event.set_message(server->getLoginMessage().toStdString()); rc.enqueuePostResponseItem(ServerMessage::SESSION_EVENT, prepareSessionEvent(event)); - Response_Login *re = new Response_Login; + auto *re = new Response_Login; re->mutable_user_info()->CopyFrom(copyUserInfo(true)); if (authState == PasswordRight) { @@ -616,7 +616,7 @@ Response::ResponseCode Server_ProtocolHandler::cmdGetGamesOfUser(const Command_G // We don't need to check whether the user is logged in; persistent games should also work. // The client needs to deal with an empty result list. - Response_GetGamesOfUser *re = new Response_GetGamesOfUser; + auto *re = new Response_GetGamesOfUser; server->roomsLock.lockForRead(); QMapIterator roomIterator(server->getRooms()); while (roomIterator.hasNext()) { @@ -640,7 +640,7 @@ Response::ResponseCode Server_ProtocolHandler::cmdGetUserInfo(const Command_GetU return Response::RespLoginNeeded; QString userName = nameFromStdString(cmd.user_name()); - Response_GetUserInfo *re = new Response_GetUserInfo; + auto *re = new Response_GetUserInfo; if (userName.isEmpty()) re->mutable_user_info()->CopyFrom(*userInfo); else { @@ -713,7 +713,7 @@ Response::ResponseCode Server_ProtocolHandler::cmdJoinRoom(const Command_JoinRoo joinMessageEvent.set_message_type(Event_RoomSay::Welcome); rc.enqueuePostResponseItem(ServerMessage::ROOM_EVENT, room->prepareRoomEvent(joinMessageEvent)); - Response_JoinRoom *re = new Response_JoinRoom; + auto *re = new Response_JoinRoom; room->getInfo(*re->mutable_room_info(), true); rc.setResponseExtension(re); @@ -725,7 +725,7 @@ Response::ResponseCode Server_ProtocolHandler::cmdListUsers(const Command_ListUs if (authState == NotLoggedIn) return Response::RespLoginNeeded; - Response_ListUsers *re = new Response_ListUsers; + auto *re = new Response_ListUsers; server->clientsLock.lockForRead(); QMapIterator userIterator = server->getUsers(); while (userIterator.hasNext()) @@ -838,10 +838,10 @@ Server_ProtocolHandler::cmdCreateGame(const Command_CreateGame &cmd, Server_Room // When server doesn't permit registered users to exist, do not honor only-reg setting bool onlyRegisteredUsers = cmd.only_registered() && (server->permitUnregisteredUsers()); - Server_Game *game = new Server_Game( - copyUserInfo(false), gameId, description, QString::fromStdString(cmd.password()), cmd.max_players(), gameTypes, - cmd.only_buddies(), onlyRegisteredUsers, cmd.spectators_allowed(), cmd.spectators_need_password(), - cmd.spectators_can_talk(), cmd.spectators_see_everything(), startingLifeTotal, shareDecklistsOnLoad, room); + auto *game = new Server_Game(copyUserInfo(false), gameId, description, QString::fromStdString(cmd.password()), + cmd.max_players(), gameTypes, cmd.only_buddies(), onlyRegisteredUsers, + cmd.spectators_allowed(), cmd.spectators_need_password(), cmd.spectators_can_talk(), + cmd.spectators_see_everything(), startingLifeTotal, shareDecklistsOnLoad, room); game->addPlayer(this, rc, asSpectator, asJudge, false); room->addGame(game); diff --git a/libcockatrice_network/libcockatrice/network/server/remote/server_room.cpp b/libcockatrice_network/libcockatrice/network/server/remote/server_room.cpp index e94b255bd..bfa8912b1 100644 --- a/libcockatrice_network/libcockatrice/network/server/remote/server_room.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/server_room.cpp @@ -128,7 +128,7 @@ Server_Room::getInfo(ServerInfo_Room &result, bool complete, bool showGameTypes, RoomEvent *Server_Room::prepareRoomEvent(const ::google::protobuf::Message &roomEvent) { - RoomEvent *event = new RoomEvent; + auto *event = new RoomEvent; event->set_room_id(id); event->GetReflection() ->MutableMessage(event, roomEvent.GetDescriptor()->FindExtensionByName("ext"))