Refactor files in src/game to new Qt Slot/Signal syntax (#5431)

* fix signals in CardDatabaseParser

* update remaining signals

* cleanup

* wait this was always just broken

* fix build failure

* fix build failure

* fix build failure
This commit is contained in:
RickyRister 2025-01-09 03:32:25 -08:00 committed by GitHub
parent 6e8adddc6d
commit c3421669d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 180 additions and 181 deletions

View file

@ -36,7 +36,7 @@ AbstractCounter::AbstractCounter(Player *_player,
QString displayName = TranslateCounterName::getDisplayName(_name); QString displayName = TranslateCounterName::getDisplayName(_name);
menu = new TearOffMenu(displayName); menu = new TearOffMenu(displayName);
aSet = new QAction(this); aSet = new QAction(this);
connect(aSet, SIGNAL(triggered()), this, SLOT(setCounter())); connect(aSet, &QAction::triggered, this, &AbstractCounter::setCounter);
menu->addAction(aSet); menu->addAction(aSet);
menu->addSeparator(); menu->addSeparator();
for (int i = 10; i >= -10; --i) { for (int i = 10; i >= -10; --i) {
@ -49,7 +49,7 @@ AbstractCounter::AbstractCounter(Player *_player,
else if (i == 1) else if (i == 1)
aInc = aIncrement; aInc = aIncrement;
aIncrement->setData(i); aIncrement->setData(i);
connect(aIncrement, SIGNAL(triggered()), this, SLOT(incrementCounter())); connect(aIncrement, &QAction::triggered, this, &AbstractCounter::incrementCounter);
menu->addAction(aIncrement); menu->addAction(aIncrement);
} }
} }
@ -57,7 +57,8 @@ AbstractCounter::AbstractCounter(Player *_player,
menu = nullptr; menu = nullptr;
} }
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts())); connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
&AbstractCounter::refreshShortcuts);
refreshShortcuts(); refreshShortcuts();
retranslateUi(); retranslateUi();
} }

View file

@ -24,7 +24,7 @@ AbstractCardItem::AbstractCardItem(QGraphicsItem *parent,
setFlag(ItemIsSelectable); setFlag(ItemIsSelectable);
setCacheMode(DeviceCoordinateCache); setCacheMode(DeviceCoordinateCache);
connect(&SettingsCache::instance(), SIGNAL(displayCardNamesChanged()), this, SLOT(callUpdate())); connect(&SettingsCache::instance(), &SettingsCache::displayCardNamesChanged, this, [this] { update(); });
refreshCardInfo(); refreshCardInfo();
} }
@ -62,7 +62,7 @@ void AbstractCardItem::refreshCardInfo()
CardInfoPerSetMap(), false, false, -1, false); CardInfoPerSetMap(), false, false, -1, false);
} }
if (info.data()) { if (info.data()) {
connect(info.data(), SIGNAL(pixmapUpdated()), this, SLOT(pixmapUpdated())); connect(info.data(), &CardInfo::pixmapUpdated, this, &AbstractCardItem::pixmapUpdated);
} }
cacheBgColor(); cacheBgColor();

View file

@ -28,10 +28,6 @@ private:
qreal realZValue; qreal realZValue;
private slots: private slots:
void pixmapUpdated(); void pixmapUpdated();
void callUpdate()
{
update();
}
public slots: public slots:
void refreshCardInfo(); void refreshCardInfo();

View file

@ -375,11 +375,12 @@ CardDatabase::CardDatabase(QObject *parent) : QObject(parent), loadStatus(NotLoa
availableParsers << new CockatriceXml3Parser; availableParsers << new CockatriceXml3Parser;
for (auto &parser : availableParsers) { for (auto &parser : availableParsers) {
connect(parser, SIGNAL(addCard(CardInfoPtr)), this, SLOT(addCard(CardInfoPtr)), Qt::DirectConnection); connect(parser, &ICardDatabaseParser::addCard, this, &CardDatabase::addCard, Qt::DirectConnection);
connect(parser, SIGNAL(addSet(CardSetPtr)), this, SLOT(addSet(CardSetPtr)), 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() CardDatabase::~CardDatabase()

View file

@ -9,9 +9,10 @@
CardDatabaseModel::CardDatabaseModel(CardDatabase *_db, bool _showOnlyCardsFromEnabledSets, QObject *parent) CardDatabaseModel::CardDatabaseModel(CardDatabase *_db, bool _showOnlyCardsFromEnabledSets, QObject *parent)
: QAbstractListModel(parent), db(_db), showOnlyCardsFromEnabledSets(_showOnlyCardsFromEnabledSets) : QAbstractListModel(parent), db(_db), showOnlyCardsFromEnabledSets(_showOnlyCardsFromEnabledSets)
{ {
connect(db, SIGNAL(cardAdded(CardInfoPtr)), this, SLOT(cardAdded(CardInfoPtr))); connect(db, &CardDatabase::cardAdded, this, &CardDatabaseModel::cardAdded);
connect(db, SIGNAL(cardRemoved(CardInfoPtr)), this, SLOT(cardRemoved(CardInfoPtr))); connect(db, &CardDatabase::cardRemoved, this, &CardDatabaseModel::cardRemoved);
connect(db, SIGNAL(cardDatabaseEnabledSetsChanged()), this, SLOT(cardDatabaseEnabledSetsChanged())); connect(db, &CardDatabase::cardDatabaseEnabledSetsChanged, this,
&CardDatabaseModel::cardDatabaseEnabledSetsChanged);
cardDatabaseEnabledSetsChanged(); cardDatabaseEnabledSetsChanged();
} }
@ -131,7 +132,7 @@ void CardDatabaseModel::cardAdded(CardInfoPtr card)
beginInsertRows(QModelIndex(), cardList.size(), cardList.size()); beginInsertRows(QModelIndex(), cardList.size(), cardList.size());
cardList.append(card); cardList.append(card);
cardListSet.insert(card); cardListSet.insert(card);
connect(card.data(), SIGNAL(cardInfoChanged(CardInfoPtr)), this, SLOT(cardInfoChanged(CardInfoPtr))); connect(card.data(), &CardInfo::cardInfoChanged, this, &CardDatabaseModel::cardInfoChanged);
endInsertRows(); endInsertRows();
} }
} }
@ -342,7 +343,7 @@ void CardDatabaseDisplayModel::setFilterTree(FilterTree *_filterTree)
disconnect(this->filterTree, nullptr, this, nullptr); disconnect(this->filterTree, nullptr, this, nullptr);
this->filterTree = _filterTree; this->filterTree = _filterTree;
connect(this->filterTree, SIGNAL(changed()), this, SLOT(filterTreeChanged())); connect(this->filterTree, &FilterTree::changed, this, &CardDatabaseDisplayModel::filterTreeChanged);
invalidate(); invalidate();
} }

View file

@ -10,6 +10,7 @@
class ICardDatabaseParser : public QObject class ICardDatabaseParser : public QObject
{ {
Q_OBJECT
public: public:
~ICardDatabaseParser() override = default; ~ICardDatabaseParser() override = default;
@ -35,8 +36,8 @@ protected:
const QDate &releaseDate = QDate(), const QDate &releaseDate = QDate(),
const CardSet::Priority priority = CardSet::PriorityFallback); const CardSet::Priority priority = CardSet::PriorityFallback);
signals: signals:
virtual void addCard(CardInfoPtr card) = 0; void addCard(CardInfoPtr card);
virtual void addSet(CardSetPtr set) = 0; void addSet(CardSetPtr set);
}; };
Q_DECLARE_INTERFACE(ICardDatabaseParser, "ICardDatabaseParser") Q_DECLARE_INTERFACE(ICardDatabaseParser, "ICardDatabaseParser")

View file

@ -24,9 +24,6 @@ private:
void loadCardsFromXml(QXmlStreamReader &xml); void loadCardsFromXml(QXmlStreamReader &xml);
void loadSetsFromXml(QXmlStreamReader &xml); void loadSetsFromXml(QXmlStreamReader &xml);
QString getMainCardType(QString &type); QString getMainCardType(QString &type);
signals:
void addCard(CardInfoPtr card) override;
void addSet(CardSetPtr set) override;
}; };
#endif #endif

View file

@ -24,9 +24,6 @@ private:
QVariantHash loadCardPropertiesFromXml(QXmlStreamReader &xml); QVariantHash loadCardPropertiesFromXml(QXmlStreamReader &xml);
void loadCardsFromXml(QXmlStreamReader &xml); void loadCardsFromXml(QXmlStreamReader &xml);
void loadSetsFromXml(QXmlStreamReader &xml); void loadSetsFromXml(QXmlStreamReader &xml);
signals:
void addCard(CardInfoPtr card) override;
void addSet(CardSetPtr set) override;
}; };
#endif #endif

View file

@ -40,9 +40,9 @@ FilterBuilder::FilterBuilder(QWidget *parent) : QWidget(parent)
setLayout(layout); setLayout(layout);
connect(filterCombo, SIGNAL(activated(int)), edit, SLOT(setFocus())); connect(filterCombo, qOverload<int>(&QComboBox::activated), edit, [this](int) { setFocus(); });
connect(edit, SIGNAL(returnPressed()), this, SLOT(emit_add())); connect(edit, &LineEditUnfocusable::returnPressed, this, &FilterBuilder::emit_add);
connect(ok, SIGNAL(released()), this, SLOT(emit_add())); connect(ok, &QPushButton::released, this, &FilterBuilder::emit_add);
fltr = NULL; fltr = NULL;
} }

View file

@ -8,14 +8,10 @@
FilterTreeModel::FilterTreeModel(QObject *parent) : QAbstractItemModel(parent) FilterTreeModel::FilterTreeModel(QObject *parent) : QAbstractItemModel(parent)
{ {
fTree = new FilterTree; fTree = new FilterTree;
connect(fTree, SIGNAL(preInsertRow(const FilterTreeNode *, int)), this, connect(fTree, &FilterTree::preInsertRow, this, &FilterTreeModel::proxyBeginInsertRow);
SLOT(proxyBeginInsertRow(const FilterTreeNode *, int))); connect(fTree, &FilterTree::postInsertRow, this, &FilterTreeModel::proxyEndInsertRow);
connect(fTree, SIGNAL(postInsertRow(const FilterTreeNode *, int)), this, connect(fTree, &FilterTree::preRemoveRow, this, &FilterTreeModel::proxyBeginRemoveRow);
SLOT(proxyEndInsertRow(const FilterTreeNode *, int))); connect(fTree, &FilterTree::postRemoveRow, this, &FilterTreeModel::proxyEndRemoveRow);
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)));
} }
FilterTreeModel::~FilterTreeModel() FilterTreeModel::~FilterTreeModel()

View file

@ -20,7 +20,8 @@ GameScene::GameScene(PhasesToolbar *_phasesToolbar, QObject *parent)
{ {
animationTimer = new QBasicTimer; animationTimer = new QBasicTimer;
addItem(phasesToolbar); addItem(phasesToolbar);
connect(&SettingsCache::instance(), SIGNAL(minPlayersForMultiColumnLayoutChanged()), this, SLOT(rearrange())); connect(&SettingsCache::instance(), &SettingsCache::minPlayersForMultiColumnLayoutChanged, this,
&GameScene::rearrange);
rearrange(); rearrange();
} }
@ -41,8 +42,8 @@ void GameScene::addPlayer(Player *player)
qDebug() << "GameScene::addPlayer name=" << player->getName(); qDebug() << "GameScene::addPlayer name=" << player->getName();
players << player; players << player;
addItem(player); addItem(player);
connect(player, SIGNAL(sizeChanged()), this, SLOT(rearrange())); connect(player, &Player::sizeChanged, this, &GameScene::rearrange);
connect(player, SIGNAL(playerCountChanged()), this, SLOT(rearrange())); connect(player, &Player::playerCountChanged, this, &GameScene::rearrange);
} }
void GameScene::removePlayer(Player *player) void GameScene::removePlayer(Player *player)
@ -154,7 +155,7 @@ void GameScene::toggleZoneView(Player *player, const QString &zoneName, int numb
ZoneViewWidget *item = ZoneViewWidget *item =
new ZoneViewWidget(player, player->getZones().value(zoneName), numberCards, false, false, {}, isReversed); new ZoneViewWidget(player, player->getZones().value(zoneName), numberCards, false, false, {}, isReversed);
zoneViews.append(item); zoneViews.append(item);
connect(item, SIGNAL(closePressed(ZoneViewWidget *)), this, SLOT(removeZoneView(ZoneViewWidget *))); connect(item, &ZoneViewWidget::closePressed, this, &GameScene::removeZoneView);
addItem(item); addItem(item);
if (zoneName == "grave") { if (zoneName == "grave") {
item->setPos(360, 100); item->setPos(360, 100);
@ -172,7 +173,7 @@ void GameScene::addRevealedZoneView(Player *player,
{ {
ZoneViewWidget *item = new ZoneViewWidget(player, zone, -2, true, withWritePermission, cardList); ZoneViewWidget *item = new ZoneViewWidget(player, zone, -2, true, withWritePermission, cardList);
zoneViews.append(item); zoneViews.append(item);
connect(item, SIGNAL(closePressed(ZoneViewWidget *)), this, SLOT(removeZoneView(ZoneViewWidget *))); connect(item, &ZoneViewWidget::closePressed, this, &GameScene::removeZoneView);
addItem(item); addItem(item);
item->setPos(600, 80); item->setPos(600, 80);
} }

View file

@ -73,16 +73,16 @@ GameSelector::GameSelector(AbstractClient *_client,
filterButton = new QPushButton; filterButton = new QPushButton;
filterButton->setIcon(QPixmap("theme:icons/search")); filterButton->setIcon(QPixmap("theme:icons/search"));
connect(filterButton, SIGNAL(clicked()), this, SLOT(actSetFilter())); connect(filterButton, &QPushButton::clicked, this, &GameSelector::actSetFilter);
clearFilterButton = new QPushButton; clearFilterButton = new QPushButton;
clearFilterButton->setIcon(QPixmap("theme:icons/clearsearch")); clearFilterButton->setIcon(QPixmap("theme:icons/clearsearch"));
bool filtersSetToDefault = showFilters && gameListProxyModel->areFilterParametersSetToDefaults(); bool filtersSetToDefault = showFilters && gameListProxyModel->areFilterParametersSetToDefaults();
clearFilterButton->setEnabled(!filtersSetToDefault); clearFilterButton->setEnabled(!filtersSetToDefault);
connect(clearFilterButton, SIGNAL(clicked()), this, SLOT(actClearFilter())); connect(clearFilterButton, &QPushButton::clicked, this, &GameSelector::actClearFilter);
if (room) { if (room) {
createButton = new QPushButton; createButton = new QPushButton;
connect(createButton, SIGNAL(clicked()), this, SLOT(actCreate())); connect(createButton, &QPushButton::clicked, this, &GameSelector::actCreate);
} else { } else {
createButton = nullptr; createButton = nullptr;
} }
@ -111,18 +111,15 @@ GameSelector::GameSelector(AbstractClient *_client,
setMinimumWidth((qreal)(gameListView->columnWidth(0) * gameListModel->columnCount()) / 1.5); setMinimumWidth((qreal)(gameListView->columnWidth(0) * gameListModel->columnCount()) / 1.5);
setMinimumHeight(200); setMinimumHeight(200);
connect(joinButton, SIGNAL(clicked()), this, SLOT(actJoin())); connect(joinButton, &QPushButton::clicked, this, &GameSelector::actJoin);
connect(spectateButton, SIGNAL(clicked()), this, SLOT(actJoin())); connect(spectateButton, &QPushButton::clicked, this, &GameSelector::actJoin);
connect(gameListView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, connect(gameListView->selectionModel(), &QItemSelectionModel::currentRowChanged, this,
SLOT(actSelectedGameChanged(const QModelIndex &, const QModelIndex &))); &GameSelector::actSelectedGameChanged);
connect(gameListView, SIGNAL(activated(const QModelIndex &)), this, SLOT(actJoin())); connect(gameListView, &QTreeView::activated, this, &GameSelector::actJoin);
connect(client, SIGNAL(ignoreListReceived(const QList<ServerInfo_User> &)), this, connect(client, &AbstractClient::ignoreListReceived, this, &GameSelector::ignoreListReceived);
SLOT(ignoreListReceived(const QList<ServerInfo_User> &))); connect(client, &AbstractClient::addToListEventReceived, this, &GameSelector::processAddToListEvent);
connect(client, SIGNAL(addToListEventReceived(const Event_AddToList &)), this, connect(client, &AbstractClient::removeFromListEventReceived, this, &GameSelector::processRemoveFromListEvent);
SLOT(processAddToListEvent(const Event_AddToList &)));
connect(client, SIGNAL(removeFromListEventReceived(const Event_RemoveFromList &)), this,
SLOT(processRemoveFromListEvent(const Event_RemoveFromList &)));
} }
void GameSelector::ignoreListReceived(const QList<ServerInfo_User> &) void GameSelector::ignoreListReceived(const QList<ServerInfo_User> &)
@ -196,7 +193,9 @@ void GameSelector::actCreate()
updateTitle(); 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 // 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. // 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); PendingCommand *pend = r->prepareRoomCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(checkResponse(Response))); connect(pend, qOverload<const Response &, const CommandContainer &, const QVariant &>(&PendingCommand::finished),
this, &GameSelector::checkResponse);
r->sendRoomCommand(pend); r->sendRoomCommand(pend);
disableButtons(); disableButtons();

View file

@ -6,6 +6,7 @@
#include <QGroupBox> #include <QGroupBox>
#include <common/pb/event_add_to_list.pb.h> #include <common/pb/event_add_to_list.pb.h>
#include <common/pb/event_remove_from_list.pb.h> #include <common/pb/event_remove_from_list.pb.h>
#include <pb/commands.pb.h>
class QTreeView; class QTreeView;
class GamesModel; class GamesModel;
@ -28,7 +29,7 @@ private slots:
void actCreate(); void actCreate();
void actJoin(); void actJoin();
void actSelectedGameChanged(const QModelIndex &current, const QModelIndex &previous); void actSelectedGameChanged(const QModelIndex &current, const QModelIndex &previous);
void checkResponse(const Response &response); void checkResponse(const Response &response, const CommandContainer &, const QVariant &);
void ignoreListReceived(const QList<ServerInfo_User> &_ignoreList); void ignoreListReceived(const QList<ServerInfo_User> &_ignoreList);
void processAddToListEvent(const Event_AddToList &event); void processAddToListEvent(const Event_AddToList &event);

View file

@ -7,24 +7,25 @@
#include <QResizeEvent> #include <QResizeEvent>
#include <QRubberBand> #include <QRubberBand>
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))); setBackgroundBrush(QBrush(QColor(0, 0, 0)));
setRenderHints(QPainter::TextAntialiasing | QPainter::Antialiasing); setRenderHints(QPainter::TextAntialiasing | QPainter::Antialiasing);
setFocusPolicy(Qt::NoFocus); setFocusPolicy(Qt::NoFocus);
setViewportUpdateMode(BoundingRectViewportUpdate); 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, &GameScene::sigStartRubberBand, this, &GameView::startRubberBand);
connect(scene, SIGNAL(sigResizeRubberBand(const QPointF &)), this, SLOT(resizeRubberBand(const QPointF &))); connect(scene, &GameScene::sigResizeRubberBand, this, &GameView::resizeRubberBand);
connect(scene, SIGNAL(sigStopRubberBand()), this, SLOT(stopRubberBand())); connect(scene, &GameScene::sigStopRubberBand, this, &GameView::stopRubberBand);
aCloseMostRecentZoneView = new QAction(this); aCloseMostRecentZoneView = new QAction(this);
connect(aCloseMostRecentZoneView, SIGNAL(triggered()), scene, SLOT(closeMostRecentZoneView())); connect(aCloseMostRecentZoneView, &QAction::triggered, scene, &GameScene::closeMostRecentZoneView);
addAction(aCloseMostRecentZoneView); addAction(aCloseMostRecentZoneView);
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts())); connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
&GameView::refreshShortcuts);
refreshShortcuts(); refreshShortcuts();
rubberBand = new QRubberBand(QRubberBand::Rectangle, this); rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
} }

View file

@ -3,6 +3,7 @@
#include <QGraphicsView> #include <QGraphicsView>
class GameScene;
class QRubberBand; class QRubberBand;
class GameView : public QGraphicsView class GameView : public QGraphicsView
@ -24,7 +25,7 @@ public slots:
void updateSceneRect(const QRectF &rect); void updateSceneRect(const QRectF &rect);
public: public:
GameView(QGraphicsScene *scene, QWidget *parent = nullptr); GameView(GameScene *scene, QWidget *parent = nullptr);
}; };
#endif #endif

View file

@ -82,7 +82,7 @@ static constexpr int MOVE_TOP_CARD_UNTIL_INTERVAL = 100;
PlayerArea::PlayerArea(QGraphicsItem *parentItem) : QObject(), QGraphicsItem(parentItem) PlayerArea::PlayerArea(QGraphicsItem *parentItem) : QObject(), QGraphicsItem(parentItem)
{ {
setCacheMode(DeviceCoordinateCache); setCacheMode(DeviceCoordinateCache);
connect(themeManager, SIGNAL(themeChanged()), this, SLOT(updateBg())); connect(themeManager, &ThemeManager::themeChanged, this, &PlayerArea::updateBg);
updateBg(); updateBg();
} }
@ -121,8 +121,8 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
userInfo = new ServerInfo_User; userInfo = new ServerInfo_User;
userInfo->CopyFrom(info); userInfo->CopyFrom(info);
connect(&SettingsCache::instance(), SIGNAL(horizontalHandChanged()), this, SLOT(rearrangeZones())); connect(&SettingsCache::instance(), &SettingsCache::horizontalHandChanged, this, &Player::rearrangeZones);
connect(&SettingsCache::instance(), SIGNAL(handJustificationChanged()), this, SLOT(rearrangeZones())); connect(&SettingsCache::instance(), &SettingsCache::handJustificationChanged, this, &Player::rearrangeZones);
playerArea = new PlayerArea(this); playerArea = new PlayerArea(this);
@ -151,20 +151,20 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
sb->setVisible(false); sb->setVisible(false);
table = new TableZone(this, this); 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); stack = new StackZone(this, (int)table->boundingRect().height(), this);
hand = new HandZone(this, _local || _judge || (_parent->getSpectator() && _parent->getSpectatorsSeeEverything()), hand = new HandZone(this, _local || _judge || (_parent->getSpectator() && _parent->getSpectatorsSeeEverything()),
(int)table->boundingRect().height(), this); (int)table->boundingRect().height(), this);
connect(hand, SIGNAL(cardCountChanged()), handCounter, SLOT(updateNumber())); connect(hand, &HandZone::cardCountChanged, handCounter, &HandCounter::updateNumber);
connect(handCounter, SIGNAL(showContextMenu(const QPoint &)), hand, SLOT(showContextMenu(const QPoint &))); connect(handCounter, &HandCounter::showContextMenu, hand, &HandZone::showContextMenu);
updateBoundingRect(); updateBoundingRect();
if (local || judge) { if (local || judge) {
connect(_parent, SIGNAL(playerAdded(Player *)), this, SLOT(addPlayer(Player *))); connect(_parent, &TabGame::playerAdded, this, &Player::addPlayer);
connect(_parent, SIGNAL(playerRemoved(Player *)), this, SLOT(removePlayer(Player *))); connect(_parent, &TabGame::playerRemoved, this, &Player::removePlayer);
} }
if (local || judge) { 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 = new QAction(this);
aMoveHandToRfg->setData(QList<QVariant>() << "rfg" << 0); aMoveHandToRfg->setData(QList<QVariant>() << "rfg" << 0);
connect(aMoveHandToTopLibrary, SIGNAL(triggered()), hand, SLOT(moveAllToZone())); connect(aMoveHandToTopLibrary, &QAction::triggered, hand, &HandZone::moveAllToZone);
connect(aMoveHandToBottomLibrary, SIGNAL(triggered()), hand, SLOT(moveAllToZone())); connect(aMoveHandToBottomLibrary, &QAction::triggered, hand, &HandZone::moveAllToZone);
connect(aMoveHandToGrave, SIGNAL(triggered()), hand, SLOT(moveAllToZone())); connect(aMoveHandToGrave, &QAction::triggered, hand, &HandZone::moveAllToZone);
connect(aMoveHandToRfg, SIGNAL(triggered()), hand, SLOT(moveAllToZone())); connect(aMoveHandToRfg, &QAction::triggered, hand, &HandZone::moveAllToZone);
aMoveGraveToTopLibrary = new QAction(this); aMoveGraveToTopLibrary = new QAction(this);
aMoveGraveToTopLibrary->setData(QList<QVariant>() << "deck" << 0); aMoveGraveToTopLibrary->setData(QList<QVariant>() << "deck" << 0);
@ -191,10 +191,10 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
aMoveGraveToRfg = new QAction(this); aMoveGraveToRfg = new QAction(this);
aMoveGraveToRfg->setData(QList<QVariant>() << "rfg" << 0); aMoveGraveToRfg->setData(QList<QVariant>() << "rfg" << 0);
connect(aMoveGraveToTopLibrary, SIGNAL(triggered()), grave, SLOT(moveAllToZone())); connect(aMoveGraveToTopLibrary, &QAction::triggered, grave, &PileZone::moveAllToZone);
connect(aMoveGraveToBottomLibrary, SIGNAL(triggered()), grave, SLOT(moveAllToZone())); connect(aMoveGraveToBottomLibrary, &QAction::triggered, grave, &PileZone::moveAllToZone);
connect(aMoveGraveToHand, SIGNAL(triggered()), grave, SLOT(moveAllToZone())); connect(aMoveGraveToHand, &QAction::triggered, grave, &PileZone::moveAllToZone);
connect(aMoveGraveToRfg, SIGNAL(triggered()), grave, SLOT(moveAllToZone())); connect(aMoveGraveToRfg, &QAction::triggered, grave, &PileZone::moveAllToZone);
aMoveRfgToTopLibrary = new QAction(this); aMoveRfgToTopLibrary = new QAction(this);
aMoveRfgToTopLibrary->setData(QList<QVariant>() << "deck" << 0); aMoveRfgToTopLibrary->setData(QList<QVariant>() << "deck" << 0);
@ -205,87 +205,87 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
aMoveRfgToGrave = new QAction(this); aMoveRfgToGrave = new QAction(this);
aMoveRfgToGrave->setData(QList<QVariant>() << "grave" << 0); aMoveRfgToGrave->setData(QList<QVariant>() << "grave" << 0);
connect(aMoveRfgToTopLibrary, SIGNAL(triggered()), rfg, SLOT(moveAllToZone())); connect(aMoveRfgToTopLibrary, &QAction::triggered, rfg, &PileZone::moveAllToZone);
connect(aMoveRfgToBottomLibrary, SIGNAL(triggered()), rfg, SLOT(moveAllToZone())); connect(aMoveRfgToBottomLibrary, &QAction::triggered, rfg, &PileZone::moveAllToZone);
connect(aMoveRfgToHand, SIGNAL(triggered()), rfg, SLOT(moveAllToZone())); connect(aMoveRfgToHand, &QAction::triggered, rfg, &PileZone::moveAllToZone);
connect(aMoveRfgToGrave, SIGNAL(triggered()), rfg, SLOT(moveAllToZone())); connect(aMoveRfgToGrave, &QAction::triggered, rfg, &PileZone::moveAllToZone);
aViewLibrary = new QAction(this); aViewLibrary = new QAction(this);
connect(aViewLibrary, SIGNAL(triggered()), this, SLOT(actViewLibrary())); connect(aViewLibrary, &QAction::triggered, this, &Player::actViewLibrary);
aViewHand = new QAction(this); aViewHand = new QAction(this);
connect(aViewHand, SIGNAL(triggered()), this, SLOT(actViewHand())); connect(aViewHand, &QAction::triggered, this, &Player::actViewHand);
aViewTopCards = new QAction(this); aViewTopCards = new QAction(this);
connect(aViewTopCards, SIGNAL(triggered()), this, SLOT(actViewTopCards())); connect(aViewTopCards, &QAction::triggered, this, &Player::actViewTopCards);
aViewBottomCards = new QAction(this); aViewBottomCards = new QAction(this);
connect(aViewBottomCards, &QAction::triggered, this, &Player::actViewBottomCards); connect(aViewBottomCards, &QAction::triggered, this, &Player::actViewBottomCards);
aAlwaysRevealTopCard = new QAction(this); aAlwaysRevealTopCard = new QAction(this);
aAlwaysRevealTopCard->setCheckable(true); aAlwaysRevealTopCard->setCheckable(true);
connect(aAlwaysRevealTopCard, SIGNAL(triggered()), this, SLOT(actAlwaysRevealTopCard())); connect(aAlwaysRevealTopCard, &QAction::triggered, this, &Player::actAlwaysRevealTopCard);
aAlwaysLookAtTopCard = new QAction(this); aAlwaysLookAtTopCard = new QAction(this);
aAlwaysLookAtTopCard->setCheckable(true); aAlwaysLookAtTopCard->setCheckable(true);
connect(aAlwaysLookAtTopCard, SIGNAL(triggered()), this, SLOT(actAlwaysLookAtTopCard())); connect(aAlwaysLookAtTopCard, &QAction::triggered, this, &Player::actAlwaysLookAtTopCard);
aOpenDeckInDeckEditor = new QAction(this); aOpenDeckInDeckEditor = new QAction(this);
aOpenDeckInDeckEditor->setEnabled(false); aOpenDeckInDeckEditor->setEnabled(false);
connect(aOpenDeckInDeckEditor, SIGNAL(triggered()), this, SLOT(actOpenDeckInDeckEditor())); connect(aOpenDeckInDeckEditor, &QAction::triggered, this, &Player::actOpenDeckInDeckEditor);
} }
aViewGraveyard = new QAction(this); aViewGraveyard = new QAction(this);
connect(aViewGraveyard, SIGNAL(triggered()), this, SLOT(actViewGraveyard())); connect(aViewGraveyard, &QAction::triggered, this, &Player::actViewGraveyard);
aViewRfg = new QAction(this); aViewRfg = new QAction(this);
connect(aViewRfg, SIGNAL(triggered()), this, SLOT(actViewRfg())); connect(aViewRfg, &QAction::triggered, this, &Player::actViewRfg);
if (local || judge) { if (local || judge) {
aViewSideboard = new QAction(this); aViewSideboard = new QAction(this);
connect(aViewSideboard, SIGNAL(triggered()), this, SLOT(actViewSideboard())); connect(aViewSideboard, &QAction::triggered, this, &Player::actViewSideboard);
aDrawCard = new QAction(this); aDrawCard = new QAction(this);
connect(aDrawCard, SIGNAL(triggered()), this, SLOT(actDrawCard())); connect(aDrawCard, &QAction::triggered, this, &Player::actDrawCard);
aDrawCards = new QAction(this); aDrawCards = new QAction(this);
connect(aDrawCards, SIGNAL(triggered()), this, SLOT(actDrawCards())); connect(aDrawCards, &QAction::triggered, this, &Player::actDrawCards);
aUndoDraw = new QAction(this); aUndoDraw = new QAction(this);
connect(aUndoDraw, SIGNAL(triggered()), this, SLOT(actUndoDraw())); connect(aUndoDraw, &QAction::triggered, this, &Player::actUndoDraw);
aShuffle = new QAction(this); aShuffle = new QAction(this);
connect(aShuffle, SIGNAL(triggered()), this, SLOT(actShuffle())); connect(aShuffle, &QAction::triggered, this, &Player::actShuffle);
aMulligan = new QAction(this); aMulligan = new QAction(this);
connect(aMulligan, SIGNAL(triggered()), this, SLOT(actMulligan())); connect(aMulligan, &QAction::triggered, this, &Player::actMulligan);
aMoveTopToPlay = new QAction(this); aMoveTopToPlay = new QAction(this);
connect(aMoveTopToPlay, SIGNAL(triggered()), this, SLOT(actMoveTopCardToPlay())); connect(aMoveTopToPlay, &QAction::triggered, this, &Player::actMoveTopCardToPlay);
aMoveTopToPlayFaceDown = new QAction(this); aMoveTopToPlayFaceDown = new QAction(this);
connect(aMoveTopToPlayFaceDown, SIGNAL(triggered()), this, SLOT(actMoveTopCardToPlayFaceDown())); connect(aMoveTopToPlayFaceDown, &QAction::triggered, this, &Player::actMoveTopCardToPlayFaceDown);
aMoveTopCardToGraveyard = new QAction(this); aMoveTopCardToGraveyard = new QAction(this);
connect(aMoveTopCardToGraveyard, SIGNAL(triggered()), this, SLOT(actMoveTopCardToGrave())); connect(aMoveTopCardToGraveyard, &QAction::triggered, this, &Player::actMoveTopCardToGrave);
aMoveTopCardToExile = new QAction(this); aMoveTopCardToExile = new QAction(this);
connect(aMoveTopCardToExile, SIGNAL(triggered()), this, SLOT(actMoveTopCardToExile())); connect(aMoveTopCardToExile, &QAction::triggered, this, &Player::actMoveTopCardToExile);
aMoveTopCardsToGraveyard = new QAction(this); aMoveTopCardsToGraveyard = new QAction(this);
connect(aMoveTopCardsToGraveyard, SIGNAL(triggered()), this, SLOT(actMoveTopCardsToGrave())); connect(aMoveTopCardsToGraveyard, &QAction::triggered, this, &Player::actMoveTopCardsToGrave);
aMoveTopCardsToExile = new QAction(this); aMoveTopCardsToExile = new QAction(this);
connect(aMoveTopCardsToExile, SIGNAL(triggered()), this, SLOT(actMoveTopCardsToExile())); connect(aMoveTopCardsToExile, &QAction::triggered, this, &Player::actMoveTopCardsToExile);
aMoveTopCardsUntil = new QAction(this); aMoveTopCardsUntil = new QAction(this);
connect(aMoveTopCardsUntil, SIGNAL(triggered()), this, SLOT(actMoveTopCardsUntil())); connect(aMoveTopCardsUntil, &QAction::triggered, this, &Player::actMoveTopCardsUntil);
aMoveTopCardToBottom = new QAction(this); aMoveTopCardToBottom = new QAction(this);
connect(aMoveTopCardToBottom, SIGNAL(triggered()), this, SLOT(actMoveTopCardToBottom())); connect(aMoveTopCardToBottom, &QAction::triggered, this, &Player::actMoveTopCardToBottom);
aDrawBottomCard = new QAction(this); aDrawBottomCard = new QAction(this);
connect(aDrawBottomCard, SIGNAL(triggered()), this, SLOT(actDrawBottomCard())); connect(aDrawBottomCard, &QAction::triggered, this, &Player::actDrawBottomCard);
aDrawBottomCards = new QAction(this); aDrawBottomCards = new QAction(this);
connect(aDrawBottomCards, SIGNAL(triggered()), this, SLOT(actDrawBottomCards())); connect(aDrawBottomCards, &QAction::triggered, this, &Player::actDrawBottomCards);
aMoveBottomToPlay = new QAction(this); aMoveBottomToPlay = new QAction(this);
connect(aMoveBottomToPlay, SIGNAL(triggered()), this, SLOT(actMoveBottomCardToPlay())); connect(aMoveBottomToPlay, &QAction::triggered, this, &Player::actMoveBottomCardToPlay);
aMoveBottomToPlayFaceDown = new QAction(this); aMoveBottomToPlayFaceDown = new QAction(this);
connect(aMoveBottomToPlayFaceDown, SIGNAL(triggered()), this, SLOT(actMoveBottomCardToPlayFaceDown())); connect(aMoveBottomToPlayFaceDown, &QAction::triggered, this, &Player::actMoveBottomCardToPlayFaceDown);
aMoveBottomCardToGraveyard = new QAction(this); aMoveBottomCardToGraveyard = new QAction(this);
connect(aMoveBottomCardToGraveyard, SIGNAL(triggered()), this, SLOT(actMoveBottomCardToGrave())); connect(aMoveBottomCardToGraveyard, &QAction::triggered, this, &Player::actMoveBottomCardToGrave);
aMoveBottomCardToExile = new QAction(this); aMoveBottomCardToExile = new QAction(this);
connect(aMoveBottomCardToExile, SIGNAL(triggered()), this, SLOT(actMoveBottomCardToExile())); connect(aMoveBottomCardToExile, &QAction::triggered, this, &Player::actMoveBottomCardToExile);
aMoveBottomCardsToGraveyard = new QAction(this); aMoveBottomCardsToGraveyard = new QAction(this);
connect(aMoveBottomCardsToGraveyard, SIGNAL(triggered()), this, SLOT(actMoveBottomCardsToGrave())); connect(aMoveBottomCardsToGraveyard, &QAction::triggered, this, &Player::actMoveBottomCardsToGrave);
aMoveBottomCardsToExile = new QAction(this); aMoveBottomCardsToExile = new QAction(this);
connect(aMoveBottomCardsToExile, SIGNAL(triggered()), this, SLOT(actMoveBottomCardsToExile())); connect(aMoveBottomCardsToExile, &QAction::triggered, this, &Player::actMoveBottomCardsToExile);
aMoveBottomCardToTop = new QAction(this); aMoveBottomCardToTop = new QAction(this);
connect(aMoveBottomCardToTop, SIGNAL(triggered()), this, SLOT(actMoveBottomCardToTop())); connect(aMoveBottomCardToTop, &QAction::triggered, this, &Player::actMoveBottomCardToTop);
} }
playerMenu = new TearOffMenu(); playerMenu = new TearOffMenu();
@ -361,7 +361,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
mRevealRandomGraveyardCard = graveMenu->addMenu(QString()); mRevealRandomGraveyardCard = graveMenu->addMenu(QString());
QAction *newAction = mRevealRandomGraveyardCard->addAction(QString()); QAction *newAction = mRevealRandomGraveyardCard->addAction(QString());
newAction->setData(-1); newAction->setData(-1);
connect(newAction, SIGNAL(triggered()), this, SLOT(actRevealRandomGraveyardCard())); connect(newAction, &QAction::triggered, this, &Player::actRevealRandomGraveyardCard);
allPlayersActions.append(newAction); allPlayersActions.append(newAction);
mRevealRandomGraveyardCard->addSeparator(); mRevealRandomGraveyardCard->addSeparator();
} }
@ -395,16 +395,16 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
sb->setMenu(sbMenu, aViewSideboard); sb->setMenu(sbMenu, aViewSideboard);
aUntapAll = new QAction(this); aUntapAll = new QAction(this);
connect(aUntapAll, SIGNAL(triggered()), this, SLOT(actUntapAll())); connect(aUntapAll, &QAction::triggered, this, &Player::actUntapAll);
aRollDie = new QAction(this); aRollDie = new QAction(this);
connect(aRollDie, SIGNAL(triggered()), this, SLOT(actRollDie())); connect(aRollDie, &QAction::triggered, this, &Player::actRollDie);
aCreateToken = new QAction(this); aCreateToken = new QAction(this);
connect(aCreateToken, SIGNAL(triggered()), this, SLOT(actCreateToken())); connect(aCreateToken, &QAction::triggered, this, &Player::actCreateToken);
aCreateAnotherToken = new QAction(this); aCreateAnotherToken = new QAction(this);
connect(aCreateAnotherToken, SIGNAL(triggered()), this, SLOT(actCreateAnotherToken())); connect(aCreateAnotherToken, &QAction::triggered, this, &Player::actCreateAnotherToken);
aCreateAnotherToken->setEnabled(false); aCreateAnotherToken->setEnabled(false);
createPredefinedTokenMenu = new QMenu(QString()); createPredefinedTokenMenu = new QMenu(QString());
@ -425,7 +425,8 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
if (local) { if (local) {
sayMenu = playerMenu->addMenu(QString()); sayMenu = playerMenu->addMenu(QString());
connect(&SettingsCache::instance().messages(), SIGNAL(messageMacrosChanged()), this, SLOT(initSayMenu())); connect(&SettingsCache::instance().messages(), &MessageSettings::messageMacrosChanged, this,
&Player::initSayMenu);
initSayMenu(); initSayMenu();
} }
@ -439,7 +440,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
for (auto &playerList : playerLists) { for (auto &playerList : playerLists) {
QAction *newAction = playerList->addAction(QString()); QAction *newAction = playerList->addAction(QString());
newAction->setData(-1); newAction->setData(-1);
connect(newAction, SIGNAL(triggered()), this, SLOT(playerListActionTriggered())); connect(newAction, &QAction::triggered, this, &Player::playerListActionTriggered);
allPlayersActions.append(newAction); allPlayersActions.append(newAction);
playerList->addSeparator(); playerList->addSeparator();
} }
@ -454,47 +455,47 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
aTap = new QAction(this); aTap = new QAction(this);
aTap->setData(cmTap); aTap->setData(cmTap);
connect(aTap, SIGNAL(triggered()), this, SLOT(cardMenuAction())); connect(aTap, &QAction::triggered, this, &Player::cardMenuAction);
aDoesntUntap = new QAction(this); aDoesntUntap = new QAction(this);
aDoesntUntap->setData(cmDoesntUntap); aDoesntUntap->setData(cmDoesntUntap);
connect(aDoesntUntap, SIGNAL(triggered()), this, SLOT(cardMenuAction())); connect(aDoesntUntap, &QAction::triggered, this, &Player::cardMenuAction);
aAttach = new QAction(this); aAttach = new QAction(this);
connect(aAttach, SIGNAL(triggered()), this, SLOT(actAttach())); connect(aAttach, &QAction::triggered, this, &Player::actAttach);
aUnattach = new QAction(this); aUnattach = new QAction(this);
connect(aUnattach, SIGNAL(triggered()), this, SLOT(actUnattach())); connect(aUnattach, &QAction::triggered, this, &Player::actUnattach);
aDrawArrow = new QAction(this); aDrawArrow = new QAction(this);
connect(aDrawArrow, SIGNAL(triggered()), this, SLOT(actDrawArrow())); connect(aDrawArrow, &QAction::triggered, this, &Player::actDrawArrow);
aIncP = new QAction(this); aIncP = new QAction(this);
connect(aIncP, SIGNAL(triggered()), this, SLOT(actIncP())); connect(aIncP, &QAction::triggered, this, &Player::actIncP);
aDecP = new QAction(this); aDecP = new QAction(this);
connect(aDecP, SIGNAL(triggered()), this, SLOT(actDecP())); connect(aDecP, &QAction::triggered, this, &Player::actDecP);
aIncT = new QAction(this); aIncT = new QAction(this);
connect(aIncT, SIGNAL(triggered()), this, SLOT(actIncT())); connect(aIncT, &QAction::triggered, this, &Player::actIncT);
aDecT = new QAction(this); aDecT = new QAction(this);
connect(aDecT, SIGNAL(triggered()), this, SLOT(actDecT())); connect(aDecT, &QAction::triggered, this, &Player::actDecT);
aIncPT = new QAction(this); aIncPT = new QAction(this);
connect(aIncPT, SIGNAL(triggered()), this, SLOT(actIncPT())); connect(aIncPT, &QAction::triggered, this, [this] { actIncPT(); });
aDecPT = new QAction(this); aDecPT = new QAction(this);
connect(aDecPT, SIGNAL(triggered()), this, SLOT(actDecPT())); connect(aDecPT, &QAction::triggered, this, &Player::actDecPT);
aFlowP = new QAction(this); aFlowP = new QAction(this);
connect(aFlowP, SIGNAL(triggered()), this, SLOT(actFlowP())); connect(aFlowP, &QAction::triggered, this, &Player::actFlowP);
aFlowT = new QAction(this); aFlowT = new QAction(this);
connect(aFlowT, SIGNAL(triggered()), this, SLOT(actFlowT())); connect(aFlowT, &QAction::triggered, this, &Player::actFlowT);
aSetPT = new QAction(this); aSetPT = new QAction(this);
connect(aSetPT, SIGNAL(triggered()), this, SLOT(actSetPT())); connect(aSetPT, &QAction::triggered, this, &Player::actSetPT);
aResetPT = new QAction(this); aResetPT = new QAction(this);
connect(aResetPT, SIGNAL(triggered()), this, SLOT(actResetPT())); connect(aResetPT, &QAction::triggered, this, &Player::actResetPT);
aSetAnnotation = new QAction(this); aSetAnnotation = new QAction(this);
connect(aSetAnnotation, SIGNAL(triggered()), this, SLOT(actSetAnnotation())); connect(aSetAnnotation, &QAction::triggered, this, &Player::actSetAnnotation);
aFlip = new QAction(this); aFlip = new QAction(this);
aFlip->setData(cmFlip); aFlip->setData(cmFlip);
connect(aFlip, SIGNAL(triggered()), this, SLOT(cardMenuAction())); connect(aFlip, &QAction::triggered, this, &Player::cardMenuAction);
aPeek = new QAction(this); aPeek = new QAction(this);
aPeek->setData(cmPeek); aPeek->setData(cmPeek);
connect(aPeek, SIGNAL(triggered()), this, SLOT(cardMenuAction())); connect(aPeek, &QAction::triggered, this, &Player::cardMenuAction);
aClone = new QAction(this); aClone = new QAction(this);
aClone->setData(cmClone); aClone->setData(cmClone);
connect(aClone, SIGNAL(triggered()), this, SLOT(cardMenuAction())); connect(aClone, &QAction::triggered, this, &Player::cardMenuAction);
aMoveToTopLibrary = new QAction(this); aMoveToTopLibrary = new QAction(this);
aMoveToTopLibrary->setData(cmMoveToTopLibrary); aMoveToTopLibrary->setData(cmMoveToTopLibrary);
aMoveToBottomLibrary = new QAction(this); aMoveToBottomLibrary = new QAction(this);
@ -506,26 +507,26 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
aMoveToGraveyard->setData(cmMoveToGraveyard); aMoveToGraveyard->setData(cmMoveToGraveyard);
aMoveToExile = new QAction(this); aMoveToExile = new QAction(this);
aMoveToExile->setData(cmMoveToExile); aMoveToExile->setData(cmMoveToExile);
connect(aMoveToTopLibrary, SIGNAL(triggered()), this, SLOT(cardMenuAction())); connect(aMoveToTopLibrary, &QAction::triggered, this, &Player::cardMenuAction);
connect(aMoveToBottomLibrary, SIGNAL(triggered()), this, SLOT(cardMenuAction())); connect(aMoveToBottomLibrary, &QAction::triggered, this, &Player::cardMenuAction);
connect(aMoveToXfromTopOfLibrary, SIGNAL(triggered()), this, SLOT(actMoveCardXCardsFromTop())); connect(aMoveToXfromTopOfLibrary, &QAction::triggered, this, &Player::actMoveCardXCardsFromTop);
connect(aMoveToHand, SIGNAL(triggered()), this, SLOT(cardMenuAction())); connect(aMoveToHand, &QAction::triggered, this, &Player::cardMenuAction);
connect(aMoveToGraveyard, SIGNAL(triggered()), this, SLOT(cardMenuAction())); connect(aMoveToGraveyard, &QAction::triggered, this, &Player::cardMenuAction);
connect(aMoveToExile, SIGNAL(triggered()), this, SLOT(cardMenuAction())); connect(aMoveToExile, &QAction::triggered, this, &Player::cardMenuAction);
aSelectAll = new QAction(this); aSelectAll = new QAction(this);
connect(aSelectAll, SIGNAL(triggered()), this, SLOT(actSelectAll())); connect(aSelectAll, &QAction::triggered, this, &Player::actSelectAll);
aSelectRow = new QAction(this); aSelectRow = new QAction(this);
connect(aSelectRow, SIGNAL(triggered()), this, SLOT(actSelectRow())); connect(aSelectRow, &QAction::triggered, this, &Player::actSelectRow);
aSelectColumn = new QAction(this); aSelectColumn = new QAction(this);
connect(aSelectColumn, SIGNAL(triggered()), this, SLOT(actSelectColumn())); connect(aSelectColumn, &QAction::triggered, this, &Player::actSelectColumn);
aPlay = new QAction(this); aPlay = new QAction(this);
connect(aPlay, SIGNAL(triggered()), this, SLOT(actPlay())); connect(aPlay, &QAction::triggered, this, &Player::actPlay);
aHide = new QAction(this); aHide = new QAction(this);
connect(aHide, SIGNAL(triggered()), this, SLOT(actHide())); connect(aHide, &QAction::triggered, this, &Player::actHide);
aPlayFacedown = new QAction(this); 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) { for (int i = 0; i < 3; ++i) {
auto *tempAddCounter = new QAction(this); 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); aAddCounter.append(tempAddCounter);
aRemoveCounter.append(tempRemoveCounter); aRemoveCounter.append(tempRemoveCounter);
aSetCounter.append(tempSetCounter); aSetCounter.append(tempSetCounter);
connect(tempAddCounter, SIGNAL(triggered()), this, SLOT(actCardCounterTrigger())); connect(tempAddCounter, &QAction::triggered, this, &Player::actCardCounterTrigger);
connect(tempRemoveCounter, SIGNAL(triggered()), this, SLOT(actCardCounterTrigger())); connect(tempRemoveCounter, &QAction::triggered, this, &Player::actCardCounterTrigger);
connect(tempSetCounter, SIGNAL(triggered()), this, SLOT(actCardCounterTrigger())); connect(tempSetCounter, &QAction::triggered, this, &Player::actCardCounterTrigger);
} }
const QList<Player *> &players = game->getPlayers().values(); const QList<Player *> &players = game->getPlayers().values();
@ -554,7 +555,8 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
rearrangeZones(); rearrangeZones();
retranslateUi(); retranslateUi();
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts())); connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
&Player::refreshShortcuts);
refreshShortcuts(); refreshShortcuts();
} }
@ -606,7 +608,7 @@ void Player::addPlayerToList(QMenu *playerList, Player *player)
{ {
QAction *newAction = playerList->addAction(player->getName()); QAction *newAction = playerList->addAction(player->getName());
newAction->setData(player->getId()); newAction->setData(player->getId());
connect(newAction, SIGNAL(triggered()), this, SLOT(playerListActionTriggered())); connect(newAction, &QAction::triggered, this, &Player::playerListActionTriggered);
} }
void Player::removePlayer(Player *player) void Player::removePlayer(Player *player)
@ -1070,7 +1072,7 @@ void Player::initSayMenu()
if (i < 10) { if (i < 10) {
newAction->setShortcut(QKeySequence("Ctrl+" + QString::number((i + 1) % 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); sayMenu->addAction(newAction);
} }
} }
@ -1106,7 +1108,7 @@ void Player::setDeck(const DeckLoader &_deck)
if (i < 10) { if (i < 10) {
a->setShortcut(QKeySequence("Alt+" + QString::number((i + 1) % 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); auto *createRelated = new QAction(text, this);
createRelated->setData(QVariant(index++)); createRelated->setData(QVariant(index++));
connect(createRelated, SIGNAL(triggered()), this, SLOT(actCreateRelatedCard())); connect(createRelated, &QAction::triggered, this, &Player::actCreateRelatedCard);
cardMenu->addAction(createRelated); cardMenu->addAction(createRelated);
} }
@ -4006,7 +4008,7 @@ void Player::addRelatedCardActions(const CardItem *card, QMenu *cardMenu)
createRelatedCards->setShortcut( createRelatedCards->setShortcut(
SettingsCache::instance().shortcuts().getSingleShortcut("Player/aCreateRelatedTokens")); SettingsCache::instance().shortcuts().getSingleShortcut("Player/aCreateRelatedTokens"));
} }
connect(createRelatedCards, SIGNAL(triggered()), this, SLOT(actCreateAllRelatedCards())); connect(createRelatedCards, &QAction::triggered, this, &Player::actCreateAllRelatedCards);
cardMenu->addAction(createRelatedCards); cardMenu->addAction(createRelatedCards);
} }
} }

View file

@ -72,8 +72,7 @@ PlayerListWidget::PlayerListWidget(TabSupervisor *_tabSupervisor,
setItemDelegate(itemDelegate); setItemDelegate(itemDelegate);
userContextMenu = new UserContextMenu(tabSupervisor, this, game); userContextMenu = new UserContextMenu(tabSupervisor, this, game);
connect(userContextMenu, SIGNAL(openMessageDialog(QString, bool)), this, connect(userContextMenu, &UserContextMenu::openMessageDialog, this, &PlayerListWidget::openMessageDialog);
SIGNAL(openMessageDialog(QString, bool)));
} else { } else {
userContextMenu = nullptr; userContextMenu = nullptr;
} }

View file

@ -158,7 +158,7 @@ AbstractCounter *PlayerTarget::addCounter(int _counterId, const QString &_name,
playerCounter = new PlayerCounter(owner, _counterId, _name, _value, this, game); playerCounter = new PlayerCounter(owner, _counterId, _name, _value, this, game);
playerCounter->setPos(boundingRect().width() - playerCounter->boundingRect().width(), playerCounter->setPos(boundingRect().width() - playerCounter->boundingRect().width(),
boundingRect().height() - playerCounter->boundingRect().height()); boundingRect().height() - playerCounter->boundingRect().height());
connect(playerCounter, SIGNAL(destroyed()), this, SLOT(counterDeleted())); connect(playerCounter, &PlayerCounter::destroyed, this, &PlayerTarget::counterDeleted);
return playerCounter; return playerCounter;
} }

View file

@ -12,7 +12,7 @@
HandZone::HandZone(Player *_p, bool _contentsKnown, int _zoneHeight, QGraphicsItem *parent) HandZone::HandZone(Player *_p, bool _contentsKnown, int _zoneHeight, QGraphicsItem *parent)
: SelectZone(_p, "hand", false, false, _contentsKnown, parent), zoneHeight(_zoneHeight) : SelectZone(_p, "hand", false, false, _contentsKnown, parent), zoneHeight(_zoneHeight)
{ {
connect(themeManager, SIGNAL(themeChanged()), this, SLOT(updateBg())); connect(themeManager, &ThemeManager::themeChanged, this, &HandZone::updateBg);
updateBg(); updateBg();
setCacheMode(DeviceCoordinateCache); setCacheMode(DeviceCoordinateCache);
} }

View file

@ -50,7 +50,7 @@ void PileZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*optio
void PileZone::addCardImpl(CardItem *card, int x, int /*y*/) 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 is negative set it to add at end
if (x < 0 || x >= cards.size()) { if (x < 0 || x >= cards.size()) {
x = cards.size(); x = cards.size();

View file

@ -14,7 +14,7 @@
StackZone::StackZone(Player *_p, int _zoneHeight, QGraphicsItem *parent) StackZone::StackZone(Player *_p, int _zoneHeight, QGraphicsItem *parent)
: SelectZone(_p, "stack", false, false, true, parent), zoneHeight(_zoneHeight) : SelectZone(_p, "stack", false, false, true, parent), zoneHeight(_zoneHeight)
{ {
connect(themeManager, SIGNAL(themeChanged()), this, SLOT(updateBg())); connect(themeManager, &ThemeManager::themeChanged, this, &StackZone::updateBg);
updateBg(); updateBg();
setCacheMode(DeviceCoordinateCache); setCacheMode(DeviceCoordinateCache);
} }

View file

@ -22,8 +22,9 @@ const QColor TableZone::GRADIENT_COLORLESS = QColor(255, 255, 255, 0);
TableZone::TableZone(Player *_p, QGraphicsItem *parent) TableZone::TableZone(Player *_p, QGraphicsItem *parent)
: SelectZone(_p, "table", true, false, true, parent), active(false) : SelectZone(_p, "table", true, false, true, parent), active(false)
{ {
connect(themeManager, SIGNAL(themeChanged()), this, SLOT(updateBg())); connect(themeManager, &ThemeManager::themeChanged, this, &TableZone::updateBg);
connect(&SettingsCache::instance(), SIGNAL(invertVerticalCoordinateChanged()), this, SLOT(reorganizeCards())); connect(&SettingsCache::instance(), &SettingsCache::invertVerticalCoordinateChanged, this,
&TableZone::reorganizeCards);
updateBg(); updateBg();

View file

@ -77,8 +77,9 @@ void ZoneViewZone::initializeCards(const QList<const ServerInfo_Card *> &cardLis
cmd.set_is_reversed(isReversed); cmd.set_is_reversed(isReversed);
PendingCommand *pend = player->prepareGameCommand(cmd); PendingCommand *pend = player->prepareGameCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend,
SLOT(zoneDumpReceived(const Response &))); qOverload<const Response &, const CommandContainer &, const QVariant &>(&PendingCommand::finished),
this, &ZoneViewZone::zoneDumpReceived);
player->sendGameCommand(pend); player->sendGameCommand(pend);
} else { } else {
const CardList &c = origZone->getCards(); const CardList &c = origZone->getCards();
@ -92,7 +93,9 @@ void ZoneViewZone::initializeCards(const QList<const ServerInfo_Card *> &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 Response_DumpZone &resp = r.GetExtension(Response_DumpZone::ext);
const int respCardListSize = resp.zone_info().card_list_size(); const int respCardListSize = resp.zone_info().card_list_size();

View file

@ -4,6 +4,7 @@
#include "select_zone.h" #include "select_zone.h"
#include <QGraphicsLayoutItem> #include <QGraphicsLayoutItem>
#include <pb/commands.pb.h>
class ZoneViewWidget; class ZoneViewWidget;
class Response; class Response;
@ -94,7 +95,7 @@ public slots:
void setSortBy(CardList::SortOption _sortBy); void setSortBy(CardList::SortOption _sortBy);
void setPileView(int _pileView); void setPileView(int _pileView);
private slots: private slots:
void zoneDumpReceived(const Response &r); void zoneDumpReceived(const Response &r, const CommandContainer &, const QVariant &);
signals: signals:
void beingDeleted(); void beingDeleted();
void optimumRectChanged(); void optimumRectChanged();

View file

@ -110,8 +110,7 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
zone = zone =
new ZoneViewZone(player, _origZone, numberCards, _revealZone, _writeableRevealZone, zoneContainer, _isReversed); new ZoneViewZone(player, _origZone, numberCards, _revealZone, _writeableRevealZone, zoneContainer, _isReversed);
connect(zone, SIGNAL(wheelEventReceived(QGraphicsSceneWheelEvent *)), scrollBarProxy, connect(zone, &ZoneViewZone::wheelEventReceived, scrollBarProxy, &ScrollableGraphicsProxyWidget::recieveWheelEvent);
SLOT(recieveWheelEvent(QGraphicsSceneWheelEvent *)));
retranslateUi(); retranslateUi();
@ -133,8 +132,8 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
setLayout(vbox); setLayout(vbox);
connect(zone, SIGNAL(optimumRectChanged()), this, SLOT(resizeToZoneContents())); connect(zone, &ZoneViewZone::optimumRectChanged, this, &ZoneViewWidget::resizeToZoneContents);
connect(zone, SIGNAL(beingDeleted()), this, SLOT(zoneDeleted())); connect(zone, &ZoneViewZone::beingDeleted, this, &ZoneViewWidget::zoneDeleted);
zone->initializeCards(cardList); zone->initializeCards(cardList);
// QLabel sizes aren't taken into account until the widget is rendered. // 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) void ZoneViewWidget::closeEvent(QCloseEvent *event)
{ {
disconnect(zone, SIGNAL(beingDeleted()), this, 0); disconnect(zone, &ZoneViewZone::beingDeleted, this, 0);
if (shuffleCheckBox.isChecked()) if (shuffleCheckBox.isChecked())
player->sendGameCommand(Command_Shuffle()); player->sendGameCommand(Command_Shuffle());
emit closePressed(this); emit closePressed(this);