diff --git a/cockatrice/src/game/board/abstract_counter.cpp b/cockatrice/src/game/board/abstract_counter.cpp index 10c51a638..b98647cdf 100644 --- a/cockatrice/src/game/board/abstract_counter.cpp +++ b/cockatrice/src/game/board/abstract_counter.cpp @@ -36,7 +36,7 @@ AbstractCounter::AbstractCounter(Player *_player, QString displayName = TranslateCounterName::getDisplayName(_name); menu = new TearOffMenu(displayName); aSet = new QAction(this); - connect(aSet, SIGNAL(triggered()), this, SLOT(setCounter())); + connect(aSet, &QAction::triggered, this, &AbstractCounter::setCounter); menu->addAction(aSet); menu->addSeparator(); for (int i = 10; i >= -10; --i) { @@ -49,7 +49,7 @@ AbstractCounter::AbstractCounter(Player *_player, else if (i == 1) aInc = aIncrement; aIncrement->setData(i); - connect(aIncrement, SIGNAL(triggered()), this, SLOT(incrementCounter())); + connect(aIncrement, &QAction::triggered, this, &AbstractCounter::incrementCounter); menu->addAction(aIncrement); } } @@ -57,7 +57,8 @@ AbstractCounter::AbstractCounter(Player *_player, menu = nullptr; } - connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts())); + connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this, + &AbstractCounter::refreshShortcuts); refreshShortcuts(); retranslateUi(); } diff --git a/cockatrice/src/game/cards/abstract_card_item.cpp b/cockatrice/src/game/cards/abstract_card_item.cpp index 3adc3bed9..8101c2d6e 100644 --- a/cockatrice/src/game/cards/abstract_card_item.cpp +++ b/cockatrice/src/game/cards/abstract_card_item.cpp @@ -24,7 +24,7 @@ AbstractCardItem::AbstractCardItem(QGraphicsItem *parent, setFlag(ItemIsSelectable); setCacheMode(DeviceCoordinateCache); - connect(&SettingsCache::instance(), SIGNAL(displayCardNamesChanged()), this, SLOT(callUpdate())); + connect(&SettingsCache::instance(), &SettingsCache::displayCardNamesChanged, this, [this] { update(); }); refreshCardInfo(); } @@ -62,7 +62,7 @@ void AbstractCardItem::refreshCardInfo() CardInfoPerSetMap(), false, false, -1, false); } if (info.data()) { - connect(info.data(), SIGNAL(pixmapUpdated()), this, SLOT(pixmapUpdated())); + connect(info.data(), &CardInfo::pixmapUpdated, this, &AbstractCardItem::pixmapUpdated); } cacheBgColor(); diff --git a/cockatrice/src/game/cards/abstract_card_item.h b/cockatrice/src/game/cards/abstract_card_item.h index 809f90498..75bb794f1 100644 --- a/cockatrice/src/game/cards/abstract_card_item.h +++ b/cockatrice/src/game/cards/abstract_card_item.h @@ -28,10 +28,6 @@ private: qreal realZValue; private slots: void pixmapUpdated(); - void callUpdate() - { - update(); - } public slots: void refreshCardInfo(); diff --git a/cockatrice/src/game/cards/card_database.cpp b/cockatrice/src/game/cards/card_database.cpp index 00fa4824d..0a3d596d3 100644 --- a/cockatrice/src/game/cards/card_database.cpp +++ b/cockatrice/src/game/cards/card_database.cpp @@ -375,11 +375,12 @@ CardDatabase::CardDatabase(QObject *parent) : QObject(parent), loadStatus(NotLoa availableParsers << new CockatriceXml3Parser; for (auto &parser : availableParsers) { - connect(parser, SIGNAL(addCard(CardInfoPtr)), this, SLOT(addCard(CardInfoPtr)), Qt::DirectConnection); - connect(parser, SIGNAL(addSet(CardSetPtr)), this, SLOT(addSet(CardSetPtr)), Qt::DirectConnection); + connect(parser, &ICardDatabaseParser::addCard, this, &CardDatabase::addCard, Qt::DirectConnection); + connect(parser, &ICardDatabaseParser::addSet, this, &CardDatabase::addSet, Qt::DirectConnection); } - connect(&SettingsCache::instance(), SIGNAL(cardDatabasePathChanged()), this, SLOT(loadCardDatabases())); + connect(&SettingsCache::instance(), &SettingsCache::cardDatabasePathChanged, this, + &CardDatabase::loadCardDatabases); } CardDatabase::~CardDatabase() diff --git a/cockatrice/src/game/cards/card_database_model.cpp b/cockatrice/src/game/cards/card_database_model.cpp index 5607b077f..fb105d424 100644 --- a/cockatrice/src/game/cards/card_database_model.cpp +++ b/cockatrice/src/game/cards/card_database_model.cpp @@ -9,9 +9,10 @@ CardDatabaseModel::CardDatabaseModel(CardDatabase *_db, bool _showOnlyCardsFromEnabledSets, QObject *parent) : QAbstractListModel(parent), db(_db), showOnlyCardsFromEnabledSets(_showOnlyCardsFromEnabledSets) { - connect(db, SIGNAL(cardAdded(CardInfoPtr)), this, SLOT(cardAdded(CardInfoPtr))); - connect(db, SIGNAL(cardRemoved(CardInfoPtr)), this, SLOT(cardRemoved(CardInfoPtr))); - connect(db, SIGNAL(cardDatabaseEnabledSetsChanged()), this, SLOT(cardDatabaseEnabledSetsChanged())); + connect(db, &CardDatabase::cardAdded, this, &CardDatabaseModel::cardAdded); + connect(db, &CardDatabase::cardRemoved, this, &CardDatabaseModel::cardRemoved); + connect(db, &CardDatabase::cardDatabaseEnabledSetsChanged, this, + &CardDatabaseModel::cardDatabaseEnabledSetsChanged); cardDatabaseEnabledSetsChanged(); } @@ -131,7 +132,7 @@ void CardDatabaseModel::cardAdded(CardInfoPtr card) beginInsertRows(QModelIndex(), cardList.size(), cardList.size()); cardList.append(card); cardListSet.insert(card); - connect(card.data(), SIGNAL(cardInfoChanged(CardInfoPtr)), this, SLOT(cardInfoChanged(CardInfoPtr))); + connect(card.data(), &CardInfo::cardInfoChanged, this, &CardDatabaseModel::cardInfoChanged); endInsertRows(); } } @@ -342,7 +343,7 @@ void CardDatabaseDisplayModel::setFilterTree(FilterTree *_filterTree) disconnect(this->filterTree, nullptr, this, nullptr); this->filterTree = _filterTree; - connect(this->filterTree, SIGNAL(changed()), this, SLOT(filterTreeChanged())); + connect(this->filterTree, &FilterTree::changed, this, &CardDatabaseDisplayModel::filterTreeChanged); invalidate(); } diff --git a/cockatrice/src/game/cards/card_database_parser/card_database_parser.h b/cockatrice/src/game/cards/card_database_parser/card_database_parser.h index 87e8eec5e..12da8efbb 100644 --- a/cockatrice/src/game/cards/card_database_parser/card_database_parser.h +++ b/cockatrice/src/game/cards/card_database_parser/card_database_parser.h @@ -10,6 +10,7 @@ class ICardDatabaseParser : public QObject { + Q_OBJECT public: ~ICardDatabaseParser() override = default; @@ -35,8 +36,8 @@ protected: const QDate &releaseDate = QDate(), const CardSet::Priority priority = CardSet::PriorityFallback); signals: - virtual void addCard(CardInfoPtr card) = 0; - virtual void addSet(CardSetPtr set) = 0; + void addCard(CardInfoPtr card); + void addSet(CardSetPtr set); }; Q_DECLARE_INTERFACE(ICardDatabaseParser, "ICardDatabaseParser") diff --git a/cockatrice/src/game/cards/card_database_parser/cockatrice_xml_3.h b/cockatrice/src/game/cards/card_database_parser/cockatrice_xml_3.h index 2006d2203..9e7726e35 100644 --- a/cockatrice/src/game/cards/card_database_parser/cockatrice_xml_3.h +++ b/cockatrice/src/game/cards/card_database_parser/cockatrice_xml_3.h @@ -24,9 +24,6 @@ private: void loadCardsFromXml(QXmlStreamReader &xml); void loadSetsFromXml(QXmlStreamReader &xml); QString getMainCardType(QString &type); -signals: - void addCard(CardInfoPtr card) override; - void addSet(CardSetPtr set) override; }; #endif \ No newline at end of file diff --git a/cockatrice/src/game/cards/card_database_parser/cockatrice_xml_4.h b/cockatrice/src/game/cards/card_database_parser/cockatrice_xml_4.h index 59de582a3..82f71324a 100644 --- a/cockatrice/src/game/cards/card_database_parser/cockatrice_xml_4.h +++ b/cockatrice/src/game/cards/card_database_parser/cockatrice_xml_4.h @@ -24,9 +24,6 @@ private: QVariantHash loadCardPropertiesFromXml(QXmlStreamReader &xml); void loadCardsFromXml(QXmlStreamReader &xml); void loadSetsFromXml(QXmlStreamReader &xml); -signals: - void addCard(CardInfoPtr card) override; - void addSet(CardSetPtr set) override; }; #endif \ No newline at end of file diff --git a/cockatrice/src/game/filters/filter_builder.cpp b/cockatrice/src/game/filters/filter_builder.cpp index fafb8a910..461da6841 100644 --- a/cockatrice/src/game/filters/filter_builder.cpp +++ b/cockatrice/src/game/filters/filter_builder.cpp @@ -40,9 +40,9 @@ FilterBuilder::FilterBuilder(QWidget *parent) : QWidget(parent) setLayout(layout); - connect(filterCombo, SIGNAL(activated(int)), edit, SLOT(setFocus())); - connect(edit, SIGNAL(returnPressed()), this, SLOT(emit_add())); - connect(ok, SIGNAL(released()), this, SLOT(emit_add())); + connect(filterCombo, qOverload(&QComboBox::activated), edit, [this](int) { setFocus(); }); + connect(edit, &LineEditUnfocusable::returnPressed, this, &FilterBuilder::emit_add); + connect(ok, &QPushButton::released, this, &FilterBuilder::emit_add); fltr = NULL; } diff --git a/cockatrice/src/game/filters/filter_tree_model.cpp b/cockatrice/src/game/filters/filter_tree_model.cpp index e3dcaec2f..7541fc243 100644 --- a/cockatrice/src/game/filters/filter_tree_model.cpp +++ b/cockatrice/src/game/filters/filter_tree_model.cpp @@ -8,14 +8,10 @@ FilterTreeModel::FilterTreeModel(QObject *parent) : QAbstractItemModel(parent) { fTree = new FilterTree; - connect(fTree, SIGNAL(preInsertRow(const FilterTreeNode *, int)), this, - SLOT(proxyBeginInsertRow(const FilterTreeNode *, int))); - connect(fTree, SIGNAL(postInsertRow(const FilterTreeNode *, int)), this, - SLOT(proxyEndInsertRow(const FilterTreeNode *, int))); - connect(fTree, SIGNAL(preRemoveRow(const FilterTreeNode *, int)), this, - SLOT(proxyBeginRemoveRow(const FilterTreeNode *, int))); - connect(fTree, SIGNAL(postRemoveRow(const FilterTreeNode *, int)), this, - SLOT(proxyEndRemoveRow(const FilterTreeNode *, int))); + connect(fTree, &FilterTree::preInsertRow, this, &FilterTreeModel::proxyBeginInsertRow); + connect(fTree, &FilterTree::postInsertRow, this, &FilterTreeModel::proxyEndInsertRow); + connect(fTree, &FilterTree::preRemoveRow, this, &FilterTreeModel::proxyBeginRemoveRow); + connect(fTree, &FilterTree::postRemoveRow, this, &FilterTreeModel::proxyEndRemoveRow); } FilterTreeModel::~FilterTreeModel() diff --git a/cockatrice/src/game/game_scene.cpp b/cockatrice/src/game/game_scene.cpp index 71937f1dc..cd59473ce 100644 --- a/cockatrice/src/game/game_scene.cpp +++ b/cockatrice/src/game/game_scene.cpp @@ -20,7 +20,8 @@ GameScene::GameScene(PhasesToolbar *_phasesToolbar, QObject *parent) { animationTimer = new QBasicTimer; addItem(phasesToolbar); - connect(&SettingsCache::instance(), SIGNAL(minPlayersForMultiColumnLayoutChanged()), this, SLOT(rearrange())); + connect(&SettingsCache::instance(), &SettingsCache::minPlayersForMultiColumnLayoutChanged, this, + &GameScene::rearrange); rearrange(); } @@ -41,8 +42,8 @@ void GameScene::addPlayer(Player *player) qDebug() << "GameScene::addPlayer name=" << player->getName(); players << player; addItem(player); - connect(player, SIGNAL(sizeChanged()), this, SLOT(rearrange())); - connect(player, SIGNAL(playerCountChanged()), this, SLOT(rearrange())); + connect(player, &Player::sizeChanged, this, &GameScene::rearrange); + connect(player, &Player::playerCountChanged, this, &GameScene::rearrange); } void GameScene::removePlayer(Player *player) @@ -154,7 +155,7 @@ void GameScene::toggleZoneView(Player *player, const QString &zoneName, int numb ZoneViewWidget *item = new ZoneViewWidget(player, player->getZones().value(zoneName), numberCards, false, false, {}, isReversed); zoneViews.append(item); - connect(item, SIGNAL(closePressed(ZoneViewWidget *)), this, SLOT(removeZoneView(ZoneViewWidget *))); + connect(item, &ZoneViewWidget::closePressed, this, &GameScene::removeZoneView); addItem(item); if (zoneName == "grave") { item->setPos(360, 100); @@ -172,7 +173,7 @@ void GameScene::addRevealedZoneView(Player *player, { ZoneViewWidget *item = new ZoneViewWidget(player, zone, -2, true, withWritePermission, cardList); zoneViews.append(item); - connect(item, SIGNAL(closePressed(ZoneViewWidget *)), this, SLOT(removeZoneView(ZoneViewWidget *))); + connect(item, &ZoneViewWidget::closePressed, this, &GameScene::removeZoneView); addItem(item); item->setPos(600, 80); } diff --git a/cockatrice/src/game/game_selector.cpp b/cockatrice/src/game/game_selector.cpp index fe534cf12..3a785d4e2 100644 --- a/cockatrice/src/game/game_selector.cpp +++ b/cockatrice/src/game/game_selector.cpp @@ -73,16 +73,16 @@ GameSelector::GameSelector(AbstractClient *_client, filterButton = new QPushButton; filterButton->setIcon(QPixmap("theme:icons/search")); - connect(filterButton, SIGNAL(clicked()), this, SLOT(actSetFilter())); + connect(filterButton, &QPushButton::clicked, this, &GameSelector::actSetFilter); clearFilterButton = new QPushButton; clearFilterButton->setIcon(QPixmap("theme:icons/clearsearch")); bool filtersSetToDefault = showFilters && gameListProxyModel->areFilterParametersSetToDefaults(); clearFilterButton->setEnabled(!filtersSetToDefault); - connect(clearFilterButton, SIGNAL(clicked()), this, SLOT(actClearFilter())); + connect(clearFilterButton, &QPushButton::clicked, this, &GameSelector::actClearFilter); if (room) { createButton = new QPushButton; - connect(createButton, SIGNAL(clicked()), this, SLOT(actCreate())); + connect(createButton, &QPushButton::clicked, this, &GameSelector::actCreate); } else { createButton = nullptr; } @@ -111,18 +111,15 @@ GameSelector::GameSelector(AbstractClient *_client, setMinimumWidth((qreal)(gameListView->columnWidth(0) * gameListModel->columnCount()) / 1.5); setMinimumHeight(200); - connect(joinButton, SIGNAL(clicked()), this, SLOT(actJoin())); - connect(spectateButton, SIGNAL(clicked()), this, SLOT(actJoin())); - connect(gameListView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, - SLOT(actSelectedGameChanged(const QModelIndex &, const QModelIndex &))); - connect(gameListView, SIGNAL(activated(const QModelIndex &)), this, SLOT(actJoin())); + connect(joinButton, &QPushButton::clicked, this, &GameSelector::actJoin); + connect(spectateButton, &QPushButton::clicked, this, &GameSelector::actJoin); + connect(gameListView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, + &GameSelector::actSelectedGameChanged); + connect(gameListView, &QTreeView::activated, this, &GameSelector::actJoin); - connect(client, SIGNAL(ignoreListReceived(const QList &)), this, - SLOT(ignoreListReceived(const QList &))); - connect(client, SIGNAL(addToListEventReceived(const Event_AddToList &)), this, - SLOT(processAddToListEvent(const Event_AddToList &))); - connect(client, SIGNAL(removeFromListEventReceived(const Event_RemoveFromList &)), this, - SLOT(processRemoveFromListEvent(const Event_RemoveFromList &))); + connect(client, &AbstractClient::ignoreListReceived, this, &GameSelector::ignoreListReceived); + connect(client, &AbstractClient::addToListEventReceived, this, &GameSelector::processAddToListEvent); + connect(client, &AbstractClient::removeFromListEventReceived, this, &GameSelector::processRemoveFromListEvent); } void GameSelector::ignoreListReceived(const QList &) @@ -196,7 +193,9 @@ void GameSelector::actCreate() updateTitle(); } -void GameSelector::checkResponse(const Response &response) +void GameSelector::checkResponse(const Response &response, + const CommandContainer & /* commandContainer */, + const QVariant & /* extraData */) { // NB: We re-enable buttons for the currently selected game, which may not // be the same game as the one for which we are processing a response. @@ -274,7 +273,8 @@ void GameSelector::actJoin() } PendingCommand *pend = r->prepareRoomCommand(cmd); - connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(checkResponse(Response))); + connect(pend, qOverload(&PendingCommand::finished), + this, &GameSelector::checkResponse); r->sendRoomCommand(pend); disableButtons(); diff --git a/cockatrice/src/game/game_selector.h b/cockatrice/src/game/game_selector.h index 57e204a01..e43c03692 100644 --- a/cockatrice/src/game/game_selector.h +++ b/cockatrice/src/game/game_selector.h @@ -6,6 +6,7 @@ #include #include #include +#include class QTreeView; class GamesModel; @@ -28,7 +29,7 @@ private slots: void actCreate(); void actJoin(); void actSelectedGameChanged(const QModelIndex ¤t, const QModelIndex &previous); - void checkResponse(const Response &response); + void checkResponse(const Response &response, const CommandContainer &, const QVariant &); void ignoreListReceived(const QList &_ignoreList); void processAddToListEvent(const Event_AddToList &event); diff --git a/cockatrice/src/game/game_view.cpp b/cockatrice/src/game/game_view.cpp index a17a903a4..7ce9dda3e 100644 --- a/cockatrice/src/game/game_view.cpp +++ b/cockatrice/src/game/game_view.cpp @@ -7,24 +7,25 @@ #include #include -GameView::GameView(QGraphicsScene *scene, QWidget *parent) : QGraphicsView(scene, parent), rubberBand(0) +GameView::GameView(GameScene *scene, QWidget *parent) : QGraphicsView(scene, parent), rubberBand(0) { setBackgroundBrush(QBrush(QColor(0, 0, 0))); setRenderHints(QPainter::TextAntialiasing | QPainter::Antialiasing); setFocusPolicy(Qt::NoFocus); setViewportUpdateMode(BoundingRectViewportUpdate); - connect(scene, SIGNAL(sceneRectChanged(const QRectF &)), this, SLOT(updateSceneRect(const QRectF &))); + connect(scene, &GameScene::sceneRectChanged, this, &GameView::updateSceneRect); - connect(scene, SIGNAL(sigStartRubberBand(const QPointF &)), this, SLOT(startRubberBand(const QPointF &))); - connect(scene, SIGNAL(sigResizeRubberBand(const QPointF &)), this, SLOT(resizeRubberBand(const QPointF &))); - connect(scene, SIGNAL(sigStopRubberBand()), this, SLOT(stopRubberBand())); + connect(scene, &GameScene::sigStartRubberBand, this, &GameView::startRubberBand); + connect(scene, &GameScene::sigResizeRubberBand, this, &GameView::resizeRubberBand); + connect(scene, &GameScene::sigStopRubberBand, this, &GameView::stopRubberBand); aCloseMostRecentZoneView = new QAction(this); - connect(aCloseMostRecentZoneView, SIGNAL(triggered()), scene, SLOT(closeMostRecentZoneView())); + connect(aCloseMostRecentZoneView, &QAction::triggered, scene, &GameScene::closeMostRecentZoneView); addAction(aCloseMostRecentZoneView); - connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts())); + connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this, + &GameView::refreshShortcuts); refreshShortcuts(); rubberBand = new QRubberBand(QRubberBand::Rectangle, this); } diff --git a/cockatrice/src/game/game_view.h b/cockatrice/src/game/game_view.h index e1ca517b3..89a669a9c 100644 --- a/cockatrice/src/game/game_view.h +++ b/cockatrice/src/game/game_view.h @@ -3,6 +3,7 @@ #include +class GameScene; class QRubberBand; class GameView : public QGraphicsView @@ -24,7 +25,7 @@ public slots: void updateSceneRect(const QRectF &rect); public: - GameView(QGraphicsScene *scene, QWidget *parent = nullptr); + GameView(GameScene *scene, QWidget *parent = nullptr); }; #endif diff --git a/cockatrice/src/game/player/player.cpp b/cockatrice/src/game/player/player.cpp index a120e4b4b..c7666c6a4 100644 --- a/cockatrice/src/game/player/player.cpp +++ b/cockatrice/src/game/player/player.cpp @@ -82,7 +82,7 @@ static constexpr int MOVE_TOP_CARD_UNTIL_INTERVAL = 100; PlayerArea::PlayerArea(QGraphicsItem *parentItem) : QObject(), QGraphicsItem(parentItem) { setCacheMode(DeviceCoordinateCache); - connect(themeManager, SIGNAL(themeChanged()), this, SLOT(updateBg())); + connect(themeManager, &ThemeManager::themeChanged, this, &PlayerArea::updateBg); updateBg(); } @@ -121,8 +121,8 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T userInfo = new ServerInfo_User; userInfo->CopyFrom(info); - connect(&SettingsCache::instance(), SIGNAL(horizontalHandChanged()), this, SLOT(rearrangeZones())); - connect(&SettingsCache::instance(), SIGNAL(handJustificationChanged()), this, SLOT(rearrangeZones())); + connect(&SettingsCache::instance(), &SettingsCache::horizontalHandChanged, this, &Player::rearrangeZones); + connect(&SettingsCache::instance(), &SettingsCache::handJustificationChanged, this, &Player::rearrangeZones); playerArea = new PlayerArea(this); @@ -151,20 +151,20 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T sb->setVisible(false); table = new TableZone(this, this); - connect(table, SIGNAL(sizeChanged()), this, SLOT(updateBoundingRect())); + connect(table, &TableZone::sizeChanged, this, &Player::updateBoundingRect); stack = new StackZone(this, (int)table->boundingRect().height(), this); hand = new HandZone(this, _local || _judge || (_parent->getSpectator() && _parent->getSpectatorsSeeEverything()), (int)table->boundingRect().height(), this); - connect(hand, SIGNAL(cardCountChanged()), handCounter, SLOT(updateNumber())); - connect(handCounter, SIGNAL(showContextMenu(const QPoint &)), hand, SLOT(showContextMenu(const QPoint &))); + connect(hand, &HandZone::cardCountChanged, handCounter, &HandCounter::updateNumber); + connect(handCounter, &HandCounter::showContextMenu, hand, &HandZone::showContextMenu); updateBoundingRect(); if (local || judge) { - connect(_parent, SIGNAL(playerAdded(Player *)), this, SLOT(addPlayer(Player *))); - connect(_parent, SIGNAL(playerRemoved(Player *)), this, SLOT(removePlayer(Player *))); + connect(_parent, &TabGame::playerAdded, this, &Player::addPlayer); + connect(_parent, &TabGame::playerRemoved, this, &Player::removePlayer); } if (local || judge) { @@ -177,10 +177,10 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T aMoveHandToRfg = new QAction(this); aMoveHandToRfg->setData(QList() << "rfg" << 0); - connect(aMoveHandToTopLibrary, SIGNAL(triggered()), hand, SLOT(moveAllToZone())); - connect(aMoveHandToBottomLibrary, SIGNAL(triggered()), hand, SLOT(moveAllToZone())); - connect(aMoveHandToGrave, SIGNAL(triggered()), hand, SLOT(moveAllToZone())); - connect(aMoveHandToRfg, SIGNAL(triggered()), hand, SLOT(moveAllToZone())); + connect(aMoveHandToTopLibrary, &QAction::triggered, hand, &HandZone::moveAllToZone); + connect(aMoveHandToBottomLibrary, &QAction::triggered, hand, &HandZone::moveAllToZone); + connect(aMoveHandToGrave, &QAction::triggered, hand, &HandZone::moveAllToZone); + connect(aMoveHandToRfg, &QAction::triggered, hand, &HandZone::moveAllToZone); aMoveGraveToTopLibrary = new QAction(this); aMoveGraveToTopLibrary->setData(QList() << "deck" << 0); @@ -191,10 +191,10 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T aMoveGraveToRfg = new QAction(this); aMoveGraveToRfg->setData(QList() << "rfg" << 0); - connect(aMoveGraveToTopLibrary, SIGNAL(triggered()), grave, SLOT(moveAllToZone())); - connect(aMoveGraveToBottomLibrary, SIGNAL(triggered()), grave, SLOT(moveAllToZone())); - connect(aMoveGraveToHand, SIGNAL(triggered()), grave, SLOT(moveAllToZone())); - connect(aMoveGraveToRfg, SIGNAL(triggered()), grave, SLOT(moveAllToZone())); + connect(aMoveGraveToTopLibrary, &QAction::triggered, grave, &PileZone::moveAllToZone); + connect(aMoveGraveToBottomLibrary, &QAction::triggered, grave, &PileZone::moveAllToZone); + connect(aMoveGraveToHand, &QAction::triggered, grave, &PileZone::moveAllToZone); + connect(aMoveGraveToRfg, &QAction::triggered, grave, &PileZone::moveAllToZone); aMoveRfgToTopLibrary = new QAction(this); aMoveRfgToTopLibrary->setData(QList() << "deck" << 0); @@ -205,87 +205,87 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T aMoveRfgToGrave = new QAction(this); aMoveRfgToGrave->setData(QList() << "grave" << 0); - connect(aMoveRfgToTopLibrary, SIGNAL(triggered()), rfg, SLOT(moveAllToZone())); - connect(aMoveRfgToBottomLibrary, SIGNAL(triggered()), rfg, SLOT(moveAllToZone())); - connect(aMoveRfgToHand, SIGNAL(triggered()), rfg, SLOT(moveAllToZone())); - connect(aMoveRfgToGrave, SIGNAL(triggered()), rfg, SLOT(moveAllToZone())); + connect(aMoveRfgToTopLibrary, &QAction::triggered, rfg, &PileZone::moveAllToZone); + connect(aMoveRfgToBottomLibrary, &QAction::triggered, rfg, &PileZone::moveAllToZone); + connect(aMoveRfgToHand, &QAction::triggered, rfg, &PileZone::moveAllToZone); + connect(aMoveRfgToGrave, &QAction::triggered, rfg, &PileZone::moveAllToZone); aViewLibrary = new QAction(this); - connect(aViewLibrary, SIGNAL(triggered()), this, SLOT(actViewLibrary())); + connect(aViewLibrary, &QAction::triggered, this, &Player::actViewLibrary); aViewHand = new QAction(this); - connect(aViewHand, SIGNAL(triggered()), this, SLOT(actViewHand())); + connect(aViewHand, &QAction::triggered, this, &Player::actViewHand); aViewTopCards = new QAction(this); - connect(aViewTopCards, SIGNAL(triggered()), this, SLOT(actViewTopCards())); + connect(aViewTopCards, &QAction::triggered, this, &Player::actViewTopCards); aViewBottomCards = new QAction(this); connect(aViewBottomCards, &QAction::triggered, this, &Player::actViewBottomCards); aAlwaysRevealTopCard = new QAction(this); aAlwaysRevealTopCard->setCheckable(true); - connect(aAlwaysRevealTopCard, SIGNAL(triggered()), this, SLOT(actAlwaysRevealTopCard())); + connect(aAlwaysRevealTopCard, &QAction::triggered, this, &Player::actAlwaysRevealTopCard); aAlwaysLookAtTopCard = new QAction(this); aAlwaysLookAtTopCard->setCheckable(true); - connect(aAlwaysLookAtTopCard, SIGNAL(triggered()), this, SLOT(actAlwaysLookAtTopCard())); + connect(aAlwaysLookAtTopCard, &QAction::triggered, this, &Player::actAlwaysLookAtTopCard); aOpenDeckInDeckEditor = new QAction(this); aOpenDeckInDeckEditor->setEnabled(false); - connect(aOpenDeckInDeckEditor, SIGNAL(triggered()), this, SLOT(actOpenDeckInDeckEditor())); + connect(aOpenDeckInDeckEditor, &QAction::triggered, this, &Player::actOpenDeckInDeckEditor); } aViewGraveyard = new QAction(this); - connect(aViewGraveyard, SIGNAL(triggered()), this, SLOT(actViewGraveyard())); + connect(aViewGraveyard, &QAction::triggered, this, &Player::actViewGraveyard); aViewRfg = new QAction(this); - connect(aViewRfg, SIGNAL(triggered()), this, SLOT(actViewRfg())); + connect(aViewRfg, &QAction::triggered, this, &Player::actViewRfg); if (local || judge) { aViewSideboard = new QAction(this); - connect(aViewSideboard, SIGNAL(triggered()), this, SLOT(actViewSideboard())); + connect(aViewSideboard, &QAction::triggered, this, &Player::actViewSideboard); aDrawCard = new QAction(this); - connect(aDrawCard, SIGNAL(triggered()), this, SLOT(actDrawCard())); + connect(aDrawCard, &QAction::triggered, this, &Player::actDrawCard); aDrawCards = new QAction(this); - connect(aDrawCards, SIGNAL(triggered()), this, SLOT(actDrawCards())); + connect(aDrawCards, &QAction::triggered, this, &Player::actDrawCards); aUndoDraw = new QAction(this); - connect(aUndoDraw, SIGNAL(triggered()), this, SLOT(actUndoDraw())); + connect(aUndoDraw, &QAction::triggered, this, &Player::actUndoDraw); aShuffle = new QAction(this); - connect(aShuffle, SIGNAL(triggered()), this, SLOT(actShuffle())); + connect(aShuffle, &QAction::triggered, this, &Player::actShuffle); aMulligan = new QAction(this); - connect(aMulligan, SIGNAL(triggered()), this, SLOT(actMulligan())); + connect(aMulligan, &QAction::triggered, this, &Player::actMulligan); aMoveTopToPlay = new QAction(this); - connect(aMoveTopToPlay, SIGNAL(triggered()), this, SLOT(actMoveTopCardToPlay())); + connect(aMoveTopToPlay, &QAction::triggered, this, &Player::actMoveTopCardToPlay); aMoveTopToPlayFaceDown = new QAction(this); - connect(aMoveTopToPlayFaceDown, SIGNAL(triggered()), this, SLOT(actMoveTopCardToPlayFaceDown())); + connect(aMoveTopToPlayFaceDown, &QAction::triggered, this, &Player::actMoveTopCardToPlayFaceDown); aMoveTopCardToGraveyard = new QAction(this); - connect(aMoveTopCardToGraveyard, SIGNAL(triggered()), this, SLOT(actMoveTopCardToGrave())); + connect(aMoveTopCardToGraveyard, &QAction::triggered, this, &Player::actMoveTopCardToGrave); aMoveTopCardToExile = new QAction(this); - connect(aMoveTopCardToExile, SIGNAL(triggered()), this, SLOT(actMoveTopCardToExile())); + connect(aMoveTopCardToExile, &QAction::triggered, this, &Player::actMoveTopCardToExile); aMoveTopCardsToGraveyard = new QAction(this); - connect(aMoveTopCardsToGraveyard, SIGNAL(triggered()), this, SLOT(actMoveTopCardsToGrave())); + connect(aMoveTopCardsToGraveyard, &QAction::triggered, this, &Player::actMoveTopCardsToGrave); aMoveTopCardsToExile = new QAction(this); - connect(aMoveTopCardsToExile, SIGNAL(triggered()), this, SLOT(actMoveTopCardsToExile())); + connect(aMoveTopCardsToExile, &QAction::triggered, this, &Player::actMoveTopCardsToExile); aMoveTopCardsUntil = new QAction(this); - connect(aMoveTopCardsUntil, SIGNAL(triggered()), this, SLOT(actMoveTopCardsUntil())); + connect(aMoveTopCardsUntil, &QAction::triggered, this, &Player::actMoveTopCardsUntil); aMoveTopCardToBottom = new QAction(this); - connect(aMoveTopCardToBottom, SIGNAL(triggered()), this, SLOT(actMoveTopCardToBottom())); + connect(aMoveTopCardToBottom, &QAction::triggered, this, &Player::actMoveTopCardToBottom); aDrawBottomCard = new QAction(this); - connect(aDrawBottomCard, SIGNAL(triggered()), this, SLOT(actDrawBottomCard())); + connect(aDrawBottomCard, &QAction::triggered, this, &Player::actDrawBottomCard); aDrawBottomCards = new QAction(this); - connect(aDrawBottomCards, SIGNAL(triggered()), this, SLOT(actDrawBottomCards())); + connect(aDrawBottomCards, &QAction::triggered, this, &Player::actDrawBottomCards); aMoveBottomToPlay = new QAction(this); - connect(aMoveBottomToPlay, SIGNAL(triggered()), this, SLOT(actMoveBottomCardToPlay())); + connect(aMoveBottomToPlay, &QAction::triggered, this, &Player::actMoveBottomCardToPlay); aMoveBottomToPlayFaceDown = new QAction(this); - connect(aMoveBottomToPlayFaceDown, SIGNAL(triggered()), this, SLOT(actMoveBottomCardToPlayFaceDown())); + connect(aMoveBottomToPlayFaceDown, &QAction::triggered, this, &Player::actMoveBottomCardToPlayFaceDown); aMoveBottomCardToGraveyard = new QAction(this); - connect(aMoveBottomCardToGraveyard, SIGNAL(triggered()), this, SLOT(actMoveBottomCardToGrave())); + connect(aMoveBottomCardToGraveyard, &QAction::triggered, this, &Player::actMoveBottomCardToGrave); aMoveBottomCardToExile = new QAction(this); - connect(aMoveBottomCardToExile, SIGNAL(triggered()), this, SLOT(actMoveBottomCardToExile())); + connect(aMoveBottomCardToExile, &QAction::triggered, this, &Player::actMoveBottomCardToExile); aMoveBottomCardsToGraveyard = new QAction(this); - connect(aMoveBottomCardsToGraveyard, SIGNAL(triggered()), this, SLOT(actMoveBottomCardsToGrave())); + connect(aMoveBottomCardsToGraveyard, &QAction::triggered, this, &Player::actMoveBottomCardsToGrave); aMoveBottomCardsToExile = new QAction(this); - connect(aMoveBottomCardsToExile, SIGNAL(triggered()), this, SLOT(actMoveBottomCardsToExile())); + connect(aMoveBottomCardsToExile, &QAction::triggered, this, &Player::actMoveBottomCardsToExile); aMoveBottomCardToTop = new QAction(this); - connect(aMoveBottomCardToTop, SIGNAL(triggered()), this, SLOT(actMoveBottomCardToTop())); + connect(aMoveBottomCardToTop, &QAction::triggered, this, &Player::actMoveBottomCardToTop); } playerMenu = new TearOffMenu(); @@ -361,7 +361,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T mRevealRandomGraveyardCard = graveMenu->addMenu(QString()); QAction *newAction = mRevealRandomGraveyardCard->addAction(QString()); newAction->setData(-1); - connect(newAction, SIGNAL(triggered()), this, SLOT(actRevealRandomGraveyardCard())); + connect(newAction, &QAction::triggered, this, &Player::actRevealRandomGraveyardCard); allPlayersActions.append(newAction); mRevealRandomGraveyardCard->addSeparator(); } @@ -395,16 +395,16 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T sb->setMenu(sbMenu, aViewSideboard); aUntapAll = new QAction(this); - connect(aUntapAll, SIGNAL(triggered()), this, SLOT(actUntapAll())); + connect(aUntapAll, &QAction::triggered, this, &Player::actUntapAll); aRollDie = new QAction(this); - connect(aRollDie, SIGNAL(triggered()), this, SLOT(actRollDie())); + connect(aRollDie, &QAction::triggered, this, &Player::actRollDie); aCreateToken = new QAction(this); - connect(aCreateToken, SIGNAL(triggered()), this, SLOT(actCreateToken())); + connect(aCreateToken, &QAction::triggered, this, &Player::actCreateToken); aCreateAnotherToken = new QAction(this); - connect(aCreateAnotherToken, SIGNAL(triggered()), this, SLOT(actCreateAnotherToken())); + connect(aCreateAnotherToken, &QAction::triggered, this, &Player::actCreateAnotherToken); aCreateAnotherToken->setEnabled(false); createPredefinedTokenMenu = new QMenu(QString()); @@ -425,7 +425,8 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T if (local) { sayMenu = playerMenu->addMenu(QString()); - connect(&SettingsCache::instance().messages(), SIGNAL(messageMacrosChanged()), this, SLOT(initSayMenu())); + connect(&SettingsCache::instance().messages(), &MessageSettings::messageMacrosChanged, this, + &Player::initSayMenu); initSayMenu(); } @@ -439,7 +440,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T for (auto &playerList : playerLists) { QAction *newAction = playerList->addAction(QString()); newAction->setData(-1); - connect(newAction, SIGNAL(triggered()), this, SLOT(playerListActionTriggered())); + connect(newAction, &QAction::triggered, this, &Player::playerListActionTriggered); allPlayersActions.append(newAction); playerList->addSeparator(); } @@ -454,47 +455,47 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T aTap = new QAction(this); aTap->setData(cmTap); - connect(aTap, SIGNAL(triggered()), this, SLOT(cardMenuAction())); + connect(aTap, &QAction::triggered, this, &Player::cardMenuAction); aDoesntUntap = new QAction(this); aDoesntUntap->setData(cmDoesntUntap); - connect(aDoesntUntap, SIGNAL(triggered()), this, SLOT(cardMenuAction())); + connect(aDoesntUntap, &QAction::triggered, this, &Player::cardMenuAction); aAttach = new QAction(this); - connect(aAttach, SIGNAL(triggered()), this, SLOT(actAttach())); + connect(aAttach, &QAction::triggered, this, &Player::actAttach); aUnattach = new QAction(this); - connect(aUnattach, SIGNAL(triggered()), this, SLOT(actUnattach())); + connect(aUnattach, &QAction::triggered, this, &Player::actUnattach); aDrawArrow = new QAction(this); - connect(aDrawArrow, SIGNAL(triggered()), this, SLOT(actDrawArrow())); + connect(aDrawArrow, &QAction::triggered, this, &Player::actDrawArrow); aIncP = new QAction(this); - connect(aIncP, SIGNAL(triggered()), this, SLOT(actIncP())); + connect(aIncP, &QAction::triggered, this, &Player::actIncP); aDecP = new QAction(this); - connect(aDecP, SIGNAL(triggered()), this, SLOT(actDecP())); + connect(aDecP, &QAction::triggered, this, &Player::actDecP); aIncT = new QAction(this); - connect(aIncT, SIGNAL(triggered()), this, SLOT(actIncT())); + connect(aIncT, &QAction::triggered, this, &Player::actIncT); aDecT = new QAction(this); - connect(aDecT, SIGNAL(triggered()), this, SLOT(actDecT())); + connect(aDecT, &QAction::triggered, this, &Player::actDecT); aIncPT = new QAction(this); - connect(aIncPT, SIGNAL(triggered()), this, SLOT(actIncPT())); + connect(aIncPT, &QAction::triggered, this, [this] { actIncPT(); }); aDecPT = new QAction(this); - connect(aDecPT, SIGNAL(triggered()), this, SLOT(actDecPT())); + connect(aDecPT, &QAction::triggered, this, &Player::actDecPT); aFlowP = new QAction(this); - connect(aFlowP, SIGNAL(triggered()), this, SLOT(actFlowP())); + connect(aFlowP, &QAction::triggered, this, &Player::actFlowP); aFlowT = new QAction(this); - connect(aFlowT, SIGNAL(triggered()), this, SLOT(actFlowT())); + connect(aFlowT, &QAction::triggered, this, &Player::actFlowT); aSetPT = new QAction(this); - connect(aSetPT, SIGNAL(triggered()), this, SLOT(actSetPT())); + connect(aSetPT, &QAction::triggered, this, &Player::actSetPT); aResetPT = new QAction(this); - connect(aResetPT, SIGNAL(triggered()), this, SLOT(actResetPT())); + connect(aResetPT, &QAction::triggered, this, &Player::actResetPT); aSetAnnotation = new QAction(this); - connect(aSetAnnotation, SIGNAL(triggered()), this, SLOT(actSetAnnotation())); + connect(aSetAnnotation, &QAction::triggered, this, &Player::actSetAnnotation); aFlip = new QAction(this); aFlip->setData(cmFlip); - connect(aFlip, SIGNAL(triggered()), this, SLOT(cardMenuAction())); + connect(aFlip, &QAction::triggered, this, &Player::cardMenuAction); aPeek = new QAction(this); aPeek->setData(cmPeek); - connect(aPeek, SIGNAL(triggered()), this, SLOT(cardMenuAction())); + connect(aPeek, &QAction::triggered, this, &Player::cardMenuAction); aClone = new QAction(this); aClone->setData(cmClone); - connect(aClone, SIGNAL(triggered()), this, SLOT(cardMenuAction())); + connect(aClone, &QAction::triggered, this, &Player::cardMenuAction); aMoveToTopLibrary = new QAction(this); aMoveToTopLibrary->setData(cmMoveToTopLibrary); aMoveToBottomLibrary = new QAction(this); @@ -506,26 +507,26 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T aMoveToGraveyard->setData(cmMoveToGraveyard); aMoveToExile = new QAction(this); aMoveToExile->setData(cmMoveToExile); - connect(aMoveToTopLibrary, SIGNAL(triggered()), this, SLOT(cardMenuAction())); - connect(aMoveToBottomLibrary, SIGNAL(triggered()), this, SLOT(cardMenuAction())); - connect(aMoveToXfromTopOfLibrary, SIGNAL(triggered()), this, SLOT(actMoveCardXCardsFromTop())); - connect(aMoveToHand, SIGNAL(triggered()), this, SLOT(cardMenuAction())); - connect(aMoveToGraveyard, SIGNAL(triggered()), this, SLOT(cardMenuAction())); - connect(aMoveToExile, SIGNAL(triggered()), this, SLOT(cardMenuAction())); + connect(aMoveToTopLibrary, &QAction::triggered, this, &Player::cardMenuAction); + connect(aMoveToBottomLibrary, &QAction::triggered, this, &Player::cardMenuAction); + connect(aMoveToXfromTopOfLibrary, &QAction::triggered, this, &Player::actMoveCardXCardsFromTop); + connect(aMoveToHand, &QAction::triggered, this, &Player::cardMenuAction); + connect(aMoveToGraveyard, &QAction::triggered, this, &Player::cardMenuAction); + connect(aMoveToExile, &QAction::triggered, this, &Player::cardMenuAction); aSelectAll = new QAction(this); - connect(aSelectAll, SIGNAL(triggered()), this, SLOT(actSelectAll())); + connect(aSelectAll, &QAction::triggered, this, &Player::actSelectAll); aSelectRow = new QAction(this); - connect(aSelectRow, SIGNAL(triggered()), this, SLOT(actSelectRow())); + connect(aSelectRow, &QAction::triggered, this, &Player::actSelectRow); aSelectColumn = new QAction(this); - connect(aSelectColumn, SIGNAL(triggered()), this, SLOT(actSelectColumn())); + connect(aSelectColumn, &QAction::triggered, this, &Player::actSelectColumn); aPlay = new QAction(this); - connect(aPlay, SIGNAL(triggered()), this, SLOT(actPlay())); + connect(aPlay, &QAction::triggered, this, &Player::actPlay); aHide = new QAction(this); - connect(aHide, SIGNAL(triggered()), this, SLOT(actHide())); + connect(aHide, &QAction::triggered, this, &Player::actHide); aPlayFacedown = new QAction(this); - connect(aPlayFacedown, SIGNAL(triggered()), this, SLOT(actPlayFacedown())); + connect(aPlayFacedown, &QAction::triggered, this, &Player::actPlayFacedown); for (int i = 0; i < 3; ++i) { auto *tempAddCounter = new QAction(this); @@ -537,9 +538,9 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T aAddCounter.append(tempAddCounter); aRemoveCounter.append(tempRemoveCounter); aSetCounter.append(tempSetCounter); - connect(tempAddCounter, SIGNAL(triggered()), this, SLOT(actCardCounterTrigger())); - connect(tempRemoveCounter, SIGNAL(triggered()), this, SLOT(actCardCounterTrigger())); - connect(tempSetCounter, SIGNAL(triggered()), this, SLOT(actCardCounterTrigger())); + connect(tempAddCounter, &QAction::triggered, this, &Player::actCardCounterTrigger); + connect(tempRemoveCounter, &QAction::triggered, this, &Player::actCardCounterTrigger); + connect(tempSetCounter, &QAction::triggered, this, &Player::actCardCounterTrigger); } const QList &players = game->getPlayers().values(); @@ -554,7 +555,8 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T rearrangeZones(); retranslateUi(); - connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts())); + connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this, + &Player::refreshShortcuts); refreshShortcuts(); } @@ -606,7 +608,7 @@ void Player::addPlayerToList(QMenu *playerList, Player *player) { QAction *newAction = playerList->addAction(player->getName()); newAction->setData(player->getId()); - connect(newAction, SIGNAL(triggered()), this, SLOT(playerListActionTriggered())); + connect(newAction, &QAction::triggered, this, &Player::playerListActionTriggered); } void Player::removePlayer(Player *player) @@ -1070,7 +1072,7 @@ void Player::initSayMenu() if (i < 10) { newAction->setShortcut(QKeySequence("Ctrl+" + QString::number((i + 1) % 10))); } - connect(newAction, SIGNAL(triggered()), this, SLOT(actSayMessage())); + connect(newAction, &QAction::triggered, this, &Player::actSayMessage); sayMenu->addAction(newAction); } } @@ -1106,7 +1108,7 @@ void Player::setDeck(const DeckLoader &_deck) if (i < 10) { a->setShortcut(QKeySequence("Alt+" + QString::number((i + 1) % 10))); } - connect(a, SIGNAL(triggered()), this, SLOT(actCreatePredefinedToken())); + connect(a, &QAction::triggered, this, &Player::actCreatePredefinedToken); } } } @@ -3997,7 +3999,7 @@ void Player::addRelatedCardActions(const CardItem *card, QMenu *cardMenu) auto *createRelated = new QAction(text, this); createRelated->setData(QVariant(index++)); - connect(createRelated, SIGNAL(triggered()), this, SLOT(actCreateRelatedCard())); + connect(createRelated, &QAction::triggered, this, &Player::actCreateRelatedCard); cardMenu->addAction(createRelated); } @@ -4006,7 +4008,7 @@ void Player::addRelatedCardActions(const CardItem *card, QMenu *cardMenu) createRelatedCards->setShortcut( SettingsCache::instance().shortcuts().getSingleShortcut("Player/aCreateRelatedTokens")); } - connect(createRelatedCards, SIGNAL(triggered()), this, SLOT(actCreateAllRelatedCards())); + connect(createRelatedCards, &QAction::triggered, this, &Player::actCreateAllRelatedCards); cardMenu->addAction(createRelatedCards); } } diff --git a/cockatrice/src/game/player/player_list_widget.cpp b/cockatrice/src/game/player/player_list_widget.cpp index 951f00afb..ef63c9dc0 100644 --- a/cockatrice/src/game/player/player_list_widget.cpp +++ b/cockatrice/src/game/player/player_list_widget.cpp @@ -72,8 +72,7 @@ PlayerListWidget::PlayerListWidget(TabSupervisor *_tabSupervisor, setItemDelegate(itemDelegate); userContextMenu = new UserContextMenu(tabSupervisor, this, game); - connect(userContextMenu, SIGNAL(openMessageDialog(QString, bool)), this, - SIGNAL(openMessageDialog(QString, bool))); + connect(userContextMenu, &UserContextMenu::openMessageDialog, this, &PlayerListWidget::openMessageDialog); } else { userContextMenu = nullptr; } diff --git a/cockatrice/src/game/player/player_target.cpp b/cockatrice/src/game/player/player_target.cpp index 699097c38..a4542225b 100644 --- a/cockatrice/src/game/player/player_target.cpp +++ b/cockatrice/src/game/player/player_target.cpp @@ -158,7 +158,7 @@ AbstractCounter *PlayerTarget::addCounter(int _counterId, const QString &_name, playerCounter = new PlayerCounter(owner, _counterId, _name, _value, this, game); playerCounter->setPos(boundingRect().width() - playerCounter->boundingRect().width(), boundingRect().height() - playerCounter->boundingRect().height()); - connect(playerCounter, SIGNAL(destroyed()), this, SLOT(counterDeleted())); + connect(playerCounter, &PlayerCounter::destroyed, this, &PlayerTarget::counterDeleted); return playerCounter; } diff --git a/cockatrice/src/game/zones/hand_zone.cpp b/cockatrice/src/game/zones/hand_zone.cpp index 5b6932902..896e9b60f 100644 --- a/cockatrice/src/game/zones/hand_zone.cpp +++ b/cockatrice/src/game/zones/hand_zone.cpp @@ -12,7 +12,7 @@ HandZone::HandZone(Player *_p, bool _contentsKnown, int _zoneHeight, QGraphicsItem *parent) : SelectZone(_p, "hand", false, false, _contentsKnown, parent), zoneHeight(_zoneHeight) { - connect(themeManager, SIGNAL(themeChanged()), this, SLOT(updateBg())); + connect(themeManager, &ThemeManager::themeChanged, this, &HandZone::updateBg); updateBg(); setCacheMode(DeviceCoordinateCache); } diff --git a/cockatrice/src/game/zones/pile_zone.cpp b/cockatrice/src/game/zones/pile_zone.cpp index 244e137d7..08ee3d28e 100644 --- a/cockatrice/src/game/zones/pile_zone.cpp +++ b/cockatrice/src/game/zones/pile_zone.cpp @@ -50,7 +50,7 @@ void PileZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*optio void PileZone::addCardImpl(CardItem *card, int x, int /*y*/) { - connect(card, SIGNAL(sigPixmapUpdated()), this, SLOT(callUpdate())); + connect(card, &CardItem::sigPixmapUpdated, this, &PileZone::callUpdate); // if x is negative set it to add at end if (x < 0 || x >= cards.size()) { x = cards.size(); diff --git a/cockatrice/src/game/zones/stack_zone.cpp b/cockatrice/src/game/zones/stack_zone.cpp index 99413cb20..f6951f1ab 100644 --- a/cockatrice/src/game/zones/stack_zone.cpp +++ b/cockatrice/src/game/zones/stack_zone.cpp @@ -14,7 +14,7 @@ StackZone::StackZone(Player *_p, int _zoneHeight, QGraphicsItem *parent) : SelectZone(_p, "stack", false, false, true, parent), zoneHeight(_zoneHeight) { - connect(themeManager, SIGNAL(themeChanged()), this, SLOT(updateBg())); + connect(themeManager, &ThemeManager::themeChanged, this, &StackZone::updateBg); updateBg(); setCacheMode(DeviceCoordinateCache); } diff --git a/cockatrice/src/game/zones/table_zone.cpp b/cockatrice/src/game/zones/table_zone.cpp index 0aace73ca..ee1d0219d 100644 --- a/cockatrice/src/game/zones/table_zone.cpp +++ b/cockatrice/src/game/zones/table_zone.cpp @@ -22,8 +22,9 @@ const QColor TableZone::GRADIENT_COLORLESS = QColor(255, 255, 255, 0); TableZone::TableZone(Player *_p, QGraphicsItem *parent) : SelectZone(_p, "table", true, false, true, parent), active(false) { - connect(themeManager, SIGNAL(themeChanged()), this, SLOT(updateBg())); - connect(&SettingsCache::instance(), SIGNAL(invertVerticalCoordinateChanged()), this, SLOT(reorganizeCards())); + connect(themeManager, &ThemeManager::themeChanged, this, &TableZone::updateBg); + connect(&SettingsCache::instance(), &SettingsCache::invertVerticalCoordinateChanged, this, + &TableZone::reorganizeCards); updateBg(); diff --git a/cockatrice/src/game/zones/view_zone.cpp b/cockatrice/src/game/zones/view_zone.cpp index 215fb2bf9..298f37f57 100644 --- a/cockatrice/src/game/zones/view_zone.cpp +++ b/cockatrice/src/game/zones/view_zone.cpp @@ -77,8 +77,9 @@ void ZoneViewZone::initializeCards(const QList &cardLis cmd.set_is_reversed(isReversed); PendingCommand *pend = player->prepareGameCommand(cmd); - connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, - SLOT(zoneDumpReceived(const Response &))); + connect(pend, + qOverload(&PendingCommand::finished), + this, &ZoneViewZone::zoneDumpReceived); player->sendGameCommand(pend); } else { const CardList &c = origZone->getCards(); @@ -92,7 +93,9 @@ void ZoneViewZone::initializeCards(const QList &cardLis } } -void ZoneViewZone::zoneDumpReceived(const Response &r) +void ZoneViewZone::zoneDumpReceived(const Response &r, + const CommandContainer & /* commandContainer */, + const QVariant & /* extraData */) { const Response_DumpZone &resp = r.GetExtension(Response_DumpZone::ext); const int respCardListSize = resp.zone_info().card_list_size(); diff --git a/cockatrice/src/game/zones/view_zone.h b/cockatrice/src/game/zones/view_zone.h index 4780d73d1..d5c3233c4 100644 --- a/cockatrice/src/game/zones/view_zone.h +++ b/cockatrice/src/game/zones/view_zone.h @@ -4,6 +4,7 @@ #include "select_zone.h" #include +#include class ZoneViewWidget; class Response; @@ -94,7 +95,7 @@ public slots: void setSortBy(CardList::SortOption _sortBy); void setPileView(int _pileView); private slots: - void zoneDumpReceived(const Response &r); + void zoneDumpReceived(const Response &r, const CommandContainer &, const QVariant &); signals: void beingDeleted(); void optimumRectChanged(); diff --git a/cockatrice/src/game/zones/view_zone_widget.cpp b/cockatrice/src/game/zones/view_zone_widget.cpp index f1e96c532..4bc596531 100644 --- a/cockatrice/src/game/zones/view_zone_widget.cpp +++ b/cockatrice/src/game/zones/view_zone_widget.cpp @@ -110,8 +110,7 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, zone = new ZoneViewZone(player, _origZone, numberCards, _revealZone, _writeableRevealZone, zoneContainer, _isReversed); - connect(zone, SIGNAL(wheelEventReceived(QGraphicsSceneWheelEvent *)), scrollBarProxy, - SLOT(recieveWheelEvent(QGraphicsSceneWheelEvent *))); + connect(zone, &ZoneViewZone::wheelEventReceived, scrollBarProxy, &ScrollableGraphicsProxyWidget::recieveWheelEvent); retranslateUi(); @@ -133,8 +132,8 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, setLayout(vbox); - connect(zone, SIGNAL(optimumRectChanged()), this, SLOT(resizeToZoneContents())); - connect(zone, SIGNAL(beingDeleted()), this, SLOT(zoneDeleted())); + connect(zone, &ZoneViewZone::optimumRectChanged, this, &ZoneViewWidget::resizeToZoneContents); + connect(zone, &ZoneViewZone::beingDeleted, this, &ZoneViewWidget::zoneDeleted); zone->initializeCards(cardList); // QLabel sizes aren't taken into account until the widget is rendered. @@ -315,7 +314,7 @@ void ZoneViewWidget::handleScrollBarChange(int value) void ZoneViewWidget::closeEvent(QCloseEvent *event) { - disconnect(zone, SIGNAL(beingDeleted()), this, 0); + disconnect(zone, &ZoneViewZone::beingDeleted, this, 0); if (shuffleCheckBox.isChecked()) player->sendGameCommand(Command_Shuffle()); emit closePressed(this);