mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-16 23:42:15 -07:00
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:
parent
728c87589f
commit
15415afa9a
10 changed files with 84 additions and 116 deletions
|
|
@ -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.
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
@ -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.
|
||||
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) {
|
||||
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_clientid(userInfo.clientid());
|
||||
PendingCommand *pend = client->prepareModeratorCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this,
|
||||
SLOT(warnUser_processGetWarningsListResponse(Response)));
|
||||
connect(pend, &PendingCommand::finished, this, &UserContextMenu::warnUser_processGetWarningsListResponse);
|
||||
client->sendCommand(pend);
|
||||
}
|
||||
|
||||
|
|
@ -433,8 +432,7 @@ void UserContextMenu::showContextMenu(const QPoint &pos,
|
|||
cmd.set_user_name(userName.toStdString());
|
||||
|
||||
PendingCommand *pend = client->prepareSessionCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this,
|
||||
SLOT(gamesOfUserReceived(Response, CommandContainer)));
|
||||
connect(pend, &PendingCommand::finished, this, &UserContextMenu::gamesOfUserReceived);
|
||||
|
||||
client->sendCommand(pend);
|
||||
} else if (actionClicked == aAddToBuddyList) {
|
||||
|
|
@ -471,8 +469,7 @@ void UserContextMenu::showContextMenu(const QPoint &pos,
|
|||
cmd.set_user_name(userName.toStdString());
|
||||
|
||||
PendingCommand *pend = client->prepareSessionCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this,
|
||||
SLOT(banUser_processUserInfoResponse(Response)));
|
||||
connect(pend, &PendingCommand::finished, this, &UserContextMenu::banUser_processUserInfoResponse);
|
||||
client->sendCommand(pend);
|
||||
} else if (actionClicked == aPromoteToMod || actionClicked == aDemoteFromMod) {
|
||||
Command_AdjustMod cmd;
|
||||
|
|
@ -480,8 +477,7 @@ void UserContextMenu::showContextMenu(const QPoint &pos,
|
|||
cmd.set_should_be_mod(actionClicked == aPromoteToMod);
|
||||
|
||||
PendingCommand *pend = client->prepareAdminCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this,
|
||||
SLOT(adjustMod_processUserResponse(Response, CommandContainer)));
|
||||
connect(pend, &PendingCommand::finished, this, &UserContextMenu::adjustMod_processUserResponse);
|
||||
client->sendCommand(pend);
|
||||
} else if (actionClicked == aPromoteToJudge || actionClicked == aDemoteFromJudge) {
|
||||
Command_AdjustMod cmd;
|
||||
|
|
@ -489,36 +485,31 @@ void UserContextMenu::showContextMenu(const QPoint &pos,
|
|||
cmd.set_should_be_judge(actionClicked == aPromoteToJudge);
|
||||
|
||||
PendingCommand *pend = client->prepareAdminCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this,
|
||||
SLOT(adjustMod_processUserResponse(Response, CommandContainer)));
|
||||
connect(pend, &PendingCommand::finished, this, &UserContextMenu::adjustMod_processUserResponse);
|
||||
client->sendCommand(pend);
|
||||
} else if (actionClicked == aBanHistory) {
|
||||
Command_GetBanHistory cmd;
|
||||
cmd.set_user_name(userName.toStdString());
|
||||
PendingCommand *pend = client->prepareModeratorCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this,
|
||||
SLOT(banUserHistory_processResponse(Response)));
|
||||
connect(pend, &PendingCommand::finished, this, &UserContextMenu::banUserHistory_processResponse);
|
||||
client->sendCommand(pend);
|
||||
} else if (actionClicked == aWarnUser) {
|
||||
Command_GetUserInfo cmd;
|
||||
cmd.set_user_name(userName.toStdString());
|
||||
PendingCommand *pend = client->prepareSessionCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this,
|
||||
SLOT(warnUser_processUserInfoResponse(Response)));
|
||||
connect(pend, &PendingCommand::finished, this, &UserContextMenu::warnUser_processUserInfoResponse);
|
||||
client->sendCommand(pend);
|
||||
} else if (actionClicked == aWarnHistory) {
|
||||
Command_GetWarnHistory cmd;
|
||||
cmd.set_user_name(userName.toStdString());
|
||||
PendingCommand *pend = client->prepareModeratorCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this,
|
||||
SLOT(warnUserHistory_processResponse(Response)));
|
||||
connect(pend, &PendingCommand::finished, this, &UserContextMenu::warnUserHistory_processResponse);
|
||||
client->sendCommand(pend);
|
||||
} else if (actionClicked == aGetAdminNotes) {
|
||||
Command_GetAdminNotes cmd;
|
||||
cmd.set_user_name(userName.toStdString());
|
||||
auto *pend = client->prepareModeratorCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this,
|
||||
SLOT(getAdminNotes_processResponse(Response)));
|
||||
connect(pend, &PendingCommand::finished, this, &UserContextMenu::getAdminNotes_processResponse);
|
||||
client->sendCommand(pend);
|
||||
|
||||
} else if (actionClicked == aCopyToClipBoard) {
|
||||
|
|
|
|||
|
|
@ -63,9 +63,9 @@ UserInfoBox::UserInfoBox(AbstractClient *_client, bool _editable, QWidget *paren
|
|||
buttonsLayout->addWidget(&avatarButton);
|
||||
mainLayout->addLayout(buttonsLayout, 7, 0, 1, 3);
|
||||
|
||||
connect(&editButton, SIGNAL(clicked()), this, SLOT(actEdit()));
|
||||
connect(&passwordButton, SIGNAL(clicked()), this, SLOT(actPassword()));
|
||||
connect(&avatarButton, SIGNAL(clicked()), this, SLOT(actAvatar()));
|
||||
connect(&editButton, &QPushButton::clicked, this, &UserInfoBox::actEdit);
|
||||
connect(&passwordButton, &QPushButton::clicked, this, &UserInfoBox::actPassword);
|
||||
connect(&avatarButton, &QPushButton::clicked, this, &UserInfoBox::actAvatar);
|
||||
}
|
||||
|
||||
setWindowTitle(tr("User Information"));
|
||||
|
|
@ -185,8 +185,7 @@ void UserInfoBox::updateInfo(const QString &userName)
|
|||
cmd.set_user_name(userName.toStdString());
|
||||
|
||||
PendingCommand *pend = client->prepareSessionCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this,
|
||||
SLOT(processResponse(const Response &)));
|
||||
connect(pend, &PendingCommand::finished, this, &UserInfoBox::processResponse);
|
||||
|
||||
client->sendCommand(pend);
|
||||
}
|
||||
|
|
@ -204,8 +203,7 @@ void UserInfoBox::actEdit()
|
|||
Command_GetUserInfo cmd;
|
||||
|
||||
PendingCommand *pend = client->prepareSessionCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this,
|
||||
SLOT(actEditInternal(const Response &)));
|
||||
connect(pend, &PendingCommand::finished, this, &UserInfoBox::actEditInternal);
|
||||
|
||||
client->sendCommand(pend);
|
||||
}
|
||||
|
|
@ -244,8 +242,7 @@ void UserInfoBox::actEditInternal(const Response &r)
|
|||
cmd.set_country(dlg.getCountry().toStdString());
|
||||
|
||||
PendingCommand *pend = client->prepareSessionCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this,
|
||||
SLOT(processEditResponse(const Response &)));
|
||||
connect(pend, &PendingCommand::finished, this, &UserInfoBox::processEditResponse);
|
||||
|
||||
client->sendCommand(pend);
|
||||
}
|
||||
|
|
@ -291,8 +288,7 @@ void UserInfoBox::changePassword(const QString &oldPassword, const QString &newP
|
|||
}
|
||||
|
||||
PendingCommand *pend = client->prepareSessionCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this,
|
||||
SLOT(processPasswordResponse(const Response &)));
|
||||
connect(pend, &PendingCommand::finished, this, &UserInfoBox::processPasswordResponse);
|
||||
|
||||
client->sendCommand(pend);
|
||||
}
|
||||
|
|
@ -307,8 +303,7 @@ void UserInfoBox::actAvatar()
|
|||
cmd.set_image(dlg.getImage().data(), dlg.getImage().size());
|
||||
|
||||
PendingCommand *pend = client->prepareSessionCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this,
|
||||
SLOT(processAvatarResponse(const Response &)));
|
||||
connect(pend, &PendingCommand::finished, this, &UserInfoBox::processAvatarResponse);
|
||||
|
||||
client->sendCommand(pend);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ BanDialog::BanDialog(const ServerInfo_User &info, QWidget *parent) : QDialog(par
|
|||
permanentRadio = new QRadioButton(tr("&permanent ban"));
|
||||
temporaryRadio = new QRadioButton(tr("&temporary ban"));
|
||||
temporaryRadio->setChecked(true);
|
||||
connect(temporaryRadio, SIGNAL(toggled(bool)), this, SLOT(enableTemporaryEdits(bool)));
|
||||
connect(temporaryRadio, &QRadioButton::toggled, this, &BanDialog::enableTemporaryEdits);
|
||||
daysLabel = new QLabel(tr("&Days:"));
|
||||
daysEdit = new QSpinBox;
|
||||
daysEdit->setMinimum(0);
|
||||
|
|
@ -106,9 +106,9 @@ BanDialog::BanDialog(const ServerInfo_User &info, QWidget *parent) : QDialog(par
|
|||
|
||||
QPushButton *okButton = new QPushButton(tr("&OK"));
|
||||
okButton->setAutoDefault(true);
|
||||
connect(okButton, SIGNAL(clicked()), this, SLOT(okClicked()));
|
||||
connect(okButton, &QPushButton::clicked, this, &BanDialog::okClicked);
|
||||
QPushButton *cancelButton = new QPushButton(tr("&Cancel"));
|
||||
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
|
||||
connect(cancelButton, &QPushButton::clicked, this, &BanDialog::reject);
|
||||
|
||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
||||
buttonLayout->addStretch();
|
||||
|
|
@ -144,9 +144,9 @@ WarningDialog::WarningDialog(const QString userName, const QString clientID, QWi
|
|||
|
||||
QPushButton *okButton = new QPushButton(tr("&OK"));
|
||||
okButton->setAutoDefault(true);
|
||||
connect(okButton, SIGNAL(clicked()), this, SLOT(okClicked()));
|
||||
connect(okButton, &QPushButton::clicked, this, &WarningDialog::okClicked);
|
||||
QPushButton *cancelButton = new QPushButton(tr("&Cancel"));
|
||||
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
|
||||
connect(cancelButton, &QPushButton::clicked, this, &WarningDialog::reject);
|
||||
|
||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
||||
buttonLayout->addStretch();
|
||||
|
|
@ -423,7 +423,7 @@ UserListWidget::UserListWidget(TabSupervisor *_tabSupervisor,
|
|||
{
|
||||
itemDelegate = new UserListItemDelegate(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->setColumnCount(3);
|
||||
|
|
@ -434,7 +434,7 @@ UserListWidget::UserListWidget(TabSupervisor *_tabSupervisor,
|
|||
userTree->setIconSize(QSize(20, 18));
|
||||
userTree->setItemDelegate(itemDelegate);
|
||||
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;
|
||||
vbox->addWidget(userTree);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue