Refactor files in src/server to new Qt Slot/Signal syntax (#5831)

* Refactor files in src/server to new Qt Slot/Signal syntax

* fix deprecation warning
This commit is contained in:
RickyRister 2025-04-15 15:08:02 -07:00 committed by ebbit1q
parent d7c7cc588f
commit c0e0c4cf34
10 changed files with 84 additions and 116 deletions

View file

@ -60,7 +60,7 @@ ChatView::ChatView(TabSupervisor *_tabSupervisor, TabGame *_game, bool _showTime
setReadOnly(true); setReadOnly(true);
setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse); setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
setOpenLinks(false); setOpenLinks(false);
connect(this, SIGNAL(anchorClicked(const QUrl &)), this, SLOT(openLink(const QUrl &))); connect(this, &ChatView::anchorClicked, this, &ChatView::openLink);
} }
void ChatView::retranslateUi() void ChatView::retranslateUi()

View file

@ -19,7 +19,7 @@ void HandlePublicServers::downloadPublicServers()
{ {
QUrl url(QString(PUBLIC_SERVERS_JSON)); QUrl url(QString(PUBLIC_SERVERS_JSON));
reply = nam->get(QNetworkRequest(url)); reply = nam->get(QNetworkRequest(url));
connect(reply, SIGNAL(finished()), this, SLOT(actFinishParsingDownloadedData())); connect(reply, &QNetworkReply::finished, this, &HandlePublicServers::actFinishParsingDownloadedData);
} }
void HandlePublicServers::actFinishParsingDownloadedData() void HandlePublicServers::actFinishParsingDownloadedData()

View file

@ -10,7 +10,7 @@ LocalClient::LocalClient(LocalServerInterface *_lsi,
QObject *parent) QObject *parent)
: AbstractClient(parent), lsi(_lsi) : AbstractClient(parent), lsi(_lsi)
{ {
connect(lsi, SIGNAL(itemToClient(const ServerMessage &)), this, SLOT(itemFromServer(const ServerMessage &))); connect(lsi, &LocalServerInterface::itemToClient, this, &LocalClient::itemFromServer);
userName = _playerName; userName = _playerName;

View file

@ -820,42 +820,28 @@ void MessageLogWidget::appendHtmlServerMessage(const QString &html, bool optiona
void MessageLogWidget::connectToPlayer(Player *player) void MessageLogWidget::connectToPlayer(Player *player)
{ {
connect(player, SIGNAL(logSay(Player *, QString)), this, SLOT(logSay(Player *, QString))); connect(player, &Player::logSay, this, &MessageLogWidget::logSay);
connect(player, &Player::logShuffle, this, &MessageLogWidget::logShuffle); connect(player, &Player::logShuffle, this, &MessageLogWidget::logShuffle);
connect(player, SIGNAL(logRollDie(Player *, int, const QList<uint> &)), this, connect(player, &Player::logRollDie, this, &MessageLogWidget::logRollDie);
SLOT(logRollDie(Player *, int, const QList<uint> &))); connect(player, &Player::logCreateArrow, this, &MessageLogWidget::logCreateArrow);
connect(player, SIGNAL(logCreateArrow(Player *, Player *, QString, Player *, QString, bool)), this, connect(player, &Player::logCreateToken, this, &MessageLogWidget::logCreateToken);
SLOT(logCreateArrow(Player *, Player *, QString, Player *, QString, bool))); connect(player, &Player::logSetCounter, this, &MessageLogWidget::logSetCounter);
connect(player, SIGNAL(logCreateToken(Player *, QString, QString)), this, connect(player, &Player::logSetCardCounter, this, &MessageLogWidget::logSetCardCounter);
SLOT(logCreateToken(Player *, QString, QString))); connect(player, &Player::logSetTapped, this, &MessageLogWidget::logSetTapped);
connect(player, SIGNAL(logSetCounter(Player *, QString, int, int)), this, connect(player, &Player::logSetDoesntUntap, this, &MessageLogWidget::logSetDoesntUntap);
SLOT(logSetCounter(Player *, QString, int, int))); connect(player, &Player::logSetPT, this, &MessageLogWidget::logSetPT);
connect(player, SIGNAL(logSetCardCounter(Player *, QString, int, int, int)), this, connect(player, &Player::logSetAnnotation, this, &MessageLogWidget::logSetAnnotation);
SLOT(logSetCardCounter(Player *, QString, int, int, int))); connect(player, &Player::logMoveCard, this, &MessageLogWidget::logMoveCard);
connect(player, SIGNAL(logSetTapped(Player *, CardItem *, bool)), this, connect(player, &Player::logFlipCard, this, &MessageLogWidget::logFlipCard);
SLOT(logSetTapped(Player *, CardItem *, bool))); connect(player, &Player::logDestroyCard, this, &MessageLogWidget::logDestroyCard);
connect(player, SIGNAL(logSetDoesntUntap(Player *, CardItem *, bool)), this, connect(player, &Player::logAttachCard, this, &MessageLogWidget::logAttachCard);
SLOT(logSetDoesntUntap(Player *, CardItem *, bool))); connect(player, &Player::logUnattachCard, this, &MessageLogWidget::logUnattachCard);
connect(player, SIGNAL(logSetPT(Player *, CardItem *, QString)), this,
SLOT(logSetPT(Player *, CardItem *, QString)));
connect(player, SIGNAL(logSetAnnotation(Player *, CardItem *, QString)), this,
SLOT(logSetAnnotation(Player *, CardItem *, QString)));
connect(player, SIGNAL(logMoveCard(Player *, CardItem *, CardZone *, int, CardZone *, int)), this,
SLOT(logMoveCard(Player *, CardItem *, CardZone *, int, CardZone *, int)));
connect(player, SIGNAL(logFlipCard(Player *, QString, bool)), this, SLOT(logFlipCard(Player *, QString, bool)));
connect(player, SIGNAL(logDestroyCard(Player *, QString)), this, SLOT(logDestroyCard(Player *, QString)));
connect(player, SIGNAL(logAttachCard(Player *, QString, Player *, QString)), this,
SLOT(logAttachCard(Player *, QString, Player *, QString)));
connect(player, SIGNAL(logUnattachCard(Player *, QString)), this, SLOT(logUnattachCard(Player *, QString)));
connect(player, &Player::logDumpZone, this, &MessageLogWidget::logDumpZone); connect(player, &Player::logDumpZone, this, &MessageLogWidget::logDumpZone);
connect(player, SIGNAL(logDrawCards(Player *, int, bool)), this, SLOT(logDrawCards(Player *, int, bool))); connect(player, &Player::logDrawCards, this, &MessageLogWidget::logDrawCards);
connect(player, SIGNAL(logUndoDraw(Player *, QString)), this, SLOT(logUndoDraw(Player *, QString))); connect(player, &Player::logUndoDraw, this, &MessageLogWidget::logUndoDraw);
connect(player, SIGNAL(logRevealCards(Player *, CardZone *, int, QString, Player *, bool, int, bool)), this, connect(player, &Player::logRevealCards, this, &MessageLogWidget::logRevealCards);
SLOT(logRevealCards(Player *, CardZone *, int, QString, Player *, bool, int, bool))); connect(player, &Player::logAlwaysRevealTopCard, this, &MessageLogWidget::logAlwaysRevealTopCard);
connect(player, SIGNAL(logAlwaysRevealTopCard(Player *, CardZone *, bool)), this, connect(player, &Player::logAlwaysLookAtTopCard, this, &MessageLogWidget::logAlwaysLookAtTopCard);
SLOT(logAlwaysRevealTopCard(Player *, CardZone *, bool)));
connect(player, SIGNAL(logAlwaysLookAtTopCard(Player *, CardZone *, bool)), this,
SLOT(logAlwaysLookAtTopCard(Player *, CardZone *, bool)));
} }
MessageLogWidget::MessageLogWidget(TabSupervisor *_tabSupervisor, TabGame *_game, QWidget *parent) MessageLogWidget::MessageLogWidget(TabSupervisor *_tabSupervisor, TabGame *_game, QWidget *parent)

View file

@ -36,42 +36,43 @@ RemoteClient::RemoteClient(QObject *parent)
int keepalive = SettingsCache::instance().getKeepAlive(); int keepalive = SettingsCache::instance().getKeepAlive();
timer = new QTimer(this); timer = new QTimer(this);
timer->setInterval(keepalive * 1000); timer->setInterval(keepalive * 1000);
connect(timer, SIGNAL(timeout()), this, SLOT(ping())); connect(timer, &QTimer::timeout, this, &RemoteClient::ping);
socket = new QTcpSocket(this); socket = new QTcpSocket(this);
socket->setSocketOption(QAbstractSocket::LowDelayOption, 1); socket->setSocketOption(QAbstractSocket::LowDelayOption, 1);
connect(socket, SIGNAL(connected()), this, SLOT(slotConnected())); connect(socket, &QTcpSocket::connected, this, &RemoteClient::slotConnected);
connect(socket, SIGNAL(readyRead()), this, SLOT(readData())); connect(socket, &QTcpSocket::readyRead, this, &RemoteClient::readData);
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
connect(socket, &QTcpSocket::errorOccurred, this, &RemoteClient::slotSocketError); connect(socket, &QTcpSocket::errorOccurred, this, &RemoteClient::slotSocketError);
#else #else
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, connect(socket, qOverload<QAbstractSocket::SocketError>(&QTcpSocket::error), this, &RemoteClient::slotSocketError);
SLOT(slotSocketError(QAbstractSocket::SocketError)));
#endif #endif
websocket = new QWebSocket(QString(), QWebSocketProtocol::VersionLatest, this); websocket = new QWebSocket(QString(), QWebSocketProtocol::VersionLatest, this);
connect(websocket, &QWebSocket::binaryMessageReceived, this, &RemoteClient::websocketMessageReceived); connect(websocket, &QWebSocket::binaryMessageReceived, this, &RemoteClient::websocketMessageReceived);
connect(websocket, &QWebSocket::connected, this, &RemoteClient::slotConnected); connect(websocket, &QWebSocket::connected, this, &RemoteClient::slotConnected);
connect(websocket, SIGNAL(error(QAbstractSocket::SocketError)), this,
SLOT(slotWebSocketError(QAbstractSocket::SocketError)));
connect(this, SIGNAL(serverIdentificationEventReceived(const Event_ServerIdentification &)), this, #if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
SLOT(processServerIdentificationEvent(const Event_ServerIdentification &))); connect(websocket, &QWebSocket::errorOccurred, this, &RemoteClient::slotWebSocketError);
connect(this, SIGNAL(connectionClosedEventReceived(Event_ConnectionClosed)), this, #else
SLOT(processConnectionClosedEvent(Event_ConnectionClosed))); connect(websocket, qOverload<QAbstractSocket::SocketError>(&QWebSocket::error), this,
connect(this, SIGNAL(sigConnectToServer(QString, unsigned int, QString, QString)), this, &RemoteClient::slotWebSocketError);
SLOT(doConnectToServer(QString, unsigned int, QString, QString))); #endif
connect(this, SIGNAL(sigDisconnectFromServer()), this, SLOT(doDisconnectFromServer()));
connect(this, SIGNAL(sigRegisterToServer(QString, unsigned int, QString, QString, QString, QString, QString)), this, connect(this, &RemoteClient::serverIdentificationEventReceived, this,
SLOT(doRegisterToServer(QString, unsigned int, QString, QString, QString, QString, QString))); &RemoteClient::processServerIdentificationEvent);
connect(this, SIGNAL(sigActivateToServer(QString)), this, SLOT(doActivateToServer(QString))); connect(this, &RemoteClient::connectionClosedEventReceived, this, &RemoteClient::processConnectionClosedEvent);
connect(this, SIGNAL(sigRequestForgotPasswordToServer(QString, unsigned int, QString)), this, connect(this, &RemoteClient::sigConnectToServer, this, &RemoteClient::doConnectToServer);
SLOT(doRequestForgotPasswordToServer(QString, unsigned int, QString))); connect(this, &RemoteClient::sigDisconnectFromServer, this, &RemoteClient::doDisconnectFromServer);
connect(this, SIGNAL(sigSubmitForgotPasswordResetToServer(QString, unsigned int, QString, QString, QString)), this, connect(this, &RemoteClient::sigRegisterToServer, this, &RemoteClient::doRegisterToServer);
SLOT(doSubmitForgotPasswordResetToServer(QString, unsigned int, QString, QString, QString))); connect(this, &RemoteClient::sigActivateToServer, this, &RemoteClient::doActivateToServer);
connect(this, SIGNAL(sigSubmitForgotPasswordChallengeToServer(QString, unsigned int, QString, QString)), this, connect(this, &RemoteClient::sigRequestForgotPasswordToServer, this,
SLOT(doSubmitForgotPasswordChallengeToServer(QString, unsigned int, QString, QString))); &RemoteClient::doRequestForgotPasswordToServer);
connect(this, &RemoteClient::sigSubmitForgotPasswordResetToServer, this,
&RemoteClient::doSubmitForgotPasswordResetToServer);
connect(this, &RemoteClient::sigSubmitForgotPasswordChallengeToServer, this,
&RemoteClient::doSubmitForgotPasswordChallengeToServer);
} }
RemoteClient::~RemoteClient() RemoteClient::~RemoteClient()
@ -124,8 +125,7 @@ void RemoteClient::processServerIdentificationEvent(const Event_ServerIdentifica
cmdForgotPasswordRequest.set_user_name(userName.toStdString()); cmdForgotPasswordRequest.set_user_name(userName.toStdString());
cmdForgotPasswordRequest.set_clientid(getSrvClientID(lastHostname).toStdString()); cmdForgotPasswordRequest.set_clientid(getSrvClientID(lastHostname).toStdString());
PendingCommand *pend = prepareSessionCommand(cmdForgotPasswordRequest); PendingCommand *pend = prepareSessionCommand(cmdForgotPasswordRequest);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &RemoteClient::requestForgotPasswordResponse);
SLOT(requestForgotPasswordResponse(Response)));
sendCommand(pend); sendCommand(pend);
return; return;
} }
@ -144,8 +144,7 @@ void RemoteClient::processServerIdentificationEvent(const Event_ServerIdentifica
cmdForgotPasswordReset.set_new_password(password.toStdString()); cmdForgotPasswordReset.set_new_password(password.toStdString());
} }
PendingCommand *pend = prepareSessionCommand(cmdForgotPasswordReset); PendingCommand *pend = prepareSessionCommand(cmdForgotPasswordReset);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &RemoteClient::submitForgotPasswordResetResponse);
SLOT(submitForgotPasswordResetResponse(Response)));
sendCommand(pend); sendCommand(pend);
return; return;
} }
@ -156,8 +155,7 @@ void RemoteClient::processServerIdentificationEvent(const Event_ServerIdentifica
cmdForgotPasswordChallenge.set_clientid(getSrvClientID(lastHostname).toStdString()); cmdForgotPasswordChallenge.set_clientid(getSrvClientID(lastHostname).toStdString());
cmdForgotPasswordChallenge.set_email(email.toStdString()); cmdForgotPasswordChallenge.set_email(email.toStdString());
PendingCommand *pend = prepareSessionCommand(cmdForgotPasswordChallenge); PendingCommand *pend = prepareSessionCommand(cmdForgotPasswordChallenge);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &RemoteClient::submitForgotPasswordChallengeResponse);
SLOT(submitForgotPasswordChallengeResponse(Response)));
sendCommand(pend); sendCommand(pend);
return; return;
} }
@ -178,7 +176,7 @@ void RemoteClient::processServerIdentificationEvent(const Event_ServerIdentifica
cmdRegister.set_real_name(realName.toStdString()); cmdRegister.set_real_name(realName.toStdString());
cmdRegister.set_clientid(getSrvClientID(lastHostname).toStdString()); cmdRegister.set_clientid(getSrvClientID(lastHostname).toStdString());
PendingCommand *pend = prepareSessionCommand(cmdRegister); PendingCommand *pend = prepareSessionCommand(cmdRegister);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(registerResponse(Response))); connect(pend, &PendingCommand::finished, this, &RemoteClient::registerResponse);
sendCommand(pend); sendCommand(pend);
return; return;
@ -191,7 +189,7 @@ void RemoteClient::processServerIdentificationEvent(const Event_ServerIdentifica
cmdActivate.set_clientid(getSrvClientID(lastHostname).toStdString()); cmdActivate.set_clientid(getSrvClientID(lastHostname).toStdString());
PendingCommand *pend = prepareSessionCommand(cmdActivate); PendingCommand *pend = prepareSessionCommand(cmdActivate);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(activateResponse(Response))); connect(pend, &PendingCommand::finished, this, &RemoteClient::activateResponse);
sendCommand(pend); sendCommand(pend);
return; return;
@ -207,7 +205,7 @@ void RemoteClient::doRequestPasswordSalt()
cmdRqSalt.set_user_name(userName.toStdString()); cmdRqSalt.set_user_name(userName.toStdString());
PendingCommand *pend = prepareSessionCommand(cmdRqSalt); PendingCommand *pend = prepareSessionCommand(cmdRqSalt);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(passwordSaltResponse(Response))); connect(pend, &PendingCommand::finished, this, &RemoteClient::passwordSaltResponse);
sendCommand(pend); sendCommand(pend);
} }
@ -246,7 +244,7 @@ void RemoteClient::doLogin()
} }
PendingCommand *pend = prepareSessionCommand(cmdLogin); PendingCommand *pend = prepareSessionCommand(cmdLogin);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(loginResponse(Response))); connect(pend, &PendingCommand::finished, this, &RemoteClient::loginResponse);
sendCommand(pend); sendCommand(pend);
} }
} }
@ -259,7 +257,7 @@ void RemoteClient::doHashedLogin()
cmdLogin.set_hashed_password(hashedPassword.toStdString()); cmdLogin.set_hashed_password(hashedPassword.toStdString());
PendingCommand *pend = prepareSessionCommand(cmdLogin); PendingCommand *pend = prepareSessionCommand(cmdLogin);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(loginResponse(Response))); connect(pend, &PendingCommand::finished, this, &RemoteClient::loginResponse);
sendCommand(pend); sendCommand(pend);
} }

View file

@ -263,8 +263,7 @@ void RemoteDeckList_TreeModel::removeNode(RemoteDeckList_TreeModel::Node *node)
void RemoteDeckList_TreeModel::refreshTree() void RemoteDeckList_TreeModel::refreshTree()
{ {
PendingCommand *pend = client->prepareSessionCommand(Command_DeckList()); PendingCommand *pend = client->prepareSessionCommand(Command_DeckList());
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &RemoteDeckList_TreeModel::deckListFinished);
SLOT(deckListFinished(const Response &)));
client->sendCommand(pend); client->sendCommand(pend);
} }
@ -298,7 +297,7 @@ RemoteDeckList_TreeWidget::RemoteDeckList_TreeWidget(AbstractClient *_client, QW
proxyModel->setDynamicSortFilter(true); proxyModel->setDynamicSortFilter(true);
proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
setModel(proxyModel); setModel(proxyModel);
connect(treeModel, SIGNAL(treeRefreshed()), this, SLOT(expandAll())); connect(treeModel, &RemoteDeckList_TreeModel::treeRefreshed, this, &RemoteDeckList_TreeWidget::expandAll);
header()->setSectionResizeMode(QHeaderView::ResizeToContents); header()->setSectionResizeMode(QHeaderView::ResizeToContents);
setUniformRowHeights(true); setUniformRowHeights(true);

View file

@ -253,8 +253,7 @@ void RemoteReplayList_TreeModel::clearAll()
void RemoteReplayList_TreeModel::refreshTree() void RemoteReplayList_TreeModel::refreshTree()
{ {
PendingCommand *pend = client->prepareSessionCommand(Command_ReplayList()); PendingCommand *pend = client->prepareSessionCommand(Command_ReplayList());
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &RemoteReplayList_TreeModel::replayListFinished);
SLOT(replayListFinished(const Response &)));
client->sendCommand(pend); client->sendCommand(pend);
} }

View file

@ -116,7 +116,7 @@ void UserContextMenu::banUser_processUserInfoResponse(const Response &r)
// The dialog needs to be non-modal in order to not block the event queue of the client. // The dialog needs to be non-modal in order to not block the event queue of the client.
BanDialog *dlg = new BanDialog(response.user_info(), static_cast<QWidget *>(parent())); BanDialog *dlg = new BanDialog(response.user_info(), static_cast<QWidget *>(parent()));
connect(dlg, SIGNAL(accepted()), this, SLOT(banUser_dialogFinished())); connect(dlg, &QDialog::accepted, this, &UserContextMenu::banUser_dialogFinished);
dlg->show(); dlg->show();
} }
@ -129,7 +129,7 @@ void UserContextMenu::warnUser_processGetWarningsListResponse(const Response &r)
// The dialog needs to be non-modal in order to not block the event queue of the client. // The dialog needs to be non-modal in order to not block the event queue of the client.
WarningDialog *dlg = new WarningDialog(user, clientid, static_cast<QWidget *>(parent())); WarningDialog *dlg = new WarningDialog(user, clientid, static_cast<QWidget *>(parent()));
connect(dlg, SIGNAL(accepted()), this, SLOT(warnUser_dialogFinished())); connect(dlg, &QDialog::accepted, this, &UserContextMenu::warnUser_dialogFinished);
if (response.warning_size() > 0) { if (response.warning_size() > 0) {
for (int i = 0; i < response.warning_size(); ++i) { for (int i = 0; i < response.warning_size(); ++i) {
@ -148,8 +148,7 @@ void UserContextMenu::warnUser_processUserInfoResponse(const Response &resp)
cmd.set_user_name(userInfo.name()); cmd.set_user_name(userInfo.name());
cmd.set_user_clientid(userInfo.clientid()); cmd.set_user_clientid(userInfo.clientid());
PendingCommand *pend = client->prepareModeratorCommand(cmd); PendingCommand *pend = client->prepareModeratorCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &UserContextMenu::warnUser_processGetWarningsListResponse);
SLOT(warnUser_processGetWarningsListResponse(Response)));
client->sendCommand(pend); client->sendCommand(pend);
} }
@ -433,8 +432,7 @@ void UserContextMenu::showContextMenu(const QPoint &pos,
cmd.set_user_name(userName.toStdString()); cmd.set_user_name(userName.toStdString());
PendingCommand *pend = client->prepareSessionCommand(cmd); PendingCommand *pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &UserContextMenu::gamesOfUserReceived);
SLOT(gamesOfUserReceived(Response, CommandContainer)));
client->sendCommand(pend); client->sendCommand(pend);
} else if (actionClicked == aAddToBuddyList) { } else if (actionClicked == aAddToBuddyList) {
@ -471,8 +469,7 @@ void UserContextMenu::showContextMenu(const QPoint &pos,
cmd.set_user_name(userName.toStdString()); cmd.set_user_name(userName.toStdString());
PendingCommand *pend = client->prepareSessionCommand(cmd); PendingCommand *pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &UserContextMenu::banUser_processUserInfoResponse);
SLOT(banUser_processUserInfoResponse(Response)));
client->sendCommand(pend); client->sendCommand(pend);
} else if (actionClicked == aPromoteToMod || actionClicked == aDemoteFromMod) { } else if (actionClicked == aPromoteToMod || actionClicked == aDemoteFromMod) {
Command_AdjustMod cmd; Command_AdjustMod cmd;
@ -480,8 +477,7 @@ void UserContextMenu::showContextMenu(const QPoint &pos,
cmd.set_should_be_mod(actionClicked == aPromoteToMod); cmd.set_should_be_mod(actionClicked == aPromoteToMod);
PendingCommand *pend = client->prepareAdminCommand(cmd); PendingCommand *pend = client->prepareAdminCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &UserContextMenu::adjustMod_processUserResponse);
SLOT(adjustMod_processUserResponse(Response, CommandContainer)));
client->sendCommand(pend); client->sendCommand(pend);
} else if (actionClicked == aPromoteToJudge || actionClicked == aDemoteFromJudge) { } else if (actionClicked == aPromoteToJudge || actionClicked == aDemoteFromJudge) {
Command_AdjustMod cmd; Command_AdjustMod cmd;
@ -489,36 +485,31 @@ void UserContextMenu::showContextMenu(const QPoint &pos,
cmd.set_should_be_judge(actionClicked == aPromoteToJudge); cmd.set_should_be_judge(actionClicked == aPromoteToJudge);
PendingCommand *pend = client->prepareAdminCommand(cmd); PendingCommand *pend = client->prepareAdminCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &UserContextMenu::adjustMod_processUserResponse);
SLOT(adjustMod_processUserResponse(Response, CommandContainer)));
client->sendCommand(pend); client->sendCommand(pend);
} else if (actionClicked == aBanHistory) { } else if (actionClicked == aBanHistory) {
Command_GetBanHistory cmd; Command_GetBanHistory cmd;
cmd.set_user_name(userName.toStdString()); cmd.set_user_name(userName.toStdString());
PendingCommand *pend = client->prepareModeratorCommand(cmd); PendingCommand *pend = client->prepareModeratorCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &UserContextMenu::banUserHistory_processResponse);
SLOT(banUserHistory_processResponse(Response)));
client->sendCommand(pend); client->sendCommand(pend);
} else if (actionClicked == aWarnUser) { } else if (actionClicked == aWarnUser) {
Command_GetUserInfo cmd; Command_GetUserInfo cmd;
cmd.set_user_name(userName.toStdString()); cmd.set_user_name(userName.toStdString());
PendingCommand *pend = client->prepareSessionCommand(cmd); PendingCommand *pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &UserContextMenu::warnUser_processUserInfoResponse);
SLOT(warnUser_processUserInfoResponse(Response)));
client->sendCommand(pend); client->sendCommand(pend);
} else if (actionClicked == aWarnHistory) { } else if (actionClicked == aWarnHistory) {
Command_GetWarnHistory cmd; Command_GetWarnHistory cmd;
cmd.set_user_name(userName.toStdString()); cmd.set_user_name(userName.toStdString());
PendingCommand *pend = client->prepareModeratorCommand(cmd); PendingCommand *pend = client->prepareModeratorCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &UserContextMenu::warnUserHistory_processResponse);
SLOT(warnUserHistory_processResponse(Response)));
client->sendCommand(pend); client->sendCommand(pend);
} else if (actionClicked == aGetAdminNotes) { } else if (actionClicked == aGetAdminNotes) {
Command_GetAdminNotes cmd; Command_GetAdminNotes cmd;
cmd.set_user_name(userName.toStdString()); cmd.set_user_name(userName.toStdString());
auto *pend = client->prepareModeratorCommand(cmd); auto *pend = client->prepareModeratorCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &UserContextMenu::getAdminNotes_processResponse);
SLOT(getAdminNotes_processResponse(Response)));
client->sendCommand(pend); client->sendCommand(pend);
} else if (actionClicked == aCopyToClipBoard) { } else if (actionClicked == aCopyToClipBoard) {

View file

@ -63,9 +63,9 @@ UserInfoBox::UserInfoBox(AbstractClient *_client, bool _editable, QWidget *paren
buttonsLayout->addWidget(&avatarButton); buttonsLayout->addWidget(&avatarButton);
mainLayout->addLayout(buttonsLayout, 7, 0, 1, 3); mainLayout->addLayout(buttonsLayout, 7, 0, 1, 3);
connect(&editButton, SIGNAL(clicked()), this, SLOT(actEdit())); connect(&editButton, &QPushButton::clicked, this, &UserInfoBox::actEdit);
connect(&passwordButton, SIGNAL(clicked()), this, SLOT(actPassword())); connect(&passwordButton, &QPushButton::clicked, this, &UserInfoBox::actPassword);
connect(&avatarButton, SIGNAL(clicked()), this, SLOT(actAvatar())); connect(&avatarButton, &QPushButton::clicked, this, &UserInfoBox::actAvatar);
} }
setWindowTitle(tr("User Information")); setWindowTitle(tr("User Information"));
@ -185,8 +185,7 @@ void UserInfoBox::updateInfo(const QString &userName)
cmd.set_user_name(userName.toStdString()); cmd.set_user_name(userName.toStdString());
PendingCommand *pend = client->prepareSessionCommand(cmd); PendingCommand *pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &UserInfoBox::processResponse);
SLOT(processResponse(const Response &)));
client->sendCommand(pend); client->sendCommand(pend);
} }
@ -204,8 +203,7 @@ void UserInfoBox::actEdit()
Command_GetUserInfo cmd; Command_GetUserInfo cmd;
PendingCommand *pend = client->prepareSessionCommand(cmd); PendingCommand *pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &UserInfoBox::actEditInternal);
SLOT(actEditInternal(const Response &)));
client->sendCommand(pend); client->sendCommand(pend);
} }
@ -244,8 +242,7 @@ void UserInfoBox::actEditInternal(const Response &r)
cmd.set_country(dlg.getCountry().toStdString()); cmd.set_country(dlg.getCountry().toStdString());
PendingCommand *pend = client->prepareSessionCommand(cmd); PendingCommand *pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &UserInfoBox::processEditResponse);
SLOT(processEditResponse(const Response &)));
client->sendCommand(pend); client->sendCommand(pend);
} }
@ -291,8 +288,7 @@ void UserInfoBox::changePassword(const QString &oldPassword, const QString &newP
} }
PendingCommand *pend = client->prepareSessionCommand(cmd); PendingCommand *pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &UserInfoBox::processPasswordResponse);
SLOT(processPasswordResponse(const Response &)));
client->sendCommand(pend); client->sendCommand(pend);
} }
@ -307,8 +303,7 @@ void UserInfoBox::actAvatar()
cmd.set_image(dlg.getImage().data(), dlg.getImage().size()); cmd.set_image(dlg.getImage().data(), dlg.getImage().size());
PendingCommand *pend = client->prepareSessionCommand(cmd); PendingCommand *pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, connect(pend, &PendingCommand::finished, this, &UserInfoBox::processAvatarResponse);
SLOT(processAvatarResponse(const Response &)));
client->sendCommand(pend); client->sendCommand(pend);
} }

View file

@ -63,7 +63,7 @@ BanDialog::BanDialog(const ServerInfo_User &info, QWidget *parent) : QDialog(par
permanentRadio = new QRadioButton(tr("&permanent ban")); permanentRadio = new QRadioButton(tr("&permanent ban"));
temporaryRadio = new QRadioButton(tr("&temporary ban")); temporaryRadio = new QRadioButton(tr("&temporary ban"));
temporaryRadio->setChecked(true); temporaryRadio->setChecked(true);
connect(temporaryRadio, SIGNAL(toggled(bool)), this, SLOT(enableTemporaryEdits(bool))); connect(temporaryRadio, &QRadioButton::toggled, this, &BanDialog::enableTemporaryEdits);
daysLabel = new QLabel(tr("&Days:")); daysLabel = new QLabel(tr("&Days:"));
daysEdit = new QSpinBox; daysEdit = new QSpinBox;
daysEdit->setMinimum(0); daysEdit->setMinimum(0);
@ -106,9 +106,9 @@ BanDialog::BanDialog(const ServerInfo_User &info, QWidget *parent) : QDialog(par
QPushButton *okButton = new QPushButton(tr("&OK")); QPushButton *okButton = new QPushButton(tr("&OK"));
okButton->setAutoDefault(true); okButton->setAutoDefault(true);
connect(okButton, SIGNAL(clicked()), this, SLOT(okClicked())); connect(okButton, &QPushButton::clicked, this, &BanDialog::okClicked);
QPushButton *cancelButton = new QPushButton(tr("&Cancel")); QPushButton *cancelButton = new QPushButton(tr("&Cancel"));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); connect(cancelButton, &QPushButton::clicked, this, &BanDialog::reject);
QHBoxLayout *buttonLayout = new QHBoxLayout; QHBoxLayout *buttonLayout = new QHBoxLayout;
buttonLayout->addStretch(); buttonLayout->addStretch();
@ -144,9 +144,9 @@ WarningDialog::WarningDialog(const QString userName, const QString clientID, QWi
QPushButton *okButton = new QPushButton(tr("&OK")); QPushButton *okButton = new QPushButton(tr("&OK"));
okButton->setAutoDefault(true); okButton->setAutoDefault(true);
connect(okButton, SIGNAL(clicked()), this, SLOT(okClicked())); connect(okButton, &QPushButton::clicked, this, &WarningDialog::okClicked);
QPushButton *cancelButton = new QPushButton(tr("&Cancel")); QPushButton *cancelButton = new QPushButton(tr("&Cancel"));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); connect(cancelButton, &QPushButton::clicked, this, &WarningDialog::reject);
QHBoxLayout *buttonLayout = new QHBoxLayout; QHBoxLayout *buttonLayout = new QHBoxLayout;
buttonLayout->addStretch(); buttonLayout->addStretch();
@ -423,7 +423,7 @@ UserListWidget::UserListWidget(TabSupervisor *_tabSupervisor,
{ {
itemDelegate = new UserListItemDelegate(this); itemDelegate = new UserListItemDelegate(this);
userContextMenu = new UserContextMenu(tabSupervisor, this); userContextMenu = new UserContextMenu(tabSupervisor, this);
connect(userContextMenu, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool))); connect(userContextMenu, &UserContextMenu::openMessageDialog, this, &UserListWidget::openMessageDialog);
userTree = new QTreeWidget; userTree = new QTreeWidget;
userTree->setColumnCount(3); userTree->setColumnCount(3);
@ -434,7 +434,7 @@ UserListWidget::UserListWidget(TabSupervisor *_tabSupervisor,
userTree->setIconSize(QSize(20, 18)); userTree->setIconSize(QSize(20, 18));
userTree->setItemDelegate(itemDelegate); userTree->setItemDelegate(itemDelegate);
userTree->setAlternatingRowColors(true); userTree->setAlternatingRowColors(true);
connect(userTree, SIGNAL(itemActivated(QTreeWidgetItem *, int)), this, SLOT(userClicked(QTreeWidgetItem *, int))); connect(userTree, &QTreeWidget::itemActivated, this, &UserListWidget::userClicked);
QVBoxLayout *vbox = new QVBoxLayout; QVBoxLayout *vbox = new QVBoxLayout;
vbox->addWidget(userTree); vbox->addWidget(userTree);