Refactor files in common to new Qt Slot/Signal syntax (#5872)

This commit is contained in:
RickyRister
2025-04-21 13:30:40 -07:00
committed by GitHub
parent ffe02e59c7
commit bcaa6c6b8a
4 changed files with 11 additions and 10 deletions

View File

@@ -51,8 +51,7 @@ Server::Server(QObject *parent) : QObject(parent), nextLocalGameId(0), tcpUserCo
qRegisterMetaType<IslMessage>("IslMessage");
qRegisterMetaType<Command_JoinGame>("Command_JoinGame");
connect(this, SIGNAL(sigSendIslMessage(IslMessage, int)), this, SLOT(doSendIslMessage(IslMessage, int)),
Qt::QueuedConnection);
connect(this, &Server::sigSendIslMessage, this, &Server::doSendIslMessage, Qt::QueuedConnection);
}
void Server::prepareDestroy()
@@ -67,7 +66,7 @@ void Server::prepareDestroy()
void Server::setDatabaseInterface(Server_DatabaseInterface *_databaseInterface)
{
connect(this, SIGNAL(endSession(qint64)), _databaseInterface, SLOT(endSession(qint64)));
connect(this, &Server::endSession, _databaseInterface, &Server_DatabaseInterface::endSession);
databaseInterfaces.insert(QThread::currentThread(), _databaseInterface);
}
@@ -568,7 +567,8 @@ void Server::addRoom(Server_Room *newRoom)
QWriteLocker locker(&roomsLock);
qDebug() << "Adding room: ID=" << newRoom->getId() << "name=" << newRoom->getName();
rooms.insert(newRoom->getId(), newRoom);
connect(newRoom, SIGNAL(roomInfoChanged(ServerInfo_Room)), this, SLOT(broadcastRoomUpdate(const ServerInfo_Room &)),
connect(
newRoom, &Server_Room::roomInfoChanged, this, [this](auto roomInfo) { broadcastRoomUpdate(roomInfo); },
Qt::QueuedConnection);
}

View File

@@ -87,7 +87,7 @@ Server_Game::Server_Game(const ServerInfo_User &_creatorInfo,
if (room->getServer()->getGameShouldPing()) {
pingClock = new QTimer(this);
connect(pingClock, SIGNAL(timeout()), this, SLOT(pingClockTimeout()));
connect(pingClock, &QTimer::timeout, this, &Server_Game::pingClockTimeout);
pingClock->start(1000);
}
}

View File

@@ -36,7 +36,7 @@ Server_ProtocolHandler::Server_ProtocolHandler(Server *_server,
idleClientWarningSent(false), timeRunning(0), lastDataReceived(0), lastActionReceived(0)
{
connect(server, SIGNAL(pingClockTimeout()), this, SLOT(pingClockTimeout()));
connect(server, &Server::pingClockTimeout, this, &Server_ProtocolHandler::pingClockTimeout);
}
Server_ProtocolHandler::~Server_ProtocolHandler()

View File

@@ -31,7 +31,8 @@ Server_Room::Server_Room(int _id,
permissionLevel(_permissionLevel), privilegeLevel(_privilegeLevel), autoJoin(_autoJoin),
joinMessage(_joinMessage), gameTypes(_gameTypes), gamesLock(QReadWriteLock::Recursive)
{
connect(this, SIGNAL(gameListChanged(ServerInfo_Game)), this, SLOT(broadcastGameListUpdate(ServerInfo_Game)),
connect(
this, &Server_Room::gameListChanged, this, [this](auto gameInfo) { broadcastGameListUpdate(gameInfo); },
Qt::QueuedConnection);
}
@@ -352,7 +353,7 @@ void Server_Room::addGame(Server_Game *game)
roomInfo.set_room_id(id);
gamesLock.lockForWrite();
connect(game, SIGNAL(gameInfoChanged(ServerInfo_Game)), this, SLOT(broadcastGameListUpdate(ServerInfo_Game)));
connect(game, &Server_Game::gameInfoChanged, this, [this](auto gameInfo) { broadcastGameListUpdate(gameInfo); });
game->gameMutex.lock();
games.insert(game->getGameId(), game);